org.apache.activemq.console.command
Class AbstractCommand

java.lang.Object
  extended by org.apache.activemq.console.command.AbstractCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
AbstractAmqCommand, AbstractJmxCommand, ShellCommand, StartCommand

public abstract class AbstractCommand
extends java.lang.Object
implements Command


Field Summary
static java.lang.String COMMAND_OPTION_DELIMETER
           
 
Constructor Summary
AbstractCommand()
           
 
Method Summary
 void execute(java.util.List tokens)
          Exceute a generic command, which includes parsing the options for the command and running the specific task.
protected  void handleOption(java.lang.String token, java.util.List tokens)
          Handle the general options for each command, which includes -h, -?, --help, -D, --version.
protected  void parseOptions(java.util.List tokens)
          Parse any option parameters in the command arguments specified by a '-' as the first character of the token.
protected abstract  void printHelp()
          Print the help messages for the specific task
protected abstract  void runTask(java.util.List tokens)
          Run the specific task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMAND_OPTION_DELIMETER

public static final java.lang.String COMMAND_OPTION_DELIMETER
See Also:
Constant Field Values
Constructor Detail

AbstractCommand

public AbstractCommand()
Method Detail

execute

public void execute(java.util.List tokens)
             throws java.lang.Exception
Exceute a generic command, which includes parsing the options for the command and running the specific task.

Specified by:
execute in interface Command
Parameters:
tokens - - command arguments
Throws:
java.lang.Exception

parseOptions

protected void parseOptions(java.util.List tokens)
                     throws java.lang.Exception
Parse any option parameters in the command arguments specified by a '-' as the first character of the token.

Parameters:
tokens - - command arguments
Throws:
java.lang.Exception

handleOption

protected void handleOption(java.lang.String token,
                            java.util.List tokens)
                     throws java.lang.Exception
Handle the general options for each command, which includes -h, -?, --help, -D, --version.

Parameters:
token - - option token to handle
tokens - - succeeding command arguments
Throws:
java.lang.Exception

runTask

protected abstract void runTask(java.util.List tokens)
                         throws java.lang.Exception
Run the specific task.

Parameters:
tokens - - command arguments
Throws:
java.lang.Exception

printHelp

protected abstract void printHelp()
Print the help messages for the specific task



Copyright © 2009 Apache Software Foundation. All Rights Reserved.