com.ice.cvsc
Class CVSRequest

java.lang.Object
  |
  +--com.ice.cvsc.CVSRequest

public class CVSRequest
extends java.lang.Object

The CVSRequest class is used to encapsulate a complete description of a CVS server request. Capable of parsing a simple string to define a request, CVSRequests are often built by configuration properties. Once a CVRequest is built and filled in, it is handed to a CVSClient for processing. Once the processing is completed, the CVSClient will return a CVSResponse containing the results of the request.

Version:
$Revision: 2.9 $
Author:
Timothy Gerard Endres, .
See Also:
CVSClient, CVSProject

Field Summary
 boolean allowGzipFileMode
          If true, allow gzip-file-contents mode, otherwise suppress it.
 boolean allowOverWrites
          If true, reponses that try to overwrite existing updated files will be allowed to overwrite if the file is in the list of files sent to the server.
 boolean displayReponse
          Determines if this request should display the reponse.
static int ES_ALL
           
static int ES_ALLLOST
           
static int ES_ALLMOD
           
static int ES_ALLUNC
           
static int ES_NEW
           
static int ES_NONE
           
static int ES_POPUP
           
static int ES_SEL
           
static int ES_SELALL
           
static int ES_SELLOST
           
static int ES_SELMOD
           
static int ES_SELUNC
           
static int ES_USER
           
 boolean execInCurDir
          This determines where cvs commands are executed.
 boolean forceModifieds
          Force every file to go up as 'Modified'.
 boolean guaranteeMsg
          Determines if this request will guarantee a '-m message' argument.
 boolean gzipFileMode
          If true, send all files using gzip-file-contents mode.
 int gzipStreamLevel
          If > 0, sets Gzip-stream level.
 boolean handleCopyFile
          Determines if this request will handle 'Copy-file' responses.
 boolean handleEntries
          Determines if this request will handle all entries related responses ('New-entry', 'Remove-entry', etc.).
 boolean handleFlags
          Determines if this request will handle all settings related responses ('Set-sticky', 'Clear-static-directory', etc.).
 boolean handleMerged
          Determines if this request will handle 'Merged' responses.
 boolean handleUpdated
          Determines if this request will handle 'Updated' responses.
 boolean ignoreResult
          If true, the reponse's status will be ignored and assumed to be 'ok'.
 boolean includeNotifies
          Determines if this request should include the 'Notify' requests.
static int METHOD_INETD
           
static int METHOD_RSH
           
static int METHOD_SSH
           
 java.util.Vector notifies
          The 'Notification' vector.
 boolean queueResponse
          Determines whether or not the server's reponse is queued.
static java.lang.String RCS_ID
           
static java.lang.String RCS_REV
           
 boolean redirectOutput
          Determines if the output of the reponse (stderr & stdout) will be redirected to a user specified file.
 CVSResponseHandler responseHandler
          The response handler.
 boolean saveTempFiles
          If true, the temporary files generated by this request will not be deleted as usual.
 boolean sendArguments
          Determines if this request will send 'Argument 's.
 boolean sendEmptyMods
          Determines if this request will send the special empty 'Modified' requests when a file is to be uploaded.
 boolean sendEntries
          Determines if this request will send the 'Entry' requests.
 boolean sendEntryFiles
          Determines if this request will send the 'Entry' list as 'files...'.
 boolean sendModifieds
          Determines if this request will send 'Modified' requests for files that are modified locally.
 boolean sendModule
          Determines if this request will send the 'Repository' list as 'module'.
 boolean sendRootDirectory
          Determines if this request will send the 'RootDirectory'.
 boolean staticDirIsSet
          Reflects the current 'Static-directory' setting in this request.
 boolean stickyIsSet
          Reflects the current 'Sticky' setting in this request.
 boolean traceProcessing
          If true, the processing phase of the CVS command will be traced on stderr.
 boolean traceRequest
          If true, the request phase of the CVS command will be traced on stderr.
 boolean traceResponse
          If true, the response phase of the CVS command will be traced on stderr.
 boolean traceTCPData
          If true, all input and output data (TCP bytes) will be traced.
 boolean useDirectory
          This is set by the "Valid-requests" cvs request.
 boolean useUnchanged
          This is set by the "Valid-requests" cvs request.
 java.lang.String validRequests
          The 'Valid-requests' response string from the server.
 boolean verificationOnly
          Determines if this request will only verify the login and then return.
 
Constructor Summary
CVSRequest()
          Constructs a new CVSRequest object.
 
Method Summary
 void appendArguments(CVSArgumentVector newArgs)
          Appends an argument list to the request's argument list.
 void appendGlobalArguments(CVSArgumentVector newArgs)
          Appends an argument list to the request's global argument list.
 void endRedirection()
           
protected  void finalize()
           
 CVSArgumentVector getArguments()
          Returns the request's argument list as a vector.
 java.lang.String getCheckInProgram()
          Returns the request's 'Checkin-prog' setting.
 java.lang.String getCommand()
          Returns the request's command name.
 int getConnectionMethod()
           
static java.lang.String getConnMethodName(int method)
           
 CVSEntry getDirEntry()
           
 CVSEntryVector getEntries()
          Returns the request's entry list as a vector.
 int getEntrySelector()
          Returns the request's entry selector.
 CVSArgumentVector getGlobalArguments()
          Returns the request's global argument list as a vector.
 int getGzipStreamLevel()
           
 java.lang.String getHostName()
          Returns the request's server hostname.
 java.lang.String getLocalDirectory()
          Returns the request's local directory, which represents the project's local directory.
 java.io.File getLocalFile(CVSEntry entry)
          Returns the request's entry's local file.
 java.lang.String getPassword()
           
 int getPort()
          Returns the request's server port number.
 java.lang.String getRepository()
          Returns the request's repository, which represents the project's CVS module on the server.
 CVSResponseHandler getResponseHandler()
          Returns the request's response handler.
 java.lang.String getRootDirectory()
          Returns the request's root directory, which represents the project's CVS root directory on the server.
 java.lang.String getRootRepository()
          Returns the request's ROOT repository.
 java.lang.String getRshProcess()
           
 java.lang.String getServerCommand()
           
 java.lang.String[] getSetVariables()
          Returns the request's user set variables.
 java.util.Hashtable getStatics()
          Returns the request's 'Static-directory' settings.
 java.util.Hashtable getStickys()
          Returns the request's 'Sticky' settings.
 java.lang.String getUpdateProgram()
          Returns the request's 'Update-prog' setting.
 CVSUserInterface getUserInterface()
           
 java.lang.String getUserName()
           
 java.lang.String getVerifyFailReason()
          Returns the reason for the last verification failure.
 boolean isPServer()
           
 boolean isRedirected()
           
 void parseArgumentString(java.lang.String argStr)
          Process a user provided, or command spec based, argument string.
 boolean parseControlString(java.lang.String specification)
          Attempts to parse a CVS request specification string.
static int parseEntriesSelector(char selectCh)
           
 void redirectLine(java.lang.String line)
           
 void setArguments(CVSArgumentVector arguments)
          Sets the request's argument list.
 void setCheckInProgram(java.lang.String program)
          Sets the request's 'Checkin-prog' setting.
 void setCommand(java.lang.String command)
          Sets the request's command.
 void setConnectionMethod(int method)
           
 void setDirEntry(CVSEntry dirEntry)
           
 void setEntries(CVSEntryVector entries)
          Sets the request's entry list.
 void setGlobalArguments(CVSArgumentVector arguments)
          Sets the request's global argument list.
 void setGzipStreamLevel(int level)
           
 void setHostName(java.lang.String hostName)
          Sets the request's server hostname.
 void setLocalDirectory(java.lang.String localDirectory)
          Sets the request's local directory.
 void setPassword(java.lang.String password)
           
 void setPort(int port)
          Sets the request's server port number.
 void setPServer(boolean isPServer)
           
 void setRedirectWriter(java.io.PrintWriter writer)
           
 void setRepository(java.lang.String repository)
          Sets the request's repository (or module name).
 void setResponseHandler(CVSResponseHandler responseHandler)
          Sets the request's response handler.
 void setRootDirectory(java.lang.String rootDirectory)
          Sets the request's root directory.
 void setRootRepository(java.lang.String repository)
          Sets the request's ROOT repository.
 void setRshProcess(java.lang.String rshProcess)
           
 void setServerCommand(java.lang.String command)
           
 void setSetVariables(java.lang.String[] vars)
          Sets the request's user set variables.
 void setStatics(java.util.Hashtable statics)
          Sets the request's 'Static-directory' settings.
 void setStickys(java.util.Hashtable stickys)
          Sets the request's 'Sticky' settings.
 void setUpdateProgram(java.lang.String program)
          Sets the request's 'Update-prog' setting.
 void setUserInterface(CVSUserInterface ui)
           
 void setUserName(java.lang.String userName)
           
 void setVerifyFailReason(java.lang.String reason)
          Sets the reason for the current verification failure.
 java.lang.String toString()
          Returns a string representation of this request.
 boolean verifyRequest()
          Verify the current request.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RCS_ID

public static final java.lang.String RCS_ID
See Also:
Constant Field Values

RCS_REV

public static final java.lang.String RCS_REV
See Also:
Constant Field Values

METHOD_INETD

public static final int METHOD_INETD
See Also:
Constant Field Values

METHOD_RSH

public static final int METHOD_RSH
See Also:
Constant Field Values

METHOD_SSH

public static final int METHOD_SSH
See Also:
Constant Field Values

ES_NONE

public static final int ES_NONE
See Also:
Constant Field Values

ES_ALL

public static final int ES_ALL
See Also:
Constant Field Values

ES_SEL

public static final int ES_SEL
See Also:
Constant Field Values

ES_SELALL

public static final int ES_SELALL
See Also:
Constant Field Values

ES_ALLMOD

public static final int ES_ALLMOD
See Also:
Constant Field Values

ES_SELMOD

public static final int ES_SELMOD
See Also:
Constant Field Values

ES_ALLLOST

public static final int ES_ALLLOST
See Also:
Constant Field Values

ES_SELLOST

public static final int ES_SELLOST
See Also:
Constant Field Values

ES_ALLUNC

public static final int ES_ALLUNC
See Also:
Constant Field Values

ES_SELUNC

public static final int ES_SELUNC
See Also:
Constant Field Values

ES_USER

public static final int ES_USER
See Also:
Constant Field Values

ES_NEW

public static final int ES_NEW
See Also:
Constant Field Values

ES_POPUP

public static final int ES_POPUP
See Also:
Constant Field Values

traceRequest

public boolean traceRequest
If true, the request phase of the CVS command will be traced on stderr.


traceResponse

public boolean traceResponse
If true, the response phase of the CVS command will be traced on stderr.


traceProcessing

public boolean traceProcessing
If true, the processing phase of the CVS command will be traced on stderr.


traceTCPData

public boolean traceTCPData
If true, all input and output data (TCP bytes) will be traced.


useUnchanged

public boolean useUnchanged
This is set by the "Valid-requests" cvs request. If true, the server understands 'Unchanged' requests.


useDirectory

public boolean useDirectory
This is set by the "Valid-requests" cvs request. If true, the server understands 'Directory' requests.


execInCurDir

public boolean execInCurDir
This determines where cvs commands are executed. If true, the command is run in the 'current directory'. If false, the command is run at the 'top level'.


sendEntries

public boolean sendEntries
Determines if this request will send the 'Entry' requests.


sendModifieds

public boolean sendModifieds
Determines if this request will send 'Modified' requests for files that are modified locally. If true, modified files are uploaded via 'Modified'. If false, modified files are treated as if they were unchanged.


sendEmptyMods

public boolean sendEmptyMods
Determines if this request will send the special empty 'Modified' requests when a file is to be uploaded. If true, all 'Modified' requests send a file size of zero to optimize the protocol when the file's contents are not needed.


sendArguments

public boolean sendArguments
Determines if this request will send 'Argument 's.


sendEntryFiles

public boolean sendEntryFiles
Determines if this request will send the 'Entry' list as 'files...'.


sendModule

public boolean sendModule
Determines if this request will send the 'Repository' list as 'module'.


sendRootDirectory

public boolean sendRootDirectory
Determines if this request will send the 'RootDirectory'.


includeNotifies

public boolean includeNotifies
Determines if this request should include the 'Notify' requests.


verificationOnly

public boolean verificationOnly
Determines if this request will only verify the login and then return.


guaranteeMsg

public boolean guaranteeMsg
Determines if this request will guarantee a '-m message' argument. Actually getting the message from the user is the responsibility of the code that uses the request, since CVSRequests have no clue about how to get messages.


redirectOutput

public boolean redirectOutput
Determines if the output of the reponse (stderr & stdout) will be redirected to a user specified file. It is the responsbility of the code using the request to setup the output file.


displayReponse

public boolean displayReponse
Determines if this request should display the reponse.


handleUpdated

public boolean handleUpdated
Determines if this request will handle 'Updated' responses.


handleMerged

public boolean handleMerged
Determines if this request will handle 'Merged' responses.


handleCopyFile

public boolean handleCopyFile
Determines if this request will handle 'Copy-file' responses.


handleEntries

public boolean handleEntries
Determines if this request will handle all entries related responses ('New-entry', 'Remove-entry', etc.).


handleFlags

public boolean handleFlags
Determines if this request will handle all settings related responses ('Set-sticky', 'Clear-static-directory', etc.).


ignoreResult

public boolean ignoreResult
If true, the reponse's status will be ignored and assumed to be 'ok'. If false, the reponse's status will be set to reflect the status returned by the server.


allowOverWrites

public boolean allowOverWrites
If true, reponses that try to overwrite existing updated files will be allowed to overwrite if the file is in the list of files sent to the server. If false, normal processing occurs (no overwrites allowed).


saveTempFiles

public boolean saveTempFiles
If true, the temporary files generated by this request will not be deleted as usual. This is primarily for debugging.


stickyIsSet

public boolean stickyIsSet
Reflects the current 'Sticky' setting in this request.


staticDirIsSet

public boolean staticDirIsSet
Reflects the current 'Static-directory' setting in this request.


validRequests

public java.lang.String validRequests
The 'Valid-requests' response string from the server.


queueResponse

public boolean queueResponse
Determines whether or not the server's reponse is queued. If true, all responses will be queued and handed back in the CVSResponse. If false, responses will be handed to the 'responseHandler' for processing as they come from the server.


responseHandler

public CVSResponseHandler responseHandler
The response handler. If this request does not use the 'queue response' option, then this field must be set to the CVSResponseHandler that will handle the responses to this request.


forceModifieds

public boolean forceModifieds
Force every file to go up as 'Modified'.


gzipStreamLevel

public int gzipStreamLevel
If > 0, sets Gzip-stream level. If 0, do not use Gzip-stream mode.


allowGzipFileMode

public boolean allowGzipFileMode
If true, allow gzip-file-contents mode, otherwise suppress it.


gzipFileMode

public boolean gzipFileMode
If true, send all files using gzip-file-contents mode.


notifies

public java.util.Vector notifies
The 'Notification' vector. If this vector is not null then it contains a vector if notification strings of the format: 'File\tType\tTime\tHost\tWorkingDir\tWatches'.

Constructor Detail

CVSRequest

public CVSRequest()
Constructs a new CVSRequest object.

Method Detail

getConnMethodName

public static java.lang.String getConnMethodName(int method)

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
java.lang.Throwable

getHostName

public java.lang.String getHostName()
Returns the request's server hostname.

Returns:
The string representing the request's server's hostname.

setHostName

public void setHostName(java.lang.String hostName)
Sets the request's server hostname. The hostname is used to establish the connection with the CVS server.

Parameters:
hostName - The new hostname for the request's CVS Server.

getPort

public int getPort()
Returns the request's server port number.

Returns:
The request's CVS server port number.

setPort

public void setPort(int port)
Sets the request's server port number. The port number is used to establish the connection with the CVS server.

Parameters:
port - The new port number for the request's CVS server.

isPServer

public boolean isPServer()

setPServer

public void setPServer(boolean isPServer)

getUserInterface

public CVSUserInterface getUserInterface()

setUserInterface

public void setUserInterface(CVSUserInterface ui)

getUserName

public java.lang.String getUserName()

setUserName

public void setUserName(java.lang.String userName)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String password)

getServerCommand

public java.lang.String getServerCommand()

setServerCommand

public void setServerCommand(java.lang.String command)

getConnectionMethod

public int getConnectionMethod()

setConnectionMethod

public void setConnectionMethod(int method)

getRshProcess

public java.lang.String getRshProcess()

setRshProcess

public void setRshProcess(java.lang.String rshProcess)

getGzipStreamLevel

public int getGzipStreamLevel()

setGzipStreamLevel

public void setGzipStreamLevel(int level)

getDirEntry

public CVSEntry getDirEntry()

setDirEntry

public void setDirEntry(CVSEntry dirEntry)

getLocalDirectory

public java.lang.String getLocalDirectory()
Returns the request's local directory, which represents the project's local directory.

Returns:
The request's local directory.

setLocalDirectory

public void setLocalDirectory(java.lang.String localDirectory)
Sets the request's local directory.

Parameters:
localDirectory - The new local directory for the request.

getLocalFile

public java.io.File getLocalFile(CVSEntry entry)
Returns the request's entry's local file.

Returns:
The request's entry's local file.

getRootDirectory

public java.lang.String getRootDirectory()
Returns the request's root directory, which represents the project's CVS root directory on the server.

Returns:
The request's root directory.

setRootDirectory

public void setRootDirectory(java.lang.String rootDirectory)
Sets the request's root directory.

Parameters:
rootDirectory - The new root directory for the request.

getRepository

public java.lang.String getRepository()
Returns the request's repository, which represents the project's CVS module on the server.

Returns:
The request's repository.

setRepository

public void setRepository(java.lang.String repository)
Sets the request's repository (or module name).

Parameters:
repository - The request's repository.

getRootRepository

public java.lang.String getRootRepository()
Returns the request's ROOT repository. This is the full repository path to the root entry's directory. This should match rootEntry.getRepository().

Returns:
The request's ROOT repository.

setRootRepository

public void setRootRepository(java.lang.String repository)
Sets the request's ROOT repository.

Parameters:
repository - The request's ROOT repository.

getResponseHandler

public CVSResponseHandler getResponseHandler()
Returns the request's response handler.

Returns:
The request's response handler.

setResponseHandler

public void setResponseHandler(CVSResponseHandler responseHandler)
Sets the request's response handler.


getEntries

public CVSEntryVector getEntries()
Returns the request's entry list as a vector.

Returns:
The request's entry list in a CVSEntryVector.

setEntries

public void setEntries(CVSEntryVector entries)
Sets the request's entry list.

Parameters:
entries - The new list of entries for this request.

getEntrySelector

public int getEntrySelector()
Returns the request's entry selector.

Returns:
The request's entry selector.

getArguments

public CVSArgumentVector getArguments()
Returns the request's argument list as a vector.

Returns:
The request's argument list.

setArguments

public void setArguments(CVSArgumentVector arguments)
Sets the request's argument list.

Parameters:
arguments - The new list of argument for this request.

appendArguments

public void appendArguments(CVSArgumentVector newArgs)
Appends an argument list to the request's argument list.


getGlobalArguments

public CVSArgumentVector getGlobalArguments()
Returns the request's global argument list as a vector.

Returns:
The request's argument list.

setGlobalArguments

public void setGlobalArguments(CVSArgumentVector arguments)
Sets the request's global argument list.

Parameters:
arguments - The new list of argument for this request.

appendGlobalArguments

public void appendGlobalArguments(CVSArgumentVector newArgs)
Appends an argument list to the request's global argument list.


getCommand

public java.lang.String getCommand()
Returns the request's command name.

Returns:
The request's command name.

setCommand

public void setCommand(java.lang.String command)
Sets the request's command.

Parameters:
command - The new command for this request.

getSetVariables

public java.lang.String[] getSetVariables()
Returns the request's user set variables.

Returns:
The request's user set variables.

setSetVariables

public void setSetVariables(java.lang.String[] vars)
Sets the request's user set variables.

Parameters:
vars - The new user set variables.

getStickys

public java.util.Hashtable getStickys()
Returns the request's 'Sticky' settings.

Returns:
The request's 'Sticky' settings Hashtable.

setStickys

public void setStickys(java.util.Hashtable stickys)
Sets the request's 'Sticky' settings.

Parameters:
stickys - The new Hashtable of this request's 'Sticky' settings.

getStatics

public java.util.Hashtable getStatics()
Returns the request's 'Static-directory' settings.

Returns:
The request's 'Static-directory' settings Hashtable.

setStatics

public void setStatics(java.util.Hashtable statics)
Sets the request's 'Static-directory' settings.

Parameters:
statics - The new Hashtable of 'Static-directory' settings.

getCheckInProgram

public java.lang.String getCheckInProgram()
Returns the request's 'Checkin-prog' setting.

Returns:
The request's 'Checkin-prog' program name.

setCheckInProgram

public void setCheckInProgram(java.lang.String program)
Sets the request's 'Checkin-prog' setting. This does not create or delete the 'Checkin.prog' administration file. This must be done by the request user.

Parameters:
program - The new checkin-program name.

getUpdateProgram

public java.lang.String getUpdateProgram()
Returns the request's 'Update-prog' setting.

Returns:
The request's 'Update-prog' program name.

setUpdateProgram

public void setUpdateProgram(java.lang.String program)
Sets the request's 'Update-prog' setting. This does not create or delete the 'Update.prog' administration file. This must be done by the request user.

Parameters:
program - The new update-program name.

isRedirected

public boolean isRedirected()

redirectLine

public void redirectLine(java.lang.String line)

setRedirectWriter

public void setRedirectWriter(java.io.PrintWriter writer)

endRedirection

public void endRedirection()

parseEntriesSelector

public static int parseEntriesSelector(char selectCh)

parseArgumentString

public void parseArgumentString(java.lang.String argStr)
Process a user provided, or command spec based, argument string. The syntax is '[global options] command options'.

Parameters:
argStr - The argument string to be parsed.

parseControlString

public boolean parseControlString(java.lang.String specification)
Attempts to parse a CVS request specification string. If the parse succeeds, this request object will be updated to reflect the request specification, making it ready to be handed to a CVSClient for processing. The string is of the format:
 :command:select:request:response:arguments
 Where:
    command   - is a valid cvs command name (e.g., 'update', 'co', 'diff')
    select    - specifies which entries to apply command to
    request   - is a valid cvs request specification
    reponse   - is a valid cvs reponse handling specification
    arguments - is the remainder of the string taken as command arguments
 Refer to the CVSRequest Specification for details.

Parameters:
specification - The CVSRequest Specification string to parse.
Returns:
True if the parse succeeded, false if it failed.

getVerifyFailReason

public java.lang.String getVerifyFailReason()
Returns the reason for the last verification failure.

Returns:
The reason for the last verification failure.
See Also:
verifyRequest(), setVerifyFailReason(java.lang.String)

setVerifyFailReason

public void setVerifyFailReason(java.lang.String reason)
Sets the reason for the current verification failure.

Parameters:
reason - The reason for the current verification failure.
See Also:
verifyRequest(), getVerifyFailReason()

verifyRequest

public boolean verifyRequest()
Verify the current request. This determines if the request has enough information to be handed to a CVSClient for processing. It also makes some sanity checks.

Returns:
True of the request is valid, false if not.
See Also:
verifyRequest(), getVerifyFailReason()

toString

public java.lang.String toString()
Returns a string representation of this request.

Overrides:
toString in class java.lang.Object
Returns:
String representing request.


Copyright © 1997-2003, Timothy G. Endres, All Rights Reserved.