org.netbeans.lib.cvsclient.command.add
Class AddCommand

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.add.AddCommand
All Implemented Interfaces:
java.lang.Cloneable, CVSListener

public class AddCommand
extends BuildableCommand

Adds a file or directory.


Field Summary
 
Fields inherited from class org.netbeans.lib.cvsclient.command.BuildableCommand
builder
 
Fields inherited from class org.netbeans.lib.cvsclient.command.Command
localDirectory
 
Constructor Summary
AddCommand()
          Constructor.
 
Method Summary
protected  void addRequests(java.io.File file)
          Add requests for a particular file or directory to be added.
protected  void addRequestsForFile(java.io.File file)
          Add requests for a particular file.
 Builder createBuilder(EventManager eventManager)
          Method that is called while the command is being executed.
 void execute(ClientServices client, EventManager em)
          Execute a 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 look like when typed on the command line.
 java.io.File getFileEndingWith(java.lang.String ending)
           
 java.io.File[] getFiles()
          Get the files and/or directories specified for this command to operate on.
 KeywordSubstitutionOptions getKeywordSubst()
          Getter for property keywordSubst.
 java.lang.String getMessage()
          Getter for property message.
 java.lang.String getOptString()
          Returns a string indicating the available options.
 void messageSent(MessageEvent e)
          Listens for output of the command.
 void resetCVSCommand()
          resets all switches in the command.
 boolean setCVSCommand(char opt, java.lang.String optArg)
          Takes the arguments and sets the command.
 void setFiles(java.io.File[] files)
          Set the files and/or directories on which to execute the command.
 void setKeywordSubst(KeywordSubstitutionOptions keywordSubst)
          Setter for property keywordSubst.
 void setMessage(java.lang.String message)
          Setter for property message.
 
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

AddCommand

public AddCommand()
Constructor.

Method Detail

setFiles

public void setFiles(java.io.File[] files)
Set the files and/or directories on which to execute the command. Sorts the paameter so that directories are first and files follow. That way a directory and it's content will be passed correctly. The user of the library has to specify all the files+dirs being added though. This is just a sanity check, so that no unnessesary errors occur.


getFiles

public java.io.File[] getFiles()
Get the files and/or directories specified for this command to operate on.

Returns:
the array of Files

getFileEndingWith

public java.io.File getFileEndingWith(java.lang.String ending)
Parameters:
ending - - the ending part of the file's pathname.. path separator is cvs's default '/'

getMessage

public java.lang.String getMessage()
Getter for property message.

Returns:
Value of property message.

setMessage

public void setMessage(java.lang.String message)
Setter for property message.

Parameters:
message - New value of property message.

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.

addRequests

protected void addRequests(java.io.File file)
                    throws java.io.IOException,
                           CommandException
Add requests for a particular file or directory to be added.

Throws:
java.io.IOException
CommandException

addRequestsForFile

protected void addRequestsForFile(java.io.File file)
                           throws java.io.IOException,
                                  CommandException
Add requests for a particular file.

Throws:
java.io.IOException
CommandException

execute

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

Overrides:
execute in class BuildableCommand
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

getCVSCommand

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

Specified by:
getCVSCommand in class Command

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

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 indicating the available options.

Specified by:
getOptString in class Command

messageSent

public void messageSent(MessageEvent e)
Listens for output of the command. If new directory is added, executes the createCvsFiles() method.

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

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 October 26 2010.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.