public abstract class BasicCommand extends BuildableCommand
Modifier and Type | Field and Description |
---|---|
protected ClientServices |
clientServices
The client services that are provided to this command.
|
protected File[] |
files
The files and/or directories to operate on.
|
protected List<Request> |
requests
The requests that are sent and processed.
|
builder
localDirectory
Constructor and Description |
---|
BasicCommand() |
Modifier and Type | Method and Description |
---|---|
protected void |
addArgumentRequest(boolean value,
String argument)
If the specified value is true, add a ArgumentRequest for the specified
argument.
|
protected void |
addArgumentRequests()
Add the argument requests.
|
protected void |
addDirectoryRequest(File directory)
Adds a DirectoryRequest (and maybe a StickyRequest) to the request list.
|
protected void |
addRequest(Request request)
Adds the specified request to the request list.
|
protected void |
addRequestForFile(File file,
Entry entry)
This method is called for each explicit file and for files within a
directory.
|
protected void |
addRequestForWorkingDirectory(ClientServices clientServices)
Adds the request for the current working directory.
|
protected void |
addRequestsForDirectory(File directory)
Adds the appropriate requests for a given directory.
|
protected void |
addRequestsForFile(File file)
Add the appropriate requests for a single file.
|
protected void |
appendFileArguments(StringBuffer buffer)
Appends the file's names to the specified buffer.
|
protected boolean |
assumeLocalPathWhenUnspecified()
The result from this command is used only when the getFiles() returns
null or empty array.
|
protected boolean |
doesCheckFileTime()
Should return true if unchanged files should not be sent to server.
|
void |
execute(ClientServices client,
EventManager em)
Execute a command.
|
File |
getFileEndingWith(String ending) |
File[] |
getFiles()
Get the files and/or directories specified for this command to operate
on.
|
boolean |
getRecursive()
Deprecated.
use isRecursive instead
|
File |
getXthFile(int index)
Get a single file from the "files" list.
|
boolean |
isRecursive()
Gets the value of the recursive option.
|
protected void |
sendEntryAndModifiedRequests(Entry entry,
File file)
Send an Entry followed by a Modified or Unchanged request based on
whether the file has been untouched on the local machine.
|
void |
setFiles(File[] theFiles)
Set the files and/or directories on which to execute the command.
|
void |
setRecursive(boolean recursive)
Sets the value of the recursive option.
|
commandTerminated, createBuilder, isBuilderSet, messageSent, messageSent, setBuilder
clone, fileAdded, fileInfoGenerated, fileRemoved, fileToRemove, fileUpdated, getCVSArguments, getCVSCommand, getDisplayName, getGlobalOptions, getLocalDirectory, getLocalPath, getOptString, getRelativeToLocalPathInUnixStyle, getTrimmedString, hasFailed, moduleExpanded, resetCVSCommand, setCVSCommand, setDisplayName, setLocalDirectory
protected ClientServices clientServices
protected File[] files
@Deprecated public boolean getRecursive()
public boolean isRecursive()
public void setRecursive(boolean recursive)
recursive
- true if the command should recurse, false otherwisepublic void setFiles(File[] theFiles)
null) is to use the directory in which the command was executed (see how directories are treated, below)
theFiles
- the files to operate on. May be null to indicate that the
local directory specified in the client should be used. Full,
absolute canonical pathnames must be supplied.public File[] getFiles()
public File getXthFile(int index)
index
- the index of the file in the list.public File getFileEndingWith(String ending)
ending
- - the ending part of the file's pathname.. path separator is
cvs's default '/'protected boolean doesCheckFileTime()
sendEntryAndModifiedRequests
.protected void sendEntryAndModifiedRequests(Entry entry, File file)
entry
- the entry for the filefile
- the file in questionprotected void addRequestsForDirectory(File directory) throws IOException, CommandAbortedException
directory
- the directory to send requests forIOException
- if an error occurs constructing the requestsCommandAbortedException
protected void addRequestForFile(File file, Entry entry)
protected void addRequestsForFile(File file) throws IOException
file
- the file to send requests forIOException
- if an error occurs constructing the requestsprotected final void addDirectoryRequest(File directory) throws IOException
IOException
protected void addArgumentRequests()
public void execute(ClientServices client, EventManager em) throws CommandException, AuthenticationException
update,
statusetc.)
execute
in class BuildableCommand
client
- the client services object that provides any necessary
services to this command, including the ability to actually
process all the requestsCommandException
- if an error occurs executing the commandAuthenticationException
protected boolean assumeLocalPathWhenUnspecified()
protected final void addRequest(Request request)
protected final void addRequestForWorkingDirectory(ClientServices clientServices) throws IOException
IOException
protected final void addArgumentRequest(boolean value, String argument)
protected final void appendFileArguments(StringBuffer buffer)
Copyright © 2016. All rights reserved.