Class GeneralCommands

java.lang.Object
gda.jython.commands.GeneralCommands

public final class GeneralCommands extends Object
Holder for a series of static methods to operate Scannable objects
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    add_jython_observer(gda.observable.IObserver observer, gda.observable.IObservable observable)
    Jython utility method for adding objects as observers within a Jython namespace lifetime
    static void
     
    static void
    alias(String commandName)
    Add a new aliased command.
    static void
    alias(org.python.core.PyObject callable)
    Add a new aliased command.
    static void
    cmd(String command)
    runs system command which input as string
    static void
    Print the default help message
    static void
    ls()
    List all the types of objects (interfaces) in use on this beamline
    static void
    ls(Scannable theScannable)
    To allow the list function to be used all the way to the bottom of the object tree.
    static <F extends Findable>
    void
    ls(Class<F> theInterface)
    List all the instances of a particular type (interface) of object
    static void
    ls(String interfaceName)
    Lists all the available types of objects or objects of a given type
    static void
    List the names of all Scannables whose name does not startwith __
    static <F extends Findable>
    void
    ls_names(Class<F> theInterface)
    List all the instances of a particular type (interface) of object which are also Findable
    static void
    Pauses while the flag in ScriptBase has been set to pause any scripts.
    static void
     
    static void
    remove_alias(org.python.core.PyObject callable)
     
    static void
    Restarts the Jython server without a need for a GDA restart.
    static void
    run(String scriptName)
    Runs a script of the given name.
    static void
    vararg_alias(String commandName)
    Add a new vararg aliased command
    static void
    vararg_alias(org.python.core.PyObject callable)
    Add a new vararg aliased command
    static void
    whois(int id)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • gdahelp

      public static void gdahelp()
      Print the default help message
    • ls

      public static void ls()
      List all the types of objects (interfaces) in use on this beamline
    • ls

      public static void ls(String interfaceName)
      Lists all the available types of objects or objects of a given type
      Parameters:
      interfaceName -
    • ls

      public static <F extends Findable> void ls(Class<F> theInterface)
      List all the instances of a particular type (interface) of object
      Parameters:
      theInterface -
    • ls_names

      public static void ls_names()
      List the names of all Scannables whose name does not startwith __
    • ls_names

      public static <F extends Findable> void ls_names(Class<F> theInterface)
      List all the instances of a particular type (interface) of object which are also Findable
      Parameters:
      theInterface -
    • ls

      public static void ls(Scannable theScannable)
      To allow the list function to be used all the way to the bottom of the object tree.
      Parameters:
      theScannable -
    • pause

      public static void pause() throws InterruptedException
      Pauses while the flag in ScriptBase has been set to pause any scripts. This will return when the flag has been unset.

      If the interrupt flag has been set then an exception will be thrown. This will still be thrown if this method is in the middle of waiting to resume.

      Throws:
      InterruptedException
    • run

      public static void run(String scriptName) throws Exception
      Runs a script of the given name. It is assumed that the script is at the top-level of the user script directory or the beamline script directory.

      This method is for typing convenience. Most scripts should really be imported and their method called directly.

      Parameters:
      scriptName -
      Throws:
      Exception
    • add_reset_hook

      public static void add_reset_hook(Runnable hook)
    • add_jython_observer

      public static void add_jython_observer(gda.observable.IObserver observer, gda.observable.IObservable observable)
      Jython utility method for adding objects as observers within a Jython namespace lifetime

      If a Jython object is added as an observer of a Java object on the server, the reference lives through the interpreter being recreated (via reset_namespace()). This often means the observer cannot be removed as there are no references accessible from the Jython shell and IObservable.deleteIObservers() has the risk of removing other observers that are still required.

      This adds the observer and also adds a reset hook so that the observer is removed when the namespace is reset.

      Parameters:
      observer - The Jython object to add as an observer
      observable - The object to observe
    • reset_namespace

      public static void reset_namespace()
      Restarts the Jython server without a need for a GDA restart. The Jython namespace is completely reset and localStation re-run. However, connections to hardware are not re-established i.e. Object Servers are not reconfigured.
    • alias

      public static void alias(String commandName)
      Add a new aliased command.
      Parameters:
      commandName -
    • alias

      public static void alias(org.python.core.PyObject callable) throws DeviceException
      Add a new aliased command.
      Parameters:
      callable -
      Throws:
      DeviceException
    • vararg_alias

      public static void vararg_alias(String commandName)
      Add a new vararg aliased command
      Parameters:
      commandName -
    • vararg_alias

      public static void vararg_alias(org.python.core.PyObject callable) throws DeviceException
      Add a new vararg aliased command
      Parameters:
      callable -
      Throws:
      DeviceException
    • remove_alias

      public static void remove_alias(String command)
    • remove_alias

      public static void remove_alias(org.python.core.PyObject callable) throws DeviceException
      Throws:
      DeviceException
    • cmd

      public static void cmd(String command)
      runs system command which input as string
      Parameters:
      command -
    • whois

      public static void whois(int id)