
public abstract class CCS extends Object
ScriptingSubsystemWrapper, register a
ScriptingStatusBusListener to listen to Status
messages on the CCS Status Bus and to suspend the script execution until a
given Status message meets the criteria of a filter:
ScriptingStatusBusMessageFilter.| Modifier and Type | Method and Description |
|---|---|
static void |
addStatusBusListener(ScriptingStatusBusListener listener)
Add a Status bus listener.
|
static void |
addStatusBusListener(ScriptingStatusBusListener listener,
ScriptingStatusBusMessageFilter filter)
Add a Status bus listener with a filter.
|
static ScriptingSubsystemWrapper |
attachSubsystem(String target)
Creates and instance of a ScriptingSubsystemWrapper by making sure that
the given
target corresponds to a CCS subsystem that is currently
available, not locked and alive. |
static ScriptingSubsystemWrapper |
attachSubsystem(String target,
boolean lock)
Creates and instance of a ScriptingSubsystemWrapper by making sure that
the given
target corresponds to a CCS subsystem that is currently
alive. |
static ScriptingSubsystemWrapper |
attachSubsystem(String target,
int level)
Creates and instance of a ScriptingSubsystemWrapper by making sure that
the given
target corresponds to a CCS subsystem that is currently
available, not locked and alive. |
static void |
cleanUp()
Clean up the ThreadLocal stack, (close all subsystems and remove all
listeners).
|
static int |
getDefaultTimeout()
Get the default timeout to be used when sending commands.
|
static AgentMessagingLayer |
getMessagingAccess() |
protected static List<String> |
getTargetsForSubsystem(String subsystemName) |
static boolean |
getThrowExceptions()
Returns true if exceptions are thrown, otherwise they are returned as the
Object on the invoke methods.
|
static void |
initializeScriptingEnvironment()
In a test context, this method has to be called in the first place
|
static void |
removeStatusBusListener(ScriptingStatusBusListener listener)
Removes the Status bus listener.
|
static void |
setDefaultTimeout(int timeout)
Set the default timeout to be used when sending commands.
|
static void |
setShareLocksAcrossThreads(boolean shareLocks)
Indicates whether locks should be shared across threads or made
exclusive to the calling thread.
|
static void |
setThrowExceptions(boolean throwExceptions)
In the scripting environment, exceptions resulted from method invocation
can either be thrown or returned.
|
static void |
shutdownScriptingEnvironment()
In a test context, this method has to be called in the first place
|
static Future<ScriptingStatusBusMessage> |
startListeningForStatusBusMessage(ScriptingStatusBusMessageFilter filter,
int timeout)
Get a Future on a ScriptingStatusBusMessage.
|
public static AgentMessagingLayer getMessagingAccess()
public static void setDefaultTimeout(int timeout)
timeout - The default timeout in seconds.public static int getDefaultTimeout()
public static void setShareLocksAcrossThreads(boolean shareLocks)
shareLocks - public static void initializeScriptingEnvironment()
public static void shutdownScriptingEnvironment()
throws Exception
Exceptionpublic static void setThrowExceptions(boolean throwExceptions)
throwExceptions - boolean flag. If true exceptions will be thrown.public static boolean getThrowExceptions()
public static ScriptingSubsystemWrapper attachSubsystem(String target) throws RuntimeException
target corresponds to a CCS subsystem that is currently
available, not locked and alive. That method will attempt to acquire a
lock on the subsystem. Note : it is equivalent to
attachSubsystem(target, true)target - The name of the CCS subsystem. e.g. ccs-rafts, or one of
its inner component, e.g. ccs-rafts/REB1RuntimeException - if no subsystem corresponding to target
can be found on the buses, or if the subsystem could not be locked.public static ScriptingSubsystemWrapper attachSubsystem(String target, int level) throws Exception
target corresponds to a CCS subsystem that is currently
available, not locked and alive. That method will attempt to acquire a
lock on the subsystem, and to override the obtained lock's level with the
given level.target - The name of the CCS subsystem. e.g. ccs-rafts, or one of
its inner component, e.g. ccs-rafts/REB1level - a level that overrides the acquired lock level.Exception - if no subsystem corresponding to target can be
found on the buses, or if the subsystem could not be locked.public static ScriptingSubsystemWrapper attachSubsystem(String target, boolean lock) throws Exception
target corresponds to a CCS subsystem that is currently
alive. That method will attempt to acquire a lock only if lock is
set to true.target - The name of the CCS subsystem. e.g. ccs-rafts, or one of
its inner component, e.g. ccs-rafts/REB1lock - true if the subsystem should be locked, false otherwise.Exception - if no subsystem corresponding to target can be
found on the buses, or if the subsystem could not be locked.public static void cleanUp()
public static void addStatusBusListener(ScriptingStatusBusListener listener)
listener - The ScriptingStatusListenerpublic static void addStatusBusListener(ScriptingStatusBusListener listener, ScriptingStatusBusMessageFilter filter)
listener - The ScriptingStatusListenerfilter - The ScriptingStatusBusMessageFilterpublic static void removeStatusBusListener(ScriptingStatusBusListener listener)
listener - The listener to be removed.public static Future<ScriptingStatusBusMessage> startListeningForStatusBusMessage(ScriptingStatusBusMessageFilter filter, int timeout)
filter - ScriptingStatusBusMessageFilter The message filtertimeout - Timeout in seconds, after which a
ScriptiongTimeoutException is thrown. This timeout is from the time the
method is invoked. If this timeout is reached an exception will be thrown
if/when the Future is exercised.Copyright © 2018 LSST. All rights reserved.