allensoft.javacvs.client
Class CVSRequestBatch

java.lang.Object
  |
  +--allensoft.javacvs.client.CVSRequestBatch

public class CVSRequestBatch
extends java.lang.Object

Defines a sequential list of requests that should be performed. This allows a client to open only one connection to the server and perform all the requests for that server in a batch. This reduces the number of times that the user has to authenticate theirself to the server. For example, you could add requests to add new files, remove files and commit the changes all in one connection.


Inner Class Summary
static interface CVSRequestBatch.RequestInstantiator
          Instantiates request objects for use by the addRequests method.
 
Constructor Summary
CVSRequestBatch()
           
CVSRequestBatch(CVSRequest request)
          Creates a new request batch with the supplied request added to it.
 
Method Summary
 void addAddRequests(java.io.File[] files, AddOptions options, KeywordSubstitutionModeClassifier classifier)
          A convenience method that adds AddRequest objects for all the repository locations that the files correspond to.
 void addCommitRequests(java.io.File[] files, CommitOptions options)
          A convenience method that adds CommitRequest objects for all the repository locations that the files correspond to.
 void addDiffRequests(java.io.File[] files, DiffOptions options)
          A convenience method that adds DiffRequest objects for all the repository locations that the files correspond to.
 void addLogRequests(java.io.File[] files, LogOptions options)
          A convenience method that adds LogRequest objects for all the repository locations that the files correspond to.
 void addRemoveRequests(java.io.File[] files, RemoveOptions options)
          A convenience method that adds RemoveRequest objects for all the repository locations that the files correspond to.
 void addRequest(CVSRequest request)
          Adds a new request to the end of the list.
 void addRequests(java.io.File[] files, CVSRequestBatch.RequestInstantiator instantiator)
          Adds multiple requests to (possibly) different servers for the files specified.
 void addStatusRequests(java.io.File[] files)
          A convenience method that adds StatusRequest objects for all the repository locations that the files correspond to.
 void addTagRequests(java.io.File[] files, java.lang.String sTag, TagOptions options)
          A convenience method that adds CommitRequest objects for all the repository locations that the files correspond to.
 void addUpdateRequests(java.io.File[] files, CheckoutOptions options)
          A convenience method that adds UpdateRequest objects for all the repository locations that the files correspond to.
 int getRequestCount()
          Gets the number of requests added to this CVSRequests object.
 CVSRequest[] getRequests()
          Gets all requests added to this request batch.
 CVSResponse[] getResponsesOfType(java.lang.Class type)
          Gets all responses of the specified type.
 void removeRequest(CVSRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CVSRequestBatch

public CVSRequestBatch()

CVSRequestBatch

public CVSRequestBatch(CVSRequest request)
Creates a new request batch with the supplied request added to it.
Method Detail

getRequestCount

public int getRequestCount()
Gets the number of requests added to this CVSRequests object.

getRequests

public CVSRequest[] getRequests()
Gets all requests added to this request batch.

getResponsesOfType

public CVSResponse[] getResponsesOfType(java.lang.Class type)
Gets all responses of the specified type.

addRequest

public void addRequest(CVSRequest request)
Adds a new request to the end of the list.

removeRequest

public void removeRequest(CVSRequest request)

addRequests

public void addRequests(java.io.File[] files,
                        CVSRequestBatch.RequestInstantiator instantiator)
                 throws java.io.IOException,
                        CVSException
Adds multiple requests to (possibly) different servers for the files specified. This is useful when it is possible that the files specified could belong to different repository locations. Because a CVSRequest can only correspond to one repository location it is necessary to send multiple requests to the different servers. This method will determine how many different repository locations all the files correspond to. It will build up one request for each location using the RequestInstantiator object to instantiate the type of request that should be sent. Each request will then be added to the list of requests to perform. The chances are that all the files correspond to one repository location so only one request will be added but this can't always be guaranteed. The CVSClient will send all requests for one repository at a time and connect to as many as needed to perform a batch of requests.
Parameters:
files - files that are to be operated on by requests.
instantiator - object that instantiates the type of request to perform on the files.

addUpdateRequests

public void addUpdateRequests(java.io.File[] files,
                              CheckoutOptions options)
                       throws java.io.IOException,
                              CVSException
A convenience method that adds UpdateRequest objects for all the repository locations that the files correspond to.

addCommitRequests

public void addCommitRequests(java.io.File[] files,
                              CommitOptions options)
                       throws java.io.IOException,
                              CVSException
A convenience method that adds CommitRequest objects for all the repository locations that the files correspond to.

addAddRequests

public void addAddRequests(java.io.File[] files,
                           AddOptions options,
                           KeywordSubstitutionModeClassifier classifier)
                    throws java.io.IOException,
                           CVSException
A convenience method that adds AddRequest objects for all the repository locations that the files correspond to.

addRemoveRequests

public void addRemoveRequests(java.io.File[] files,
                              RemoveOptions options)
                       throws java.io.IOException,
                              CVSException
A convenience method that adds RemoveRequest objects for all the repository locations that the files correspond to.

addStatusRequests

public void addStatusRequests(java.io.File[] files)
                       throws java.io.IOException,
                              CVSException
A convenience method that adds StatusRequest objects for all the repository locations that the files correspond to.

addDiffRequests

public void addDiffRequests(java.io.File[] files,
                            DiffOptions options)
                     throws java.io.IOException,
                            CVSException
A convenience method that adds DiffRequest objects for all the repository locations that the files correspond to.

addLogRequests

public void addLogRequests(java.io.File[] files,
                           LogOptions options)
                    throws java.io.IOException,
                           CVSException
A convenience method that adds LogRequest objects for all the repository locations that the files correspond to.

addTagRequests

public void addTagRequests(java.io.File[] files,
                           java.lang.String sTag,
                           TagOptions options)
                    throws java.io.IOException,
                           CVSException
A convenience method that adds CommitRequest objects for all the repository locations that the files correspond to.