|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--allensoft.javacvs.client.CVSClient
This is the main class that implements the CVS client/server protocol.
It is used to send requests to the server and process the server's responses.
Typical usage is to create a batch of requests to perform and then perform them using
the perfromRequestBatch
method. For example, to perform a request that
commits changes to a file with the log message "Added some new features" you could do this:
// Create a request batch to add requests to
CVSRequestBatch batch = new CVSRequestBatch();
// Add a request to the batch
batch.addRequest (new CommitRequest (file, new CommitOptions ("Added some new features")));
// Now try to run the batch of requests. In this example, there is only one request added to the
// batch but you can add as many as you like. The requests can even be for completely different repositories.
try
{
client.performRequestBatch (batch); // Perform the batch
}
// Catch any problems and tell user
catch (CVSException e) {...}
catch (IOException e) {...}
As sending a single request is quite common there is also a more convenient method, performRequest
, to do a single request
without the requirement of creating a batch first. The above example could have also been written:
try
{
client.performRequest (new CommitRequest (file, new CommitOptions ("Added some new features")));
}
// Catch any problems and tell user
catch (CVSException e) {...}
catch (IOException e) {...}
The CVSClient also has some other very unique and powerful features.
One of those is a batch mode which causes requests to automatically be added to a batch and performed at
a later time. This is transparent to any calling code that is trying to perform requests. Batch mode is turned
on by calling the enterBatchMode
method. The requests that have built up can then be sent by calling
sendBatch
. Batch mode can also be turned off by calling exitBatchMode
but this
will mean that none of the requests that have been built up since enterBatchMode
will be performed.
Constructor Summary | |
CVSClient(CVSConnectionManager connectionManager,
LoginManager loginManager)
Creates a new CVS client that uses the supllied connection manager for creating connections and the supplied login manger for getting login details from the user. |
|
CVSClient(LoginManager loginManager)
Creates a new CVS client that uses the default connection manager for creating connections and the supplied login manger for getting login details from the user. |
Method Summary | |
void |
abortRequest()
|
void |
abortRequest(RequestAbortedException e)
Aborts the request(s) currently being performed. |
void |
addCVSClientListener(CVSClientListener listener)
|
void |
enterBatchMode()
Puts this client in batch mode. |
void |
exitBatchMode()
Exits batch mode. |
protected void |
fireEnteredBatchMode()
|
protected void |
fireExitedBatchMode()
|
protected void |
fireFinishedRequests()
|
protected void |
fireOpenedConnection()
|
protected void |
fireReceivedResponse(CVSResponse response)
|
protected void |
fireReceivedText(java.lang.String sText)
|
protected void |
fireSentText(java.lang.String sText)
|
protected void |
fireStartingRequests()
|
protected void |
fireStatusUpdate(java.lang.String sText)
|
CVSRequestBatch |
getBatch()
Gets the request batch that will be sent when sendBatch is called. |
CVSConnectionManager |
getConnectionManager()
Gets the connection manager this client uses to create connections to a server. |
CVSRequest |
getCurrentRequest()
|
GlobalOptions |
getGlobalOptions()
|
java.io.FileFilter |
getIgnoreFileFilter()
Gets the file filter used to determine if a file should be ignored. |
LoginManager |
getLoginManager()
Gets the login manager this client uses to get login details from the user when necessary. |
int |
getMaxDotDotLevel()
|
protected java.lang.String |
getResourceString(java.lang.String sSubKey)
|
boolean |
getUseUnchanged()
|
java.lang.String |
getValidResponses()
|
boolean |
isInBatchMode()
Checks if this client is in batch mode. |
boolean |
isPerformingRequests()
|
boolean |
isRequestValid(java.lang.String sRequest)
|
CVSResponse |
performRequest(CVSRequest request)
|
CVSResponse |
performRequest(CVSRequest request,
boolean bSendImmediately)
Performs a request. |
void |
performRequestBatch(CVSRequestBatch batch)
|
void |
performRequestBatch(CVSRequestBatch batch,
boolean bSendImmediately)
Performs a sequential list of requests using only one connection to a server. |
void |
removeCVSClientListener(CVSClientListener listener)
|
void |
sendBatch()
Sends the current batch of requests that have built up since enterBatchMode was called and
exits batch mode. |
void |
setConnectionManager(CVSConnectionManager manager)
Sets the connection manager this client uses to create connections to a server. |
void |
setGlobalOptions(GlobalOptions options)
|
void |
setIgnoreFileFilter(java.io.FileFilter filter)
Sets the file filter used to determine if a file should be ignored. |
void |
setLoginManager(LoginManager manager)
Sets the login manager this client uses to get login details from the user when necessary. |
void |
setMaxDotDotLevel(int n)
|
void |
setUseUnchanged(boolean b)
|
void |
setValidResponses(java.lang.String sResponses)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CVSClient(CVSConnectionManager connectionManager, LoginManager loginManager)
public CVSClient(LoginManager loginManager)
Method Detail |
public CVSRequest getCurrentRequest()
public void addCVSClientListener(CVSClientListener listener)
public void removeCVSClientListener(CVSClientListener listener)
public boolean isPerformingRequests()
public CVSConnectionManager getConnectionManager()
public void setConnectionManager(CVSConnectionManager manager)
public LoginManager getLoginManager()
public void setLoginManager(LoginManager manager)
public java.lang.String getValidResponses()
public void setValidResponses(java.lang.String sResponses)
public int getMaxDotDotLevel()
public void setMaxDotDotLevel(int n)
public boolean getUseUnchanged()
public void setUseUnchanged(boolean b)
public java.io.FileFilter getIgnoreFileFilter()
public void setIgnoreFileFilter(java.io.FileFilter filter)
public GlobalOptions getGlobalOptions()
public void setGlobalOptions(GlobalOptions options)
public boolean isRequestValid(java.lang.String sRequest)
public CVSResponse performRequest(CVSRequest request, boolean bSendImmediately) throws java.io.IOException, CVSException
client.performRequest (new UpdateRequest (file));
There are more convenient methods for performing common requests that build the request object and supply
it to this method. If bSendImmediately is true then the request will be sent immediately regardless of whether this client is
in batch mode or not.request
- the request to perform.bSendImmediately
- true if request should be sent immediately regardless of whether this client is in batch mode.
If false the request will be added to the current batch if in batch mode or performed immedaitely otherwise.CVSResponse
detailing the response from the server or null if no response was received.public CVSResponse performRequest(CVSRequest request) throws java.io.IOException, CVSException
public void performRequestBatch(CVSRequestBatch batch, boolean bSendImmediately) throws java.io.IOException, CVSException
public void performRequestBatch(CVSRequestBatch batch) throws java.io.IOException, CVSException
public void enterBatchMode()
sendBatch
method is called. This is transparent to any threads that have asked this client to
perform requests and they will simply wait until the batch is sent before continuing.public void exitBatchMode()
sendBatch
has been called the the current
batch of requests will not be performed.public boolean isInBatchMode()
public CVSRequestBatch getBatch()
sendBatch
is called.public void sendBatch() throws CVSException, java.io.IOException
enterBatchMode
was called and
exits batch mode. If the client is not in batch mode then this will
do nothing.public void abortRequest(RequestAbortedException e)
public void abortRequest()
protected java.lang.String getResourceString(java.lang.String sSubKey)
protected void fireSentText(java.lang.String sText)
protected void fireReceivedText(java.lang.String sText)
protected void fireStatusUpdate(java.lang.String sText)
protected void fireReceivedResponse(CVSResponse response)
protected void fireStartingRequests()
protected void fireOpenedConnection()
protected void fireFinishedRequests()
protected void fireEnteredBatchMode()
protected void fireExitedBatchMode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |