org.autoplot.JythonUtil

Utilities for Jython functions, such as a standard way to initialize an interpreter and invoke a script asynchronously. TODO: this needs review, since the autoplot.py was added to the imports.

JythonUtil( )


createInterpreter

createInterpreter( boolean appContext, boolean sandbox ) → InteractiveInterpreter

create an interpreter object configured for Autoplot contexts:

Parameters

appContext - load in additional symbols that make sense in application context.
sandbox - limit symbols to safe symbols for server.

Returns:

PythonInterpreter ready for commands.

[search for examples] [view on GitHub] [view on old javadoc] [view source]

createInterpreter( boolean appContext, boolean sandbox, org.autoplot.dom.Application dom, ProgressMonitor mon ) → InteractiveInterpreter

invokeScript20181217

invokeScript20181217( java.net.URI uri, java.io.File file, org.autoplot.dom.Application dom, java.util.Map fparams, ProgressMonitor mon ) → void

Invoke the script on the current thread.

Parameters

uri - the URI, providing pwd.
file - null or the file to use.
dom - the application
fparams - parameters to pass into the script.
mon - feedback monitor for the thread.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


invokeScriptNow

invokeScriptNow( java.util.Map environ, java.io.File file ) → void

Do a search for the number of places where JythonUtil.createInterpreter is called and it should be clear that there's a need for one code that does this. There probably is one such code, but I can't find it right now.

Parameters

environ - a java.util.Map
file - a File

Returns:

void (returns nothing)

See Also:

runScript(org.autoplot.ApplicationModel, java.lang.String, java.lang.String[], java.lang.String) which doesn't allow for control of the environ (and arbitrary parameters).


[search for examples] [view on GitHub] [view on old javadoc] [view source]


invokeScriptSoon

Deprecated: use invokeScriptSoon with URI. invokeScriptSoon( java.net.URI uri ) → void
invokeScriptSoon( java.net.URL url, org.autoplot.dom.Application dom, ProgressMonitor mon ) → void
invokeScriptSoon( java.net.URI uri, org.autoplot.dom.Application dom, ProgressMonitor mon ) → void
invokeScriptSoon( java.net.URL url, org.autoplot.dom.Application dom, java.util.Map params, boolean askParams, boolean makeTool, ProgressMonitor mon1 ) → int
invokeScriptSoon( java.net.URI uri, org.autoplot.dom.Application dom, java.util.Map vars, boolean askParams, boolean makeTool, ProgressMonitor mon1 ) → int
invokeScriptSoon( java.net.URI uri, org.autoplot.dom.Application dom, java.util.Map params, boolean askParams, boolean makeTool, org.autoplot.JythonRunListener runListener, ProgressMonitor mon1 ) → int
invokeScriptSoon( java.net.URI uri, java.io.File file, org.autoplot.dom.Application dom, java.util.Map params, boolean askParams, boolean makeTool, org.autoplot.JythonRunListener jythonRunListener, ProgressMonitor mon1 ) → int

runScript

runScript( org.autoplot.dom.Application dom, java.io.InputStream in, String name, java.lang.String[] argv, String pwd ) → void

Run the script in the input stream.

Parameters

dom - provides the dom to the environment.
in - stream containing script. This will be left open.
name - the name of the file for human reference, or null.
argv - parameters passed into the script, each should be name=value, or positional. The name of the script should not be the zeroth element.
pwd - the present working directory, if available. Note this is a String because pwd can be a remote folder.

Returns:

void (returns nothing)

[search for examples] [view on GitHub] [view on old javadoc] [view source]


showScriptDialog

showScriptDialog( java.awt.Component parent, java.util.Map env, java.io.File file, java.util.Map fparams, boolean makeTool, java.net.URI resourceUri ) → int

show the script and the variables (like we have always done with jyds scripts), and offer to run the script.

Parameters

parent - parent GUI to follow
env - a java.util.Map
file - file containing the script.
fparams - parameters for the script.
makeTool - the dialog is always shown and the scientist can have the script installed as a tool.
resourceUri - when the scientist decides to make a tool, we need the source location.

Returns:

JOptionPane.OK_OPTION or JOptionPane.CANCEL_OPTION if the scientist cancels.

[search for examples] [view on GitHub] [view on old javadoc] [view source]