org.netbeans.lib.cvsclient.command.commit
Class CommitCommand

java.lang.Object
  extended by org.netbeans.lib.cvsclient.command.Command
      extended by org.netbeans.lib.cvsclient.command.BuildableCommand
          extended by org.netbeans.lib.cvsclient.command.BasicCommand
              extended by org.netbeans.lib.cvsclient.command.commit.CommitCommand
All Implemented Interfaces:
java.lang.Cloneable, CVSListener

public class CommitCommand
extends BasicCommand

The command to commit any changes that have been made.


Field Summary
 
Fields inherited from class org.netbeans.lib.cvsclient.command.BasicCommand
clientServices, files, requests
 
Fields inherited from class org.netbeans.lib.cvsclient.command.BuildableCommand
builder
 
Fields inherited from class org.netbeans.lib.cvsclient.command.Command
localDirectory
 
Constructor Summary
CommitCommand()
          Construct a CommitCommand.
 
Method Summary
protected  void addArgumentRequests()
          Add the argument requests.
protected  void addRequestsForDirectory(java.io.File directory)
          Adds the appropriate requests for a given directory.
protected  void addRequestsForFile(java.io.File file)
          Add the appropriate requests for a single file.
 Builder createBuilder(EventManager eventMan)
          Method that is called while the command is being executed.
protected  boolean doesCheckFileTime()
          Should return true if unchanged files should not be sent to server.
 void execute(ClientServices client, EventManager em)
          Execute the command.
 java.lang.String getCVSArguments()
          Returns the arguments of the command in the command-line style.
 java.lang.String getCVSCommand()
          This method returns how the command would looklike when typed on the command line.
 java.lang.String getLogMessageFromFile()
          Returns the filename for the file that defines the message.
 java.lang.String getMessage()
          Returns the commit message.
 java.lang.String getOptString()
          Returns a String defining which options are available for this command.
 java.lang.String getToRevisionOrBranch()
          Getter for property toRevisionOrBranch.
 boolean isForceCommit()
          Indicates whether the commit should be forced even if there are no changes.
 boolean isNoModuleProgram()
          Returns whether no module program should be executed on the server.
 void resetCVSCommand()
          Resets all switches in the command.
 boolean setCVSCommand(char opt, java.lang.String optArg)
          Takes the arguments and sets the command.
 void setForceCommit(boolean forceCommit)
          Sets whether the commit should be forced even if there are no changes.
 void setLogMessageFromFile(java.lang.String logMessageFromFile)
          Sets the filename for the file that defines the message.
 void setMessage(java.lang.String message)
          Sets the commit message.
 void setNoModuleProgram(boolean noModuleProgram)
          Sets whether no module program should run on the server
 void setToRevisionOrBranch(java.lang.String toRevBranch)
          Setter for property toRevisionOrBranch.
 
Methods inherited from class org.netbeans.lib.cvsclient.command.BasicCommand
addArgumentRequest, addDirectoryRequest, addRequest, addRequestForFile, addRequestForWorkingDirectory, appendFileArguments, assumeLocalPathWhenUnspecified, getFileEndingWith, getFiles, getRecursive, getXthFile, isRecursive, sendEntryAndModifiedRequests, setFiles, setRecursive
 
Methods inherited from class org.netbeans.lib.cvsclient.command.BuildableCommand
commandTerminated, isBuilderSet, messageSent, messageSent, setBuilder
 
Methods inherited from class org.netbeans.lib.cvsclient.command.Command
clone, fileAdded, fileInfoGenerated, fileRemoved, fileToRemove, fileUpdated, getDisplayName, getGlobalOptions, getLocalDirectory, getLocalPath, getRelativeToLocalPathInUnixStyle, getTrimmedString, hasFailed, moduleExpanded, setDisplayName, setLocalDirectory
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommitCommand

public CommitCommand()
Construct a CommitCommand.

Method Detail

getMessage

public java.lang.String getMessage()
Returns the commit message.


setMessage

public void setMessage(java.lang.String message)
Sets the commit message.


isForceCommit

public boolean isForceCommit()
Indicates whether the commit should be forced even if there are no changes.


setForceCommit

public void setForceCommit(boolean forceCommit)
Sets whether the commit should be forced even if there are no changes.


addRequestsForDirectory

protected void addRequestsForDirectory(java.io.File directory)
                                throws java.io.IOException
Adds the appropriate requests for a given directory. Sends a directory request followed by as many Entry and Modified requests as required.

Overrides:
addRequestsForDirectory in class BasicCommand
Parameters:
directory - the directory to send requests for
Throws:
java.io.IOException - if an error occurs constructing the requests

addRequestsForFile

protected void addRequestsForFile(java.io.File file)
                           throws java.io.IOException
Add the appropriate requests for a single file. A directory request is sent, followed by an Entry and Modified request.

Overrides:
addRequestsForFile in class BasicCommand
Parameters:
file - the file to send requests for
Throws:
java.io.IOException - if an error occurs constructing the requests

doesCheckFileTime

protected boolean doesCheckFileTime()
Should return true if unchanged files should not be sent to server. If false is returned, all files will be sent to server This method is used by sendEntryAndModifiedRequests.

Overrides:
doesCheckFileTime in class BasicCommand

execute

public void execute(ClientServices client,
                    EventManager em)
             throws CommandException,
                    AuthenticationException
Execute the command.

Overrides:
execute in class BasicCommand
Parameters:
client - the client services object that provides any necessary services to this command, including the ability to actually process all the requests
Throws:
CommandException - if an error occurs executing the command
AuthenticationException

addArgumentRequests

protected void addArgumentRequests()
Description copied from class: BasicCommand
Add the argument requests. The argument requests are created using the original set of files/directories passed in. Subclasses of this class should call this method at the appropriate point in their execute() method. Note that arguments are appended to the list.

Overrides:
addArgumentRequests in class BasicCommand

getCVSCommand

public java.lang.String getCVSCommand()
This method returns how the command would looklike when typed on the command line. Example: checkout -p CvsCommand.java

Specified by:
getCVSCommand in class Command

setCVSCommand

public boolean setCVSCommand(char opt,
                             java.lang.String optArg)
Takes the arguments and sets the command. To be mainly used for automatic settings (like parsing the .cvsrc file).

Specified by:
setCVSCommand in class Command
Returns:
true if the option (switch) was recognized and set

getOptString

public java.lang.String getOptString()
Returns a String defining which options are available for this command.

Specified by:
getOptString in class Command

createBuilder

public Builder createBuilder(EventManager eventMan)
Method that is called while the command is being executed. Descendants can override this method to return a Builder instance that will parse the server's output and create data structures.

Overrides:
createBuilder in class BuildableCommand

getLogMessageFromFile

public java.lang.String getLogMessageFromFile()
Returns the filename for the file that defines the message.


setLogMessageFromFile

public void setLogMessageFromFile(java.lang.String logMessageFromFile)
Sets the filename for the file that defines the message.


isNoModuleProgram

public boolean isNoModuleProgram()
Returns whether no module program should be executed on the server.


setNoModuleProgram

public void setNoModuleProgram(boolean noModuleProgram)
Sets whether no module program should run on the server


getToRevisionOrBranch

public java.lang.String getToRevisionOrBranch()
Getter for property toRevisionOrBranch.

Returns:
Value of property toRevisionOrBranch.

setToRevisionOrBranch

public void setToRevisionOrBranch(java.lang.String toRevBranch)
Setter for property toRevisionOrBranch.

Parameters:
toRevisionOrBranch - New value of property toRevisionOrBranch.

resetCVSCommand

public void resetCVSCommand()
Resets all switches in the command. After calling this method, the command should have no switches defined and should behave defaultly.

Specified by:
resetCVSCommand in class Command

getCVSArguments

public java.lang.String getCVSArguments()
Returns the arguments of the command in the command-line style. Similar to getCVSCommand() however without the files and command's name.

Specified by:
getCVSArguments in class Command

 

Built on August 7 2008.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.