Interface Scriptcontroller
- All Superinterfaces:
Configurable,Findable,gda.observable.IObservable
- All Known Subinterfaces:
ILoggingScriptController
- All Known Implementing Classes:
LoggingScriptController,ScriptControllerBase
To run the script, the GUI should run the command returned by the getCommand method using the JythonServerFacade object. The GUI should be set to IObserve this Scriptcontroller, which will then pass messages from the script to its observers via CORBA messaging.
It is recommended that the script sends progress messages back to this object's IObserver in the form of gda.jython.scriptcontroller.event classes.
If parameters need to be given to the script, a serializable object should be created of the type the script is expecting and placed into the Jython namespace under the name return by this objects getParametersName method. The object is placed into the Jython namespace using the JythonServerFacade object.
The import command is the command to run when this object is configured so that the script that this object controls is loaded into the Jython namespace
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(Object parameter) Add a parameter that will be used to format the script command to run.Returns the command that would be run by the runScript command.Returns the command which should be run to load the script into the Jython namespace.Returns the name of the object which is used to pass parameters to the script.voidnotifyIObservers(Object source, Object event) Notify all observers on the list of the requested changevoidsetCommand(String scriptName) Sets the command which would be run by the runScript command.voidsetImportCommand(String command) Sets the import command.voidsetParametersName(String parametersName) Sets the name of the object in the Jython namepsace which the script and this object uses as a mechanism to pass parameters to the script.voidUpdates observers by distributing arg to them.Methods inherited from interface gda.factory.Configurable
configure, isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObservers
-
Field Details
-
SCRIPT_RUNNER_START_MARKER
- See Also:
-
SCRIPT_RUNNER_RUNNING_MARKER
- See Also:
-
SCRIPT_RUNNER_END_MARKER
- See Also:
-
SCRIPT_RUNNER_ERROR_MARKER
- See Also:
-
-
Method Details
-
getCommand
String getCommand()Returns the command that would be run by the runScript command. This should be a function in a Jython file placed in one of the directories defined by the command server's script_paths bean.- Returns:
- a Jython command which starts the script this object represents
-
setCommand
Sets the command which would be run by the runScript command.- Parameters:
scriptName-
-
getParametersName
String getParametersName()Returns the name of the object which is used to pass parameters to the script.- Returns:
- the name of an object in the Jython namespace
-
setParametersName
Sets the name of the object in the Jython namepsace which the script and this object uses as a mechanism to pass parameters to the script.This object must be serializable.
- Parameters:
parametersName-
-
addParameter
Add a parameter that will be used to format the script command to run. Subsequent calls will extend the list of parameters. Use reconfigure() method to erase parameters.- Parameters:
parameter-
-
getImportCommand
String getImportCommand()Returns the command which should be run to load the script into the Jython namespace.- Returns:
- the command to load the script
-
setImportCommand
Sets the import command.- Parameters:
command-
-
notifyIObservers
Notify all observers on the list of the requested change- Parameters:
source- the observed componentevent- the data to be sent to the observer.
-
update
Updates observers by distributing arg to them.- Parameters:
o- the observed componentarg- the data to be sent to the observer.
-