|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ow2.petals.cli.shell.Shell
public abstract class Shell
A shell registers and evaluates commands
| Field Summary | |
|---|---|
java.io.PrintStream |
err
|
java.io.InputStream |
in
|
java.io.PrintStream |
out
|
| Constructor Summary | |
|---|---|
Shell()
|
|
Shell(Command[] commands)
Creates a new shell from a set of commands |
|
| Method Summary | |
|---|---|
void |
evaluate(java.lang.String line)
Evaluate a command line. |
void |
evaluate(java.lang.String[] args)
Evaluate a list of arguments. |
abstract void |
exit(int status)
Exit the current Set |
java.util.Map<java.lang.String,Command> |
getCommands()
Get the available commands |
abstract java.lang.String |
interpolate(java.lang.String str)
Interpolates variables and special characters in a string |
abstract boolean |
isComment(java.lang.String line)
Test whether a line is a comment or not |
protected void |
register(Command command)
Register a command |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final java.io.InputStream in
public final java.io.PrintStream out
public final java.io.PrintStream err
| Constructor Detail |
|---|
public Shell()
public Shell(Command[] commands)
throws ShellException
commands - the initial set of commands available for this shell
ShellException - when a command fails to be registered| Method Detail |
|---|
public final java.util.Map<java.lang.String,Command> getCommands()
protected void register(Command command)
throws ShellException
command -
ShellException - if the command is already definedpublic abstract boolean isComment(java.lang.String line)
line - the string to be tested
public abstract java.lang.String interpolate(java.lang.String str)
str - the string to be interpolated
public abstract void exit(int status)
status - the optional result value
public void evaluate(java.lang.String[] args)
throws ShellException,
CommandException
args - the command line
ShellException - when the command was not found
CommandException - when an error occurs during the execution of the command
public final void evaluate(java.lang.String line)
throws ShellException,
CommandException
line - the line to be evaluated
ShellException - when the command was not found
CommandException - when an error occurs during the execution of the commandisComment(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||