org.netbeans.lib.cvsclient.command
Class RepositoryCommand

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.RepositoryCommand
All Implemented Interfaces:
java.lang.Cloneable, CVSListener
Direct Known Subclasses:
ExportCommand, RtagCommand

public abstract class RepositoryCommand
extends BuildableCommand

A class that provides common functionality for CVS commands that operate upon the repository.


Field Summary
protected  ClientServices clientServices
          The client services that are provided to this command.
protected  java.util.List expandedModules
          The expanded modules.
protected  java.util.List modules
          The modules to process.
protected  java.util.List requests
          The requests that are sent and processed.
 
Fields inherited from class org.netbeans.lib.cvsclient.command.BuildableCommand
builder
 
Fields inherited from class org.netbeans.lib.cvsclient.command.Command
localDirectory
 
Constructor Summary
RepositoryCommand()
           
 
Method Summary
protected  void addArgumentRequest(boolean value, java.lang.String argument)
          If the specified value is true, add a ArgumentRequest for the specified argument.
protected  void addArgumentRequests()
          Add the argument requests.
 void addModule(java.lang.String module)
          Add a module to process.
protected  void addRequest(Request request)
          Adds the specified request to the request list.
protected  void addRequestForWorkingDirectory(ClientServices clientServices)
          Adds the request for the current working directory.
protected  void appendModuleArguments(java.lang.StringBuffer buffer)
          Appends the file's names to the specified buffer.
 void clearModules()
          Clear the list of modules.
 void execute(ClientServices client, EventManager em)
          Execute this command.
 java.lang.String[] getModules()
          Get the array of modules that are set to be processed.
 boolean isRecursive()
          Gets the value of the recursive option.
 void moduleExpanded(ModuleExpansionEvent e)
          This is called when the server has responded to an expand-modules request.
protected abstract  void postExpansionExecute(ClientServices client, EventManager em)
          Execute this command
 void setModules(java.lang.String[] modules)
          Set the modules to process.
 void setRecursive(boolean recursive)
          Sets the value of the recursive option.
 
Methods inherited from class org.netbeans.lib.cvsclient.command.BuildableCommand
commandTerminated, createBuilder, isBuilderSet, messageSent, messageSent, setBuilder
 
Methods inherited from class org.netbeans.lib.cvsclient.command.Command
clone, fileAdded, fileInfoGenerated, fileRemoved, fileToRemove, fileUpdated, getCVSArguments, getCVSCommand, getDisplayName, getGlobalOptions, getLocalDirectory, getLocalPath, getOptString, getRelativeToLocalPathInUnixStyle, getTrimmedString, hasFailed, resetCVSCommand, setCVSCommand, setDisplayName, setLocalDirectory
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

requests

protected java.util.List requests
The requests that are sent and processed.


clientServices

protected ClientServices clientServices
The client services that are provided to this command.


modules

protected final java.util.List modules
The modules to process. These names are unexpanded and will be passed to a module-expansion request.


expandedModules

protected final java.util.List expandedModules
The expanded modules.

Constructor Detail

RepositoryCommand

public RepositoryCommand()
Method Detail

isRecursive

public boolean isRecursive()
Gets the value of the recursive option.

Returns:
true if recursive, false if not

setRecursive

public void setRecursive(boolean recursive)
Sets the value of the recursive option.

Parameters:
r - true if the command should recurse, false otherwise

addModule

public void addModule(java.lang.String module)
Add a module to process.

Parameters:
module - the name of the module to process

setModules

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

Parameters:
modules - the names of the modules to process

getModules

public java.lang.String[] getModules()
Get the array of modules that are set to be processed.


clearModules

public void clearModules()
Clear the list of modules.


addArgumentRequests

protected final void addArgumentRequests()
Add the argument requests. The argument requests are created using the expanded set of modules passed in. Subclasses of this class should call this method at the appropriate point in their postExpansionExecute() method. Note that arguments are appended to the list.


moduleExpanded

public final 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

execute

public final void execute(ClientServices client,
                          EventManager em)
                   throws CommandException,
                          AuthenticationException
Execute this command. This method sends the ExpandModulesRequest in order to expand the modules that were set. The actual execution is performed by postExpansionExecute(org.netbeans.lib.cvsclient.ClientServices, org.netbeans.lib.cvsclient.event.EventManager) method.

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

postExpansionExecute

protected abstract void postExpansionExecute(ClientServices client,
                                             EventManager em)
                                      throws CommandException,
                                             AuthenticationException
Execute this command

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
AuthenticationException

addRequest

protected final void addRequest(Request request)
Adds the specified request to the request list.


addRequestForWorkingDirectory

protected final void addRequestForWorkingDirectory(ClientServices clientServices)
                                            throws java.io.IOException
Adds the request for the current working directory.

Throws:
java.io.IOException

addArgumentRequest

protected final void addArgumentRequest(boolean value,
                                        java.lang.String argument)
If the specified value is true, add a ArgumentRequest for the specified argument.


appendModuleArguments

protected final void appendModuleArguments(java.lang.StringBuffer buffer)
Appends the file's names to the specified buffer.


 

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