public abstract class Command extends Object implements CVSListener, Cloneable
Modifier and Type | Field and Description |
---|---|
protected String |
localDirectory
The local directory from which the command is being run.
|
Constructor and Description |
---|
Command() |
Modifier and Type | Method and Description |
---|---|
Object |
clone()
This method just calls the Object.clone() and makes it public.
|
void |
commandTerminated(TerminationEvent e)
Called when server responses with "ok" or "error", (when the command
finishes).
|
void |
execute(ClientServices client,
EventManager eventManager)
Execute this command.
|
void |
fileAdded(FileAddedEvent e)
Called when a file has been added.
|
void |
fileInfoGenerated(FileInfoEvent e)
Called when file status information has been received.
|
void |
fileRemoved(FileRemovedEvent e)
Called when a file is removed.
|
void |
fileToRemove(FileToRemoveEvent e)
Called when a file is going to be removed.
|
void |
fileUpdated(FileUpdatedEvent e)
Called when a file has been updated.
|
abstract String |
getCVSArguments()
Returns the arguments of the command in the command-line style.
|
abstract String |
getCVSCommand()
This method returns how the command would looklike when typed on the
command line.
|
String |
getDisplayName()
Returns localized name describing command purpose or
null . |
GlobalOptions |
getGlobalOptions()
Get the global options.
|
String |
getLocalDirectory()
Returns the local path the command is associated with.
|
String |
getLocalPath()
Deprecated.
Please use the getLocalDirectory() method instead.
|
abstract String |
getOptString()
Returns a String that defines which options are available for this
particular command.
|
String |
getRelativeToLocalPathInUnixStyle(File file)
Returns the relative path of the specified file (relative to the set
local path).
|
protected static String |
getTrimmedString(String s)
Returns the trimmed version of the specified String s.
|
boolean |
hasFailed() |
void |
messageSent(BinaryMessageEvent e)
Called when the server wants to send a binary message to be displayed to
the user.
|
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 servers has responded to an expand-modules
request.
|
abstract void |
resetCVSCommand()
Resets all switches in the command to the default behaviour.
|
abstract boolean |
setCVSCommand(char opt,
String optArg)
Takes the arguments and sets the command.
|
void |
setDisplayName(String name)
Defines prefered display name or
null . |
protected void |
setLocalDirectory(String localDirectory)
Sets the local directory for the command.
|
protected String localDirectory
public void execute(ClientServices client, EventManager eventManager) throws CommandException, CommandAbortedException, AuthenticationException
client
- the client services object that provides any necessary
services to this command, including the ability to actually
process all the requestse
- the event manager. The command can use this to fire events if
necessary - for example, while parsing status responses.CommandException
CommandAbortedException
AuthenticationException
public abstract String getCVSCommand()
public abstract String getCVSArguments()
public abstract boolean setCVSCommand(char opt, String optArg)
public abstract void resetCVSCommand()
public abstract String getOptString()
public Object clone()
public boolean hasFailed()
public void messageSent(MessageEvent e)
messageSent
in interface CVSListener
e
- the eventpublic void messageSent(BinaryMessageEvent e)
CVSListener
messageSent
in interface CVSListener
e
- the eventpublic void fileAdded(FileAddedEvent e)
fileAdded
in interface CVSListener
e
- the eventpublic void fileToRemove(FileToRemoveEvent e)
fileToRemove
in interface CVSListener
e
- the eventpublic void fileRemoved(FileRemovedEvent e)
fileRemoved
in interface CVSListener
e
- the eventpublic void fileUpdated(FileUpdatedEvent e)
fileUpdated
in interface CVSListener
e
- the eventpublic void fileInfoGenerated(FileInfoEvent e)
fileInfoGenerated
in interface CVSListener
public void commandTerminated(TerminationEvent e)
commandTerminated
in interface CVSListener
public void moduleExpanded(ModuleExpansionEvent e)
moduleExpanded
in interface CVSListener
public final String getLocalDirectory()
@Deprecated public final String getLocalPath()
public final GlobalOptions getGlobalOptions()
public final String getRelativeToLocalPathInUnixStyle(File file)
protected final void setLocalDirectory(String localDirectory)
protected static final String getTrimmedString(String s)
public void setDisplayName(String name)
null
. Localized string
should highlight command purpose (use verb in gerund). E.g.
UpdateCommand
used to refresh statuses should be named
"Refreshing Status" rather than "cvs -N update", "Updating" or
"Status Refresh".public String getDisplayName()
null
.getCVSCommand()
Copyright © 2016. All rights reserved.