Class 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.
  • Constructor Details

    • ScriptControllerBase

      public ScriptControllerBase()
  • Method Details

    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default 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:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • reconfigure

      public void reconfigure() throws FactoryException
      Description copied from interface: Configurable
      Re-initialisation of values and states.

      Moved from Reconfigurable which has been deleted

      Specified by:
      reconfigure in interface Configurable
      Overrides:
      reconfigure in class ConfigurableBase
      Throws:
      FactoryException
    • getCommand

      public String getCommand()
      Description copied from interface: Scriptcontroller
      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.
      Specified by:
      getCommand in interface Scriptcontroller
      Returns:
      a Jython command which starts the script this object represents
    • setCommand

      public void setCommand(String scriptName)
      Description copied from interface: Scriptcontroller
      Sets the command which would be run by the runScript command.
      Specified by:
      setCommand in interface Scriptcontroller
      Parameters:
      scriptName -
    • getParametersName

      public String getParametersName()
      Description copied from interface: Scriptcontroller
      Returns the name of the object which is used to pass parameters to the script.
      Specified by:
      getParametersName in interface Scriptcontroller
      Returns:
      the name of an object in the Jython namespace
    • setParametersName

      public void setParametersName(String parametersName)
      Description copied from interface: Scriptcontroller
      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.

      Specified by:
      setParametersName in interface Scriptcontroller
      Parameters:
      parametersName -
    • update

      public void update(Object o, Object arg)
      Description copied from interface: Scriptcontroller
      Updates observers by distributing arg to them.
      Specified by:
      update in interface Scriptcontroller
      Parameters:
      o - the observed component
      arg - the data to be sent to the observer.
    • getImportCommand

      public String getImportCommand()
      Description copied from interface: Scriptcontroller
      Returns the command which should be run to load the script into the Jython namespace.
      Specified by:
      getImportCommand in interface Scriptcontroller
      Returns:
      the command to load the script
    • setImportCommand

      public void setImportCommand(String command)
      Description copied from interface: Scriptcontroller
      Sets the import command.
      Specified by:
      setImportCommand in interface Scriptcontroller
      Parameters:
      command -
    • addIObserver

      public void addIObserver(gda.observable.IObserver observer)
      Specified by:
      addIObserver in interface gda.observable.IObservable
    • deleteIObserver

      public void deleteIObserver(gda.observable.IObserver observer)
      Specified by:
      deleteIObserver in interface gda.observable.IObservable
    • deleteIObservers

      public void deleteIObservers()
      Specified by:
      deleteIObservers in interface gda.observable.IObservable
    • notifyIObservers

      public void notifyIObservers(Object source, Object event)
      Description copied from interface: Scriptcontroller
      Notify all observers on the list of the requested change
      Specified by:
      notifyIObservers in interface Scriptcontroller
      Parameters:
      source - the observed component
      event - the data to be sent to the observer.
    • getCommandFormat

      public String getCommandFormat()
    • setCommandFormat

      public void setCommandFormat(String format)
    • addParameter

      public void addParameter(Object param)
      Description copied from interface: Scriptcontroller
      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.
      Specified by:
      addParameter in interface Scriptcontroller
      Parameters:
      param -
    • readParameters

      public List<Object> readParameters(String key)
      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()