edu.wisc.ssec.mcidasv.jython
Class Command

java.lang.Object
  extended by edu.wisc.ssec.mcidasv.jython.Command
Direct Known Subclasses:
BatchCommand, EjectCommand, InjectCommand, LineCommand, LoadFileCommand, RegisterCallbackCommand

public abstract class Command
extends Object

A Command is an action that can alter the state of an Interpreter.


Field Summary
protected  Console console
          Console that created this command.
 
Constructor Summary
Command(Console console)
          Creates a command.
 
Method Summary
abstract  void execute(Interpreter interpreter)
          Hook to provide various implementations of command execution.
protected  InputStream getInputStream(String path)
          Creates a InputStream using path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

console

protected Console console
Console that created this command.

Constructor Detail

Command

public Command(Console console)
Creates a command.

Parameters:
console - Console that created this command.
Method Detail

execute

public abstract void execute(Interpreter interpreter)
                      throws Exception
Hook to provide various implementations of command execution.

Parameters:
interpreter - Jython interpreter that will execute the command.
Throws:
Exception - An error was encountered executing the command. Jython will catch three standard Python exceptions: SyntaxError, ValueError, and OverflowError. Other exceptions are thrown.

getInputStream

protected InputStream getInputStream(String path)
                              throws Exception
Creates a InputStream using path. It's here entirely for convenience.

Parameters:
path - Path to the desired file.
Returns:
{code InputStream} for path.
Throws:
Exception - if there was badness.