Package gda.jython.commands
Class GeneralCommands
java.lang.Object
gda.jython.commands.GeneralCommands
Holder for a series of static methods to operate Scannable objects
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidadd_jython_observer(gda.observable.IObserver observer, gda.observable.IObservable observable) Jython utility method for adding objects as observers within a Jython namespace lifetimestatic voidadd_reset_hook(Runnable hook) static voidAdd a new aliased command.static voidalias(org.python.core.PyObject callable) Add a new aliased command.static voidruns system command which input as stringstatic voidgdahelp()Print the default help messagestatic voidls()List all the types of objects (interfaces) in use on this beamlinestatic voidTo allow the list function to be used all the way to the bottom of the object tree.static <F extends Findable>
voidList all the instances of a particular type (interface) of objectstatic voidLists all the available types of objects or objects of a given typestatic voidls_names()List the names of all Scannables whose name does not startwith __static <F extends Findable>
voidList all the instances of a particular type (interface) of object which are also Findablestatic voidpause()Pauses while the flag in ScriptBase has been set to pause any scripts.static voidremove_alias(String command) static voidremove_alias(org.python.core.PyObject callable) static voidRestarts the Jython server without a need for a GDA restart.static voidRuns a script of the given name.static voidvararg_alias(String commandName) Add a new vararg aliased commandstatic voidvararg_alias(org.python.core.PyObject callable) Add a new vararg aliased commandstatic voidwhois(int id)
-
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
Lists all the available types of objects or objects of a given type- Parameters:
interfaceName-
-
ls
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
List all the instances of a particular type (interface) of object which are also Findable- Parameters:
theInterface-
-
ls
To allow the list function to be used all the way to the bottom of the object tree.- Parameters:
theScannable-
-
pause
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
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
-
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 lifetimeIf 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 andIObservable.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 observerobservable- 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
Add a new aliased command.- Parameters:
commandName-
-
alias
Add a new aliased command.- Parameters:
callable-- Throws:
DeviceException
-
vararg_alias
Add a new vararg aliased command- Parameters:
commandName-
-
vararg_alias
Add a new vararg aliased command- Parameters:
callable-- Throws:
DeviceException
-
remove_alias
-
remove_alias
- Throws:
DeviceException
-
cmd
runs system command which input as string- Parameters:
command-
-
whois
public static void whois(int id)
-