
public class Subsystem extends Agent
This object will register itself on the three buses (control, status, log). It broadcasts its status, and can receive Commands.
Agent.RunningCommandAGENT_HEARTBEAT_TASK, AGENT_RUNTIMEINFO_TASK, commandExecutorLock, currentAction, currentQueries, currentSignals, innerStateLock, logBusHandler, OBJECT_SUBSYSTEM_MAP| Constructor and Description |
|---|
Subsystem(String name,
AgentInfo.AgentType type)
Constructs a Subsystem of a given type with no inner structure.
|
Subsystem(String name,
AgentInfo.AgentType type,
ComponentLookup lookup)
Constructs Subsystem with an internal structure that has been built by
externally and stored in a ComponentLookup object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Command to abort operation.
|
void |
checkAllHardwareStarted()
Called to check if all hardware has been correctly started.
|
void |
checkAllHardwareStopped()
Called to check if all hardware has been correctly started.
|
void |
checkHardware()
Called before activating anything and again once problems are supposed to
have been addressed.
|
void |
completeInitialization()
Command to complete initialization (if commands were issued to heal
hardware problems).
|
void |
completeInitialization(boolean checkHardwareOK)
Runs the last phase of the initialization, and transitions to OPERATIONAL
state.
|
protected void |
doShutdown()
Called upon subsystem shutdown.
|
void |
doStart()
Called upon subsystem start.
|
void |
forceShutdown()
Command to force subsystem shutdown.
|
Handler |
getLogHandler(String handlerName)
Get a LogHandler for a given name.
|
ComponentLookup |
getLookup()
Deprecated.
Use getComponentLookup instead
|
int |
getNumberCommandThreads()
Command that returns the number of currently running commands.
|
static Subsystem |
getSubsystemForObject(Object obj)
Get the Subsystem for a given object belonging to a ComponentLookup.
|
protected void |
internalShutdown()
Called by the framework on subsystem shutdown, before the Agent shutdown
sequence is executed.
|
protected boolean |
internalStart()
Called by the framework once the underlying
Agent functionality
is initialized. |
void |
ping()
Command to broadcast a message of presence on the status bus.
|
String |
printRunningCommands()
Command returning a String describing which commands are running.
|
void |
setLogFormat(String format)
Command to set a format for the TextFormatter of LogBusHandler (see
logging.properties doc).
|
void |
setLogHandlerLevel(String handlerName,
String level)
Command to set a level for a given handler
Internally we use
java.util.logging.Level#parse(String) to parse the Level corresponding to the provided String. |
void |
setLogLevel(String keyLogger,
String levelName)
Command to set the Level of a named Logger.
|
void |
setStackTraceDepth(int depth)
Will modify the depth of stackTrace printing for ALL handlers (including
the LogBusHandler)
|
void |
stop(long timeHint)
Command to stop operation.
|
void |
stopAndWait(long timeHint)
forwards a STOP signal to all components and then checks if all hardwares
have been stopped within timeHint
|
boolean |
switchToEngineeringMode()
Command to switch to ENGINEERING mode.
|
void |
switchToNormalMode()
Command to switch to NORMAL mode.
|
addClearAlertHandler, addCommandSet, addCommandsFromObject, addStateChangeListener, broadcastStatus, change, clearAlerts, clearAllAlerts, commitBulkChange, dropAllChanges, dropAllSubmittedChanges, dropChangesForCategories, dropSubmittedChangesForComponent, executeCommandRequest, findAvailableConfigurationsForCategory, getAgentInfo, getAgentPeriodicTaskService, getAgentPersistenceService, getAgentProperties, getAgentPropertiesKeySet, getAgentProperty, getAlertService, getAllSubmittedChanges, getCategories, getCCSVersions, getCommandCount, getCommandSet, getCommandTargets, getComponentConfigurationEnvironment, getComponentConfigurationEnvironmentByName, getComponentLookup, getComponentState, getConfigurationInfo, getCurrentAction, getCurrentValuesForComponent, getDescription, getDictionaries, getDistributionInfo, getEnvironmentMessagingAccess, getLogger, getMessagingAccess, getMonitor, getName, getRaisedAlertSummary, getScheduler, getState, getState, getStatusBroadcastPeriod, getSubmittedChangesForComponent, getSubsystemConfigurationEnvironment, getTag, isComponentInState, isInEngineeringMode, isInState, isInState, isParameterConfigurable, loadCategories, loadConfiguration, persistNow, populateComponentLookup, postStart, publishStateChange, publishSubsystemDataOnStatusBus, raiseAlert, removeStateChangeListener, saveAllChanges, saveChangesForCategories, saveChangesForCategoriesAs, sendAck, sendNack, setAgentProperty, shutdown, start, startAgent, startAgent, submitChange, updateAgentComponentState, updateAgentState, updateAgentState, updateHeartBeat, updateInternalState, waitForpublic Subsystem(String name, AgentInfo.AgentType type)
name - name of the subsystem : cannot be nulltype - Agent typepublic Subsystem(String name, AgentInfo.AgentType type, ComponentLookup lookup)
name - name of the subsystem : cannot be nulltype - Agent typelookup - The ComponentLookup object with the internal structure of
the Subsystem.protected final boolean internalStart()
Agent functionality
is initialized.internalStart in class Agenttrue if subsystem initialization was successful.protected final void internalShutdown()
throws Exception
internalShutdown in class AgentException - if shutdown failspublic void completeInitialization(boolean checkHardwareOK)
throws HardwareException
checkHardwareOK - false if engineering fault was entered due to
checkHardware errorsHardwareException - if some hardware is still not started@Deprecated public final ComponentLookup getLookup()
ComponentLookup object.public void checkHardware()
throws HardwareException
HardwareException - "compound" exceptionpublic void checkAllHardwareStarted()
throws HardwareException
HardwareException - a compound exception that list the exceptions
fired by hardwares that are not started.public void checkAllHardwareStopped()
throws HardwareException
HardwareException - a compound exception that list the exceptions
fired by hardwares that are not stopped.public void doStart()
protected void doShutdown()
@Command(description="completes initialization after hardware problems corrections", type=ACTION) public void completeInitialization() throws SystemStateException, HardwareException
@Command(description="forces blocked shutdown (not implemented yet!)", type=SIGNAL) public void forceShutdown()
@Command(description="abort subsystem", type=SIGNAL) public void abort()
@Command(description="stops hardware with expected max delay", type=ACTION) public void stop(@Argument(name="timeHint",defaultValue="-1") long timeHint) throws HardwareException
timeHint - time limit for executionHardwareException@Command(description="waits until all the hardware devices are actually stopped", type=ACTION) public void stopAndWait(long timeHint) throws HardwareException, InterruptedException
timeHint - HardwareException, - InterruptedExceptionHardwareExceptionInterruptedException@Command(description="switch to ENGINEERING mode", type=ACTION) public boolean switchToEngineeringMode()
true if the subsystem state has changed as a result of
execution@Command(description="Tries to get back to NORMAL mode", type=ACTION) public final void switchToNormalMode() throws SystemStateException
SystemStateException - if alarms are not cleared or signals are
still running@Command(description="set the level of a Logger", type=QUERY) public void setLogLevel(String keyLogger, String levelName)
keyLogger - name of LoggerlevelName - the name of a JUL Level@Command(description="sets the the depth of stacktraces in Logger messages", type=QUERY) public void setStackTraceDepth(int depth)
depth - could be negative if we want all the stackTrace@Command(description="sets the format used by TextFormatter for LogEvent messages ", type=QUERY) public void setLogFormat(String format)
format - @Command(description="sets the handler (ConsoleHandler, FileHandler, LogBusHandler) log level", type=QUERY) public void setLogHandlerLevel(String handlerName, String level)
java.util.logging.Level#parse(String) to parse the Level corresponding to the provided String.handlerName - The name of the LogHandler. Valid names are: LogBusHandler, LogBus, ConsoleHandler, Console, FileHandler, Filelevel - A String corresponding to a java.util.logging.Levelpublic Handler getLogHandler(String handlerName)
handlerName - The name of the LogHandler. Valid names are: LogBusHandler, LogBus, ConsoleHandler, Console, FileHandler, File@Command(description="gets the number of commands which are currently running (except the current one!)", type=QUERY) public int getNumberCommandThreads()
@Command(description="gets the name of commands which are currently running", type=QUERY) public String printRunningCommands()
@Command(description="broadcast on the status bus a message of presence", type=QUERY, category=SYSTEM) public void ping()
public static final Subsystem getSubsystemForObject(Object obj)
Copyright © 2017 LSST. All rights reserved.