|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.uniba.wiai.lspi.util.console.Command
public abstract class Command
| Field Summary | |
|---|---|
protected String |
HELP_ARG1
Standard argument for displaying help of this command. |
protected String |
HELP_ARG2
Alternative standard argument for displaying help of this command. |
protected PrintStream |
out
The PrintStream to print the command's output to. |
protected Map<String,String> |
parameters
The parameters passed to this command are contained within this Hashtable. |
protected Object[] |
toCommand
The instances to execute the commands on. |
| Constructor Summary | |
|---|---|
Command(Object[] toCommand,
PrintStream out)
Creates a new instance of Command. |
|
| Method Summary | |
|---|---|
void |
addParameter(String paramName,
String paramValue)
Add a command line parameter. |
abstract void |
exec()
To be overwritten by subclasses for command execution. |
void |
execute()
Executes the command. |
abstract String |
getCommandName()
Return the name of the command. |
abstract void |
printOutHelp()
To be overwritten. |
void |
setParameters(Map<String,String> parameters)
Set the parameters for the Command. |
void |
setPrintStream(PrintStream out)
Set the PrintStream, to that this command prints its
output. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Object[] toCommand
protected Map<String,String> parameters
protected final String HELP_ARG1
protected final String HELP_ARG2
protected PrintStream out
| Constructor Detail |
|---|
public Command(Object[] toCommand,
PrintStream out)
out - The java.io.PrintStream to that the command's output is
printed.toCommand - The instance to execute the command on.| Method Detail |
|---|
public void setPrintStream(PrintStream out)
PrintStream, to that this command prints its
output.
out - The PrintStream.
public final void addParameter(String paramName,
String paramValue)
paramName - The parameters name. Cannot contain spaces.paramValue - The parameters value. Cannot contain spaces.
public final void execute()
throws ConsoleException
ConsoleException - Exception during execution of command.
public abstract void exec()
throws ConsoleException
ConsoleException - Exception during execution.public abstract void printOutHelp()
public abstract String getCommandName()
exit.public void setParameters(Map<String,String> parameters)
parameters - Hashtable containing the parameter names as keys and the
parameter values as values. Both represented as Strings. Both
must not contain spaces.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||