org.netbeans.lib.cvsclient.command.checkout
Class CheckoutCommand

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

public class CheckoutCommand
extends BasicCommand
implements TemporaryFileCreator

The checkout command. This handles the sending of the requests and the processing of the responses from the server.


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
CheckoutCommand()
          Construct a checkout command, with default values for options.
CheckoutCommand(boolean recursive, java.lang.String module)
          Construct a new checkout command.
CheckoutCommand(boolean recursive, java.lang.String[] modules)
          Construct a new checkout command.
 
Method Summary
protected  boolean assumeLocalPathWhenUnspecified()
          The result from this command is used only when the getFiles() returns null or empty array.
 void clearModules()
          clears the list of modules for checkout.
 Builder createBuilder(EventManager eventMan)
          Method that is called while the command is being executed.
 java.io.File createTempFile(java.lang.String filename)
           
 void execute(ClientServices client, EventManager em)
          Execute this command.
 java.lang.String getCheckoutByDate()
          Getter for property checkoutByDate.
 java.lang.String getCheckoutByRevision()
          Getter for property checkoutByRevision.
 java.lang.String getCheckoutDirectory()
          Getter for property checkoutDirectory.
 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[] getModules()
           
 java.lang.String getOptString()
          String returned by this method defines which options are available for this particular command
 boolean getPruneDirectories()
          Get whether to prune directories.
 boolean isNotRunModuleProgram()
          Getter for property notRunModuleProgram.
 boolean isNotShortenPaths()
          Getter for property notShortenPaths.
 boolean isPipeToOutput()
          Getter for property pipeToOutput.
 boolean isResetStickyOnes()
          Getter for property resetStickyOnes.
 boolean isShowModules()
          Getter for property showModules.
 boolean isShowModulesWithStatus()
          Getter for property showModulesWithStatus.
 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 moduleExpanded(ModuleExpansionEvent e)
          This is called when the server has responded to an expand-modules request.
 void resetCVSCommand()
          Resets all switches in the command.
 void setCheckoutByDate(java.lang.String checkoutByDate)
          Setter for property checkoutByDate.
 void setCheckoutByRevision(java.lang.String checkoutByRevision)
          Setter for property checkoutByRevision.
 void setCheckoutDirectory(java.lang.String checkoutDirectory)
          Setter for property checkoutDirectory.
 boolean setCVSCommand(char opt, java.lang.String optArg)
          Takes the arguments and sets the command.
 void setKeywordSubst(KeywordSubstitutionOptions keywordSubst)
          Setter for property keywordSubst.
 void setModule(java.lang.String module)
          Set the modules to checkout.
 void setModules(java.lang.String[] modules)
          Set the modules to checkout.
 void setNotRunModuleProgram(boolean notRunModuleProgram)
          Setter for property notRunModuleProgram.
 void setNotShortenPaths(boolean notShortenPaths)
          Setter for property notShortenPaths.
 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 setShowModules(boolean showModules)
          Setter for property showModules.
 void setShowModulesWithStatus(boolean showModulesWithStatus)
          Setter for property showModulesWithStatus.
 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, doesCheckFileTime, getFileEndingWith, getFiles, getRecursive, getXthFile, isRecursive, sendEntryAndModifiedRequests, 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, setDisplayName, setLocalDirectory
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckoutCommand

public CheckoutCommand(boolean recursive,
                       java.lang.String[] modules)
Construct a new checkout command.

Parameters:
recursive - whether to do a recursive checkout
modules - an array of modules names to checkout

CheckoutCommand

public CheckoutCommand(boolean recursive,
                       java.lang.String module)
Construct a new checkout command.

Parameters:
recursive - whether to do a recursive checkout
module - the module to checkout

CheckoutCommand

public CheckoutCommand()
Construct a checkout command, with default values for options.

Method Detail

setModule

public void setModule(java.lang.String module)
Set the modules to checkout.

Parameters:
theModules - the names (it's like relative path) of the modules to checkout

clearModules

public void clearModules()
clears the list of modules for checkout.


setModules

public void setModules(java.lang.String[] modules)
Set the modules to checkout.

Parameters:
theModules - the names of the modules to checkout

getModules

public java.lang.String[] getModules()

execute

public void execute(ClientServices client,
                    EventManager em)
             throws CommandException,
                    AuthenticationException
Execute this 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

assumeLocalPathWhenUnspecified

protected boolean assumeLocalPathWhenUnspecified()
The result from this command is used only when the getFiles() returns null or empty array. in such a case and when this method returns true, it is assumed the localpath should be taken as the 'default' file for the building of requests. in checkout we operate with modules rather then files. This produces problems in the following situation. If you have something already checked out and want to checkout another module that is not checked out yet, then there's nothing to be translated from modules to files. and in such a case the localpathis assumed, which includes non-relevant already checked out directories..

Overrides:
assumeLocalPathWhenUnspecified in class BasicCommand

moduleExpanded

public void moduleExpanded(ModuleExpansionEvent e)
This is called when the server has responded to an expand-modules request.

Specified by:
moduleExpanded in interface CVSListener
Overrides:
moduleExpanded in class Command

isShowModules

public boolean isShowModules()
Getter for property showModules.

Returns:
Value of property showModules.

setShowModules

public void setShowModules(boolean showModules)
Setter for property showModules.

Parameters:
showModules - New value of property showModules.

isShowModulesWithStatus

public boolean isShowModulesWithStatus()
Getter for property showModulesWithStatus.

Returns:
Value of property showModulesWithStatus.

setShowModulesWithStatus

public void setShowModulesWithStatus(boolean showModulesWithStatus)
Setter for property showModulesWithStatus.

Parameters:
showModulesWithStatus - New value of property showModulesWithStatus.

setPruneDirectories

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


getPruneDirectories

public boolean getPruneDirectories()
Get whether to prune directories.

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

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.

isNotShortenPaths

public boolean isNotShortenPaths()
Getter for property notShortenPaths.

Returns:
Value of property notShortenPaths.

setNotShortenPaths

public void setNotShortenPaths(boolean notShortenPaths)
Setter for property notShortenPaths.

Parameters:
notShortenPaths - New value of property notShortenPaths.

isNotRunModuleProgram

public boolean isNotRunModuleProgram()
Getter for property notRunModuleProgram.

Returns:
Value of property notRunModuleProgram.

setNotRunModuleProgram

public void setNotRunModuleProgram(boolean notRunModuleProgram)
Setter for property notRunModuleProgram.

Parameters:
notRunModuleProgram - New value of property notRunModuleProgram.

getCheckoutByDate

public java.lang.String getCheckoutByDate()
Getter for property checkoutByDate.

Returns:
Value of property checkoutByDate.

setCheckoutByDate

public void setCheckoutByDate(java.lang.String checkoutByDate)
Setter for property checkoutByDate.

Parameters:
checkoutByDate - New value of property checkoutByDate.

getCheckoutByRevision

public java.lang.String getCheckoutByRevision()
Getter for property checkoutByRevision.

Returns:
Value of property checkoutByRevision.

setCheckoutByRevision

public void setCheckoutByRevision(java.lang.String checkoutByRevision)
Setter for property checkoutByRevision.

Parameters:
checkoutByRevision - New value of property checkoutByRevision.

getCheckoutDirectory

public java.lang.String getCheckoutDirectory()
Getter for property checkoutDirectory.

Returns:
Value of property checkoutDirectory.

setCheckoutDirectory

public void setCheckoutDirectory(java.lang.String checkoutDirectory)
Setter for property checkoutDirectory.

Parameters:
checkoutDirectory - New value of property checkoutDirectory.

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.

createBuilder

public Builder createBuilder(EventManager eventMan)
Description copied from class: BuildableCommand
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

createTempFile

public java.io.File createTempFile(java.lang.String filename)
                            throws java.io.IOException
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

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()
String returned by this method defines which options are available for this particular command

Specified by:
getOptString in class Command

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

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

 

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