<h2>org.autoplot.JythonUtil</h2><p>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.</p> <h2>JythonUtil( )</h2> <p></p> <hr> <a name="createInterpreter-boolean-boolean"></a> <h2>createInterpreter</h2> createInterpreter( boolean appContext, boolean sandbox ) → InteractiveInterpreter <p>create an interpreter object configured for Autoplot contexts: <ul> <li> QDataSets are wrapped so that operators are overloaded. <li> a standard set of names are imported. </ul></p> <h3>Parameters</h3> appContext - load in additional symbols that make sense in application context. <br> sandbox - limit symbols to safe symbols for server. <h3>Returns:</h3> PythonInterpreter ready for commands. <br><br> <a href="https://github.com/autoplot/dev/search?q=createInterpreter&unscoped_q=createInterpreter">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#createInterpreter-boolean-boolean">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l89">[view source]</a> <br> <br> <hr> <a name="createInterpreter-boolean-boolean-org.autoplot.dom.Application-org.das2.util.monitor.ProgressMonitor"></a> <h2>createInterpreter</h2> createInterpreter( boolean appContext, boolean sandbox, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon ) → InteractiveInterpreter <p>create a Jython interpreter, with the dom and monitor available to the code.</p> <h3>Parameters</h3> appContext - run this in the application context, with access to the dom. (TODO: this is probably always equivalent to dom!=null) <br> sandbox - limit symbols to safe symbols for server. <br> dom - the application state, if available. <br> mon - a monitor, if available. If it is not a monitor is created. <h3>Returns:</h3> the interpreter. <br><br> <a href="https://github.com/autoplot/dev/search?q=createInterpreter&unscoped_q=createInterpreter">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#createInterpreter-boolean-boolean-org.autoplot.dom.Application-org.das2.util.monitor.ProgressMonitor">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l120">[view source]</a> <br> <br> <hr> <a name="invokeScript20181217-java.net.URI-java.io.File-org.autoplot.dom.Application-java.util.Map-org.das2.util.monitor.ProgressMonitor"></a> <h2>invokeScript20181217</h2> invokeScript20181217( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> file, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> fparams, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon ) → void <p>Invoke the script on the current thread.</p> <h3>Parameters</h3> uri - the URI, providing pwd. <br> file - null or the file to use. <br> dom - the application <br> fparams - parameters to pass into the script. <br> mon - feedback monitor for the thread. <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScript20181217&unscoped_q=invokeScript20181217">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#invokeScript20181217-java.net.URI-java.io.File-org.autoplot.dom.Application-java.util.Map-org.das2.util.monitor.ProgressMonitor">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l804">[view source]</a> <br> <br> <hr> <a name="invokeScriptNow-java.util.Map-java.io.File"></a> <h2>invokeScriptNow</h2> invokeScriptNow( <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> environ, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> file ) → void <p>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.</p> <h3>Parameters</h3> environ - a java.util.Map <br> file - a File <h3>Returns:</h3> void (returns nothing) <h3>See Also:</h3> <a href='#runScript'>runScript(org.autoplot.ApplicationModel, java.lang.String, java.lang.String[], java.lang.String)</a> which doesn't allow for control of the environ (and arbitrary parameters).<br> <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScriptNow&unscoped_q=invokeScriptNow">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#invokeScriptNow-java.util.Map-java.io.File">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l619">[view source]</a> <br> <br> <hr> <a name="invokeScriptSoon-java.net.URL"></a> <h2><del>invokeScriptSoon</del></h2> Deprecated: use invokeScriptSoon with URI. <hr> <a name="invokeScriptSoon-java.net.URI"></a> <h2>invokeScriptSoon</h2> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri ) → void <p>invoke the Jython script on another thread.</p> <h3>Parameters</h3> uri - the address of the script. <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScriptSoon&unscoped_q=invokeScriptSoon">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#invokeScriptSoon-java.net.URI">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l232">[view source]</a> <br> <br> <hr> <a name="invokeScriptSoon-java.net.URL-org.autoplot.dom.Application-org.das2.util.monitor.ProgressMonitor"></a> <h2><del>invokeScriptSoon</del></h2> Deprecated: use invokeScriptSoon with URI. <hr> <a name="invokeScriptSoon-java.net.URI-org.autoplot.dom.Application-org.das2.util.monitor.ProgressMonitor"></a> <h2>invokeScriptSoon</h2> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon ) → void <p>invoke the Jython script on another thread.</p> <h3>Parameters</h3> uri - the address of the script, possibly having parameters. <br> dom - if null, then null is passed into the script and the script must not use dom. <br> mon - monitor to detect when script is finished. If null, then a NullProgressMonitor is created. <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScriptSoon&unscoped_q=invokeScriptSoon">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#invokeScriptSoon-java.net.URI-org.autoplot.dom.Application-org.das2.util.monitor.ProgressMonitor">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l256">[view source]</a> <br> <br> <hr> <a name="invokeScriptSoon-java.net.URL-org.autoplot.dom.Application-java.util.Map-boolean-boolean-org.das2.util.monitor.ProgressMonitor"></a> <h2><del>invokeScriptSoon</del></h2> Deprecated: use invokeScriptSoon with URI. <hr> <a name="invokeScriptSoon-java.net.URI-org.autoplot.dom.Application-java.util.Map-boolean-boolean-org.das2.util.monitor.ProgressMonitor"></a> <h2>invokeScriptSoon</h2> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> vars, boolean askParams, boolean makeTool, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon1 ) → int <p>invoke the Jython script on another thread. Script parameters can be passed in, and the scientist can be provided a dialog to set the parameters. Note this will return before the script is actually executed, and monitor should be used to detect that the script is finished.</p> <h3>Parameters</h3> uri - the address of the script. <br> dom - if null, then null is passed into the script and the script must not use dom. <br> vars - values for parameters, or null. <br> askParams - if true, query the scientist for parameter settings. <br> makeTool - if true, offer to put the script into the tools area for use later (only if askParams). <br> mon1 - monitor to detect when script is finished. If null, then a NullProgressMonitor is created. <h3>Returns:</h3> JOptionPane.OK_OPTION of the script is invoked. <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScriptSoon&unscoped_q=invokeScriptSoon">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#invokeScriptSoon-java.net.URI-org.autoplot.dom.Application-java.util.Map-boolean-boolean-org.das2.util.monitor.ProgressMonitor">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l506">[view source]</a> <br> <br> <hr> <a name="invokeScriptSoon-java.net.URI-org.autoplot.dom.Application-java.util.Map-boolean-boolean-org.autoplot.JythonRunListener-org.das2.util.monitor.ProgressMonitor"></a> <h2>invokeScriptSoon</h2> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> params, boolean askParams, boolean makeTool, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/JythonRunListener.html'>org.autoplot.JythonRunListener</a> runListener, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon1 ) → int <p>invoke the Jython script on another thread. Script parameters can be passed in, and the scientist can be provided a dialog to set the parameters. Note this will return before the script is actually executed, and monitor should be used to detect that the script is finished.</p> <h3>Parameters</h3> uri - the resource URI of the script (without parameters). <br> dom - if null, then null is passed into the script and the script must not use dom. <br> params - values for parameters, or null. <br> askParams - if true, query the scientist for parameter settings. <br> makeTool - if true, offer to put the script into the tools area for use later (only if askParams). <br> runListener - null or place to mark error messages and to mark as running a script. <br> mon1 - monitor to detect when script is finished. If null, then a NullProgressMonitor is created. <h3>Returns:</h3> JOptionPane.OK_OPTION of the script is invoked. <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScriptSoon&unscoped_q=invokeScriptSoon">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#invokeScriptSoon-java.net.URI-org.autoplot.dom.Application-java.util.Map-boolean-boolean-org.autoplot.JythonRunListener-org.das2.util.monitor.ProgressMonitor">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l560">[view source]</a> <br> <br> <hr> <a name="invokeScriptSoon-java.net.URI-java.io.File-org.autoplot.dom.Application-java.util.Map-boolean-boolean-org.autoplot.JythonRunListener-org.das2.util.monitor.ProgressMonitor"></a> <h2>invokeScriptSoon</h2> invokeScriptSoon( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> uri, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> file, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> params, boolean askParams, boolean makeTool, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/JythonRunListener.html'>org.autoplot.JythonRunListener</a> jythonRunListener, <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/das2/util/monitor/ProgressMonitor.html'>ProgressMonitor</a> mon1 ) → int <p>invoke the Jython script on another thread. Script parameters can be passed in, and the scientist can be provided a dialog to set the parameters. Note this will return before the script is actually executed, and monitor should be used to detect that the script is finished. This should be called from the event thread!</p> <h3>Parameters</h3> uri - the resource URI of the script (without parameters). <br> file - the file which has been downloaded. <br> dom - if null, then null is passed into the script and the script must not use dom. <br> params - values for parameters, or null. <br> askParams - if true, query the scientist for parameter settings. <br> makeTool - if true, offer to put the script into the tools area for use later (only if askParams). <br> jythonRunListener - null or place to mark error messages and to mark as running a script. <br> mon1 - monitor to detect when script is finished. If null, then a NullProgressMonitor is created. <h3>Returns:</h3> JOptionPane.OK_OPTION of the script is invoked. <br><br> <a href="https://github.com/autoplot/dev/search?q=invokeScriptSoon&unscoped_q=invokeScriptSoon">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#invokeScriptSoon-java.net.URI-java.io.File-org.autoplot.dom.Application-java.util.Map-boolean-boolean-org.autoplot.JythonRunListener-org.das2.util.monitor.ProgressMonitor">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l676">[view source]</a> <br> <br> <hr> <a name="runScript-org.autoplot.dom.Application-java.io.InputStream-java.lang.String-java.lang.String[]-java.lang.String"></a> <h2>runScript</h2> runScript( <a href='https://cottagesystems.com/~jbf/autoplot/doc/org/autoplot/dom/Application.html'>org.autoplot.dom.Application</a> dom, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html'>java.io.InputStream</a> in, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> name, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String[]</a> argv, <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> pwd ) → void <p>Run the script in the input stream.</p> <h3>Parameters</h3> dom - provides the dom to the environment. <br> in - stream containing script. This will be left open. <br> name - the name of the file for human reference, or null. <br> argv - parameters passed into the script, each should be name=value, or positional. The name of the script should not be the zeroth element. <br> pwd - the present working directory, if available. Note this is a String because pwd can be a remote folder. <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=runScript&unscoped_q=runScript">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#runScript-org.autoplot.dom.Application-java.io.InputStream-java.lang.String-java.lang.String[]-java.lang.String">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l166">[view source]</a> <br> <br> <hr> <a name="showScriptDialog-java.awt.Component-java.util.Map-java.io.File-java.util.Map-boolean-java.net.URI"></a> <h2>showScriptDialog</h2> showScriptDialog( <a href='https://docs.oracle.com/javase/8/docs/api/java/awt/Component.html'>java.awt.Component</a> parent, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> env, <a href='https://docs.oracle.com/javase/8/docs/api/java/io/File.html'>java.io.File</a> file, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> fparams, boolean makeTool, <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URI.html'>java.net.URI</a> resourceUri ) → int <p>show the script and the variables (like we have always done with jyds scripts), and offer to run the script.</p> <h3>Parameters</h3> parent - parent GUI to follow <br> env - a java.util.Map <br> file - file containing the script. <br> fparams - parameters for the script. <br> makeTool - the dialog is always shown and the scientist can have the script installed as a tool. <br> resourceUri - when the scientist decides to make a tool, we need the source location. <h3>Returns:</h3> JOptionPane.OK_OPTION or JOptionPane.CANCEL_OPTION if the scientist cancels. <br><br> <a href="https://github.com/autoplot/dev/search?q=showScriptDialog&unscoped_q=showScriptDialog">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/autoplot/JythonUtil.md">[view on GitHub]</a> <a href="https://cottagesystems.com/~jbf/autoplot/doc2018/org/autoplot/JythonUtil.html#showScriptDialog-java.awt.Component-java.util.Map-java.io.File-java.util.Map-boolean-java.net.URI">[view on old javadoc]</a> <a href="https://sourceforge.net/p/autoplot/code/HEAD/tree/autoplot/trunk/Autoplot/src/org/autoplot/JythonUtil.java#l348">[view source]</a> <br> <br>