|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Command
is an executable operation in Karma. Commands perform actions as per user requests.
Karma commands are based on the
Option
class in the
Apache package.
Karma wraps an Option
and features to it.
Method Summary | |
void |
cleanUp()
Called after execute() . |
void |
deregisterCommandResponseListener(CommandResponseListener responseListener)
Deregister the CommandResponseListener . |
void |
execute()
Executes the command. |
java.lang.String |
getAlias()
Gets the alias for this command (its short name). |
org.apache.commons.cli.CommandLine |
getCommandLine()
Gets the parsed command line for this command. |
CommandResponse |
getCommandResponse()
Return the specific CommandResponse object that this command uses. |
java.lang.String |
getDescription()
Gets this command's descriptive text. |
java.lang.String |
getHelp()
The command's help text. |
java.lang.String |
getName()
Gets the normal name of this command (its full name). |
void |
registerCommandResponseListener(CommandResponseListener responseListener)
Register the given CommandResponseListener as the handler for the command responses. |
void |
setCommandLine(org.apache.commons.cli.CommandLine commandLine)
|
void |
setContext(CommandContext context)
Stores a reference to a CommandContext . |
Method Detail |
public java.lang.String getName()
public java.lang.String getAlias()
public java.lang.String getDescription()
public java.lang.String getHelp()
HTML
for formatting.
public void execute() throws CommandException
CommandException
- When execution failed. This exception catches all underlying exceptions and rethrows them
as a CommandException, except for RuntimeException
s.public void cleanUp()
execute()
. Implementations can use this method to clean up resources and the like.
public void setContext(CommandContext context)
CommandContext
.
context
- An initialized command context.public void setCommandLine(org.apache.commons.cli.CommandLine commandLine)
public org.apache.commons.cli.CommandLine getCommandLine()
public void registerCommandResponseListener(CommandResponseListener responseListener)
CommandResponseListener
as the handler for the command responses.
responseListener
- public void deregisterCommandResponseListener(CommandResponseListener responseListener)
CommandResponseListener
.
public CommandResponse getCommandResponse()
CommandResponse
object that this command uses.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |