org.netbeans.lib.cvsclient.command.update
Class UpdateCommand

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.update.UpdateCommand
All Implemented Interfaces:
java.lang.Cloneable, TemporaryFileCreator, CVSListener

public class UpdateCommand
extends BasicCommand
implements TemporaryFileCreator

The Update command. Updates files that have previously been checked out from the repository with the checkout command. Modified files are not overwritten.


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
UpdateCommand()
          Construct a new update command.
 
Method Summary
 Builder createBuilder(EventManager eventManager)
          Method that is called while the command is being executed.
 java.io.File createTempFile(java.lang.String filename)
          Method that creates a temporary file.
 void execute(ClientServices client, EventManager eventManager)
          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.
 KeywordSubstitutionOptions getKeywordSubst()
          Getter for property keywordSubst.
 java.lang.String getMergeRevision1()
          Getter for property mergeRevision1.
 java.lang.String getMergeRevision2()
          Getter for property mergeRevision2.
 java.lang.String getOptString()
          String returned by this method defines which options are available for this particular command
 java.lang.String getUpdateByDate()
          Getter for property updateByDate.
 java.lang.String getUpdateByRevision()
          Getter for property updateByRevision.
 boolean isBuildDirectories()
          Returns whether to build directories.
 boolean isCleanCopy()
          Returns whether to get a clean copy from the server.
 boolean isPipeToOutput()
          Getter for property pipeToOutput.
 boolean isPruneDirectories()
          Returns whether to prune directories.
 boolean isResetStickyOnes()
          Getter for property resetStickyOnes.
 boolean isUseHeadIfNotFound()
          Getter for property useHeadIfNotFound.
 void messageSent(MessageEvent e)
          Called when the server wants to send a message to be displayed to the user.
 void resetCVSCommand()
          Resets all switches in the command.
protected  void sendEntryAndModifiedRequests(Entry entry, java.io.File file)
          If getCleanCopy() returns true, the files will be treated as not existing.
 void setBuildDirectories(boolean buildDirectories)
          Set whether to build directories.
 void setCleanCopy(boolean cleanCopy)
          Sets whether to get a clean copy from the server.
 boolean setCVSCommand(char opt, java.lang.String optArg)
          Takes the arguments and by parsing them, sets the command.
 void setKeywordSubst(KeywordSubstitutionOptions keywordSubst)
          Setter for property keywordSubst.
 void setMergeRevision1(java.lang.String mergeRevision1)
          Setter for property mergeRevision1.
 void setMergeRevision2(java.lang.String mergeRevision2)
          Setter for property mergeRevision2.
 void setPipeToOutput(boolean pipeToOutput)
          Setter for property pipeToOutput.
 void setPruneDirectories(boolean pruneDirectories)
          Set whether to prune directories.
 void setResetStickyOnes(boolean resetStickyOnes)
          Setter for property resetStickyOnes.
 void setUpdateByDate(java.lang.String updateByDate)
          Setter for property updateByDate.
 void setUpdateByRevision(java.lang.String updateByRevision)
          Setter for property updateByRevision.
 void setUseHeadIfNotFound(boolean useHeadIfNotFound)
          Setter for property useHeadIfNotFound.
 
Methods inherited from class org.netbeans.lib.cvsclient.command.BasicCommand
addArgumentRequest, addArgumentRequests, addDirectoryRequest, addRequest, addRequestForFile, addRequestForWorkingDirectory, addRequestsForDirectory, addRequestsForFile, appendFileArguments, assumeLocalPathWhenUnspecified, doesCheckFileTime, getFileEndingWith, getFiles, getRecursive, getXthFile, isRecursive, setFiles, setRecursive
 
Methods inherited from class org.netbeans.lib.cvsclient.command.BuildableCommand
commandTerminated, isBuilderSet, 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

UpdateCommand

public UpdateCommand()
Construct a new update command.

Method Detail

createBuilder

public Builder createBuilder(EventManager eventManager)
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

sendEntryAndModifiedRequests

protected void sendEntryAndModifiedRequests(Entry entry,
                                            java.io.File file)
If getCleanCopy() returns true, the files will be treated as not existing.

Overrides:
sendEntryAndModifiedRequests in class BasicCommand
Parameters:
entry - the entry for the file
file - the file in question

setBuildDirectories

public void setBuildDirectories(boolean buildDirectories)
Set whether to build directories. This is the -d option in command-line CVS.


isBuildDirectories

public boolean isBuildDirectories()
Returns whether to build directories.

Returns:
true if directories are to be built, false otherwise

setCleanCopy

public void setCleanCopy(boolean cleanCopy)
Sets whether to get a clean copy from the server. Even locally modified files will not merged but overridden. This is the -C option in the command-line CVS.


isCleanCopy

public boolean isCleanCopy()
Returns whether to get a clean copy from the server.


setPruneDirectories

public void setPruneDirectories(boolean pruneDirectories)
Set whether to prune directories. This is the -P option in the command- line CVS.


isPruneDirectories

public boolean isPruneDirectories()
Returns whether to prune directories.

Returns:
true if directories should be removed if they contain no files, false otherwise.

execute

public void execute(ClientServices client,
                    EventManager eventManager)
             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

isPipeToOutput

public boolean isPipeToOutput()
Getter for property pipeToOutput.

Returns:
Value of property pipeToOutput.

setPipeToOutput

public void setPipeToOutput(boolean pipeToOutput)
Setter for property pipeToOutput.

Parameters:
pipeToOutput - New value of property pipeToOutput.

isResetStickyOnes

public boolean isResetStickyOnes()
Getter for property resetStickyOnes.

Returns:
Value of property resetStickyOnes.

setResetStickyOnes

public void setResetStickyOnes(boolean resetStickyOnes)
Setter for property resetStickyOnes.

Parameters:
resetStickyOnes - New value of property resetStickyOnes.

isUseHeadIfNotFound

public boolean isUseHeadIfNotFound()
Getter for property useHeadIfNotFound.

Returns:
Value of property useHeadIfNotFound.

setUseHeadIfNotFound

public void setUseHeadIfNotFound(boolean useHeadIfNotFound)
Setter for property useHeadIfNotFound.

Parameters:
useHeadIfNotFound - New value of property useHeadIfNotFound.

getUpdateByDate

public java.lang.String getUpdateByDate()
Getter for property updateByDate.

Returns:
Value of property updateByDate.

setUpdateByDate

public void setUpdateByDate(java.lang.String updateByDate)
Setter for property updateByDate.

Parameters:
updateByDate - New value of property updateByDate.

getUpdateByRevision

public java.lang.String getUpdateByRevision()
Getter for property updateByRevision.

Returns:
Value of property updateByRevision.

setUpdateByRevision

public void setUpdateByRevision(java.lang.String updateByRevision)
Setter for property updateByRevision.

Parameters:
updateByRevision - New value of property updateByRevision.

getKeywordSubst

public KeywordSubstitutionOptions getKeywordSubst()
Getter for property keywordSubst.

Returns:
Value of property keywordSubst.

setKeywordSubst

public void setKeywordSubst(KeywordSubstitutionOptions keywordSubst)
Setter for property keywordSubst.

Parameters:
keywordSubst - New value of property keywordSubst.

createTempFile

public java.io.File createTempFile(java.lang.String filename)
                            throws java.io.IOException
Method that creates a temporary file.

Specified by:
createTempFile in interface TemporaryFileCreator
Throws:
java.io.IOException

getCVSCommand

public java.lang.String getCVSCommand()
This method returns how the command would looklike when typed on the command line. Each command is responsible for constructing this information.

Specified by:
getCVSCommand 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

setCVSCommand

public boolean setCVSCommand(char opt,
                             java.lang.String optArg)
Takes the arguments and by parsing them, 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

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

messageSent

public void messageSent(MessageEvent e)
Called when the server wants to send a message to be displayed to the user. The message is only for information purposes and clients can choose to ignore these messages if they wish.

Specified by:
messageSent in interface CVSListener
Overrides:
messageSent in class BuildableCommand
Parameters:
e - the event

getOptString

public java.lang.String getOptString()
String returned by this method defines which options are available for this particular command

Specified by:
getOptString in class Command

getMergeRevision1

public java.lang.String getMergeRevision1()
Getter for property mergeRevision1.

Returns:
Value of property mergeRevision1.

setMergeRevision1

public void setMergeRevision1(java.lang.String mergeRevision1)
Setter for property mergeRevision1.

Parameters:
mergeRevision1 - New value of property mergeRevision1.

getMergeRevision2

public java.lang.String getMergeRevision2()
Getter for property mergeRevision2.

Returns:
Value of property mergeRevision2.

setMergeRevision2

public void setMergeRevision2(java.lang.String mergeRevision2)
Setter for property mergeRevision2.

Parameters:
mergeRevision2 - New value of property mergeRevision2.

 

Built on October 26 2010.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.