|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wisc.ssec.mcidasv.jython.Command
edu.wisc.ssec.mcidasv.jython.LoadFileCommand
class LoadFileCommand
This class is a type of Command
that represents a request to use
Jython to run a file containing Jython statements. This is conceptually a
bit similar to importing a module, but the loading is done behind the scenes
and you may specify whatever namespace you like (be careful!).
Field Summary | |
---|---|
private String |
name
Namespace to use when executing path . |
private String |
path
Path to the Jython file awaiting execution. |
Fields inherited from class edu.wisc.ssec.mcidasv.jython.Command |
---|
console |
Constructor Summary | |
---|---|
LoadFileCommand(Console console,
String name,
String path)
Creates a command that will attempt to execute a Jython file in the namespace given by name . |
Method Summary | |
---|---|
void |
execute(Interpreter interpreter)
Tries to load the file specified by path using moduleName
for the __name__ attribute. |
String |
toString()
|
Methods inherited from class edu.wisc.ssec.mcidasv.jython.Command |
---|
getInputStream |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private String name
path
.
private String path
Constructor Detail |
---|
public LoadFileCommand(Console console, String name, String path)
name
.
console
- Originating console.name
- Namespace to use when executing path
.path
- Path to a Jython file.Method Detail |
---|
public void execute(Interpreter interpreter) throws Exception
path
using moduleName
for the __name__
attribute. Note that this command does not
currently display any results in the originating Console
.
If moduleName
is not __main__
, this command is
basically the same thing as doing from moduleName import *
.
If moduleName
is __main__
, then this command
will work for if __name__ == '__main__'
and will run main
functions as expected.
execute
in class Command
interpreter
- Interpreter to use to load the specified file.
Exception
- if Jython has a problem with running path
.public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |