Class ShellCommand

java.lang.Object
  extended byShellCommand
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HelpCommand, ListCommand, LogoutCommand, MkdirCommand, NewfileCommand, RemoveCommand, TypeCommand

public abstract class ShellCommand
extends Object
implements Serializable

Model those features common to all ShellCommands. Each concrete extension of this class provides a constructor and an implementation for method doIt.

Version:
10
See Also:
Serialized Form

Constructor Summary
protected ShellCommand(String helpString)
          A constructor for commands having no arguments.
protected ShellCommand(String helpString, String argString)
          A constructor, always called (as super()) by the subclass.
 
Method Summary
abstract  void doIt(StringTokenizer args, Shell sh)
          Execute the command.
 String getArgString()
          The argument string prototype.
 String getHelpString()
          Help for this command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShellCommand

protected ShellCommand(String helpString)
A constructor for commands having no arguments.

Parameters:
helpString - a brief description of what the command does.

ShellCommand

protected ShellCommand(String helpString,
                       String argString)
A constructor, always called (as super()) by the subclass. Used only for commands that have arguments.

Parameters:
helpString - a brief description of what the command does.
argString - a prototype illustrating the required arguments.
Method Detail

doIt

public abstract void doIt(StringTokenizer args,
                          Shell sh)
                   throws JunoException
Execute the command.

Parameters:
args - the remainder of the command line.
sh - the current shell
Throws:
JunoException - for reporting errors

getArgString

public String getArgString()
The argument string prototype.

Returns:
the argument string prototype.

getHelpString

public String getHelpString()
Help for this command.

Returns:
the help string.