Class AbstractCommand
java.lang.Object
org.apache.activemq.console.command.AbstractCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
AbstractAmqCommand,AbstractJmxCommand,ConsumerCommand,CreateCommand,EncryptCommand,ProducerCommand,ShellCommand,StartCommand
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidExecute a generic command, which includes parsing the options for the command and running the specific task.protected voidhandleException(Exception exception, String serviceUrl) protected voidhandleOption(String token, List<String> tokens) Handle the general options for each command, which includes -h, -?protected voidparseOptions(List<String> tokens) Parse any option parameters in the command arguments specified by a '-' as the first character of the token.protected abstract voidPrint the help messages for the specific taskprotected voidprotected abstract voidRun the specific task.voidsetCommandContext(CommandContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.activemq.console.command.Command
getName, getOneLineDescription
-
Field Details
-
COMMAND_OPTION_DELIMETER
- See Also:
-
context
-
-
Constructor Details
-
AbstractCommand
public AbstractCommand()
-
-
Method Details
-
setCommandContext
- Specified by:
setCommandContextin interfaceCommand
-
execute
Execute a generic command, which includes parsing the options for the command and running the specific task. -
parseOptions
Parse any option parameters in the command arguments specified by a '-' as the first character of the token.- Parameters:
tokens- - command arguments- Throws:
Exception
-
handleOption
Handle the general options for each command, which includes -h, -?, --help, -D, --version.- Parameters:
token- - option token to handletokens- - succeeding command arguments- Throws:
Exception
-
runTask
Run the specific task.- Parameters:
tokens- - command arguments- Throws:
Exception
-
printHelp
protected abstract void printHelp()Print the help messages for the specific task -
printHelpFromFile
protected void printHelpFromFile() -
handleException
- Throws:
Exception
-