com.notuvy.cmd
Class Command

java.lang.Object
  extended by com.notuvy.cmd.CommandAction
      extended by com.notuvy.cmd.Command

public abstract class Command
extends CommandAction

A single command performing an actual action. It is subclassed with an implementation of the process() method. User: murali Date: Jan 2, 2008 Time: 2:10:35 PM


Field Summary
 
Fields inherited from class com.notuvy.cmd.CommandAction
LOG
 
Constructor Summary
protected Command(String pKey)
           
protected Command(String pKey, String pArgumentsString)
           
 
Method Summary
 String getArgumentsString()
           
protected  String getBody()
           
protected  boolean handle(CommandArgs pArgs)
           
 List<String> listCommands()
           
abstract  boolean process(CommandArgs pArgs)
          The principle logic of this command.
 String toUsageString()
           
 
Methods inherited from class com.notuvy.cmd.CommandAction
constructParentCommands, getKey, getParent, isTerminated, process, setParent, setTerminated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

protected Command(String pKey,
                  String pArgumentsString)

Command

protected Command(String pKey)
Method Detail

getArgumentsString

public String getArgumentsString()

getBody

protected String getBody()

listCommands

public List<String> listCommands()
Specified by:
listCommands in class CommandAction

process

public abstract boolean process(CommandArgs pArgs)
The principle logic of this command. It must return true if successfully executed, or false if there was a problem and processing must be aborted. The CommandArgs must be properly managed. It must assert that all the required arguments are present.

Overrides:
process in class CommandAction
Parameters:
pArgs - The argument available list. Note that it will contain the arguments for this command plus all follow-on commands and their arguments.
Returns:
The status flag; true for success (processing proceeds) and false for failure (processing aborts).

handle

protected boolean handle(CommandArgs pArgs)
Specified by:
handle in class CommandAction

toUsageString

public String toUsageString()
Specified by:
toUsageString in class CommandAction


Copyright © 2013. All Rights Reserved.