Package gda.jython.scriptcontroller
Class ScriptControllerBase
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.jython.scriptcontroller.ScriptControllerBase
- All Implemented Interfaces:
Configurable,Findable,Scriptcontroller,gda.observable.IObservable
- Direct Known Subclasses:
LoggingScriptController
@ServiceInterface(Scriptcontroller.class)
public class ScriptControllerBase
extends FindableConfigurableBase
implements Scriptcontroller
Concrete implementation of Scriptcontroller. The attributes defined through the script controller interface are such
that this class should not need to be sub-classed.
-
Field Summary
Fields inherited from interface gda.jython.scriptcontroller.Scriptcontroller
SCRIPT_RUNNER_END_MARKER, SCRIPT_RUNNER_ERROR_MARKER, SCRIPT_RUNNER_RUNNING_MARKER, SCRIPT_RUNNER_START_MARKER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIObserver(gda.observable.IObserver observer) voidaddParameter(Object param) Add a parameter that will be used to format the script command to run.voidDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.voiddeleteIObserver(gda.observable.IObserver observer) voidReturns 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 changereadParameters(String key) Derive a parameter list from a given key Defines three ways to specify parameters: 1.voidRe-initialisation of values and states.voidrun()voidsetCommand(String scriptName) Sets the command which would be run by the runScript command.voidsetCommandFormat(String format) 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 class gda.factory.FindableConfigurableBase
getName, setNameMethods inherited from class gda.factory.ConfigurableBase
isConfigureAtStartup, isConfigured, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gda.factory.Configurable
isConfigureAtStartup, isConfigured
-
Constructor Details
-
ScriptControllerBase
public ScriptControllerBase()
-
-
Method Details
-
configure
Description copied from class:ConfigurableBaseDefault implementation for classes that do not have to do any specific configuration.
Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.- Specified by:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
reconfigure
Description copied from interface:ConfigurableRe-initialisation of values and states.Moved from Reconfigurable which has been deleted
- Specified by:
reconfigurein interfaceConfigurable- Overrides:
reconfigurein classConfigurableBase- Throws:
FactoryException
-
getCommand
Description copied from interface:ScriptcontrollerReturns 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.- Specified by:
getCommandin interfaceScriptcontroller- Returns:
- a Jython command which starts the script this object represents
-
setCommand
Description copied from interface:ScriptcontrollerSets the command which would be run by the runScript command.- Specified by:
setCommandin interfaceScriptcontroller- Parameters:
scriptName-
-
getParametersName
Description copied from interface:ScriptcontrollerReturns the name of the object which is used to pass parameters to the script.- Specified by:
getParametersNamein interfaceScriptcontroller- Returns:
- the name of an object in the Jython namespace
-
setParametersName
Description copied from interface:ScriptcontrollerSets 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.
- Specified by:
setParametersNamein interfaceScriptcontroller- Parameters:
parametersName-
-
update
Description copied from interface:ScriptcontrollerUpdates observers by distributing arg to them.- Specified by:
updatein interfaceScriptcontroller- Parameters:
o- the observed componentarg- the data to be sent to the observer.
-
getImportCommand
Description copied from interface:ScriptcontrollerReturns the command which should be run to load the script into the Jython namespace.- Specified by:
getImportCommandin interfaceScriptcontroller- Returns:
- the command to load the script
-
setImportCommand
Description copied from interface:ScriptcontrollerSets the import command.- Specified by:
setImportCommandin interfaceScriptcontroller- Parameters:
command-
-
addIObserver
public void addIObserver(gda.observable.IObserver observer) - Specified by:
addIObserverin interfacegda.observable.IObservable
-
deleteIObserver
public void deleteIObserver(gda.observable.IObserver observer) - Specified by:
deleteIObserverin interfacegda.observable.IObservable
-
deleteIObservers
public void deleteIObservers()- Specified by:
deleteIObserversin interfacegda.observable.IObservable
-
notifyIObservers
Description copied from interface:ScriptcontrollerNotify all observers on the list of the requested change- Specified by:
notifyIObserversin interfaceScriptcontroller- Parameters:
source- the observed componentevent- the data to be sent to the observer.
-
getCommandFormat
-
setCommandFormat
-
addParameter
Description copied from interface:ScriptcontrollerAdd 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.- Specified by:
addParameterin interfaceScriptcontroller- Parameters:
param-
-
readParameters
Derive a parameter list from a given key Defines three ways to specify parameters: 1. If the key does not locate a findable object, the key string is the parameter for the command 2. If the key-findable object is a list, treat as list of parameters for the command 3. If the key-findable object is not a list, the object is a parameter usable by the scripted command- Parameters:
key-- Returns:
- parameters as a list of Objects
-
run
public void run()
-