
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.RunningCommandcommandExecutorLock, 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 |
addClearAlertHandler(ClearAlertHandler handler)
Deprecated.
This call is no longer needed as the ClearAlertHandler should be picked up by the framework
|
protected void |
addInternalNodes() |
void |
change(String componentName,
String parameterName,
Object value)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
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.
|
String[] |
clearAlerts(String... alertId)
Clear one or more Alerts by providing the alert id.
|
String[] |
clearAllAlerts()
Attempt to clear all the outstanding alerts.
|
void |
commitBulkChange()
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
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 |
dropAllChanges()
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
dropAllSubmittedChanges()
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
dropChangesForCategories(String... categories)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
dropSubmittedChangesForComponent(String name)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
Set<String> |
findAvailableConfigurationsForCategory(String category)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
forceShutdown()
Command to force subsystem shutdown.
|
Map<String,Map<String,String>> |
getAllSubmittedChanges()
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
Set<String> |
getCategories()
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
ComponentConfigurationEnvironment |
getComponentConfigurationEnvironment(Object obj)
Get the ComponentConfigurationEnvironment object for a given Object.
|
ComponentConfigurationEnvironment |
getComponentConfigurationEnvironmentByName(String name)
Get the ComponentConfigurationEnvironment object for a given node name.
|
ConfigurationInfo |
getConfigurationInfo()
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
Map<String,String> |
getCurrentValuesForComponent(String componentName,
Set<String> categorySet)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
String |
getDescription()
Gets the name of the description this subsystem was built from.
|
Logger |
getLogger()
Returns the current logger (use sparingly and prefer your own logger).
|
Handler |
getLogHandler(String handlerName)
Get a LogHandler for a given name.
|
ComponentLookup |
getLookup()
Deprecated.
Use getComponentLookup instead
|
Monitor |
getMonitor()
Provides access to this subsystem's monitor.
|
int |
getNumberCommandThreads()
Command that returns the number of currently running commands.
|
RaisedAlertSummary |
getRaisedAlertSummary()
Get the Subsystem's RaisedAlertSummary.
|
Map<String,String> |
getSubmittedChangesForComponent(String name)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
SubsystemConfigurationEnvironment |
getSubsystemConfigurationEnvironment()
Provides programmatic access to the configuration API.
|
static Subsystem |
getSubsystemForObject(Object obj)
Get the Subsystem for a given object belonging to a ComponentLookup.
|
String |
getTag()
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
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. |
boolean |
isParameterConfigurable(String componentName,
String parameterName)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
loadCategories(String... taggedCategories)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
loadConfiguration(String... taggedCategories)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
persistNow()
Triggers local persistence of
Persist annotated fields. |
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 |
raiseAlert(Alert alert,
AlertState severity,
String cause)
Raise an Alert with a given AlertState.
|
void |
saveAllChanges()
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
saveChangesForCategories(String... categories)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
void |
saveChangesForCategoriesAs(String... taggedCategories)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
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 |
setPeriodicTaskPeriod(String taskName,
long period)
Change the period of a PeriodicTask.
|
void |
setStackTraceDepth(int depth)
Will modify the depth of stackTrace printing for ALL handlers (including
the LogBusHandler)
|
void |
start()
Starts this Agent
|
void |
startAgent()
Starts this Agent
|
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
|
void |
submitChange(String componentName,
String parameterName,
Object value)
Deprecated.
use the configuration API through the ConfigurationCommandSet
object accessible via getSubsystemConfigurationEnvironment()
|
boolean |
switchToEngineeringMode()
Command to switch to ENGINEERING mode.
|
void |
switchToNormalMode()
Command to switch to NORMAL mode.
|
addCommandSet, addCommandsFromObject, broadcastStatus, executeCommandRequest, getAgentInfo, getAgentPeriodicTasks, getCCSVersions, getCommandCount, getCommandSet, getCommandTargets, getComponentLookup, getCurrentAction, getDictionaries, getDistributionInfo, getEnvironmentMessagingAccess, getMessagingAccess, getName, getPeriodicTaskPeriod, getScheduler, getState, getState, getStatusBroadcastPeriod, isInEngineeringMode, isInState, isInState, populateComponentLookup, postStart, publishStateChange, publishSubsystemDataOnStatusBus, sendAck, sendNack, setAgentProperty, shutdown, 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 void addInternalNodes()
addInternalNodes in class Agentpublic Monitor getMonitor()
public void startAgent()
AgentstartAgent in class Agentpublic void start()
Agentprotected 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 startedpublic Logger getLogger()
@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@Deprecated public final void addClearAlertHandler(ClearAlertHandler handler)
handler - The ClearAlertHandler class that will handle the clearing
of alerts.public final void raiseAlert(Alert alert, AlertState severity, String cause)
alert - The Alert instance to be raisedseverity - The AlertState of this Alert.cause - The reason the Alert was raised.@Command(description="Clear alerts", type=ACTION) public final String[] clearAlerts(String... alertId)
alertId - the Id of the Alerts to be cleared.@Command(description="Clear all alerts", type=ACTION) public final String[] clearAllAlerts()
@Command(description="Get the Raised Alert Summary", type=QUERY) public final RaisedAlertSummary getRaisedAlertSummary()
@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 final void persistNow()
Persist annotated fields.public final SubsystemConfigurationEnvironment getSubsystemConfigurationEnvironment()
@Deprecated public final void saveAllChanges() throws ConfigurationServiceException
ConfigurationServiceException - if configuration service
unavailable@Deprecated public final void saveChangesForCategories(@Argument(name="taggedCategories",description="A list of categories") String... categories)
categories - a list of categoriesConfigurationServiceException - if configuration service
unavailable.@Deprecated public final void saveChangesForCategoriesAs(@Argument(name="taggedCategories",description="A list of pairs categoryName:configurationName") String... taggedCategories)
taggedCategories - a list of pairs categoryName:configurationNameConfigurationServiceException - if the configuration service is not
available.@Deprecated public void dropAllChanges()
@Deprecated public void dropChangesForCategories(@Argument(name="categories",description="A list of categories") String... categories)
categories - A list of categories@Deprecated public void loadConfiguration(@Argument(name="taggedCategories",description="a list of pairs categoryName:configurationName") String... taggedCategories)
taggedCategories - a list of pairs categoryName:configurationNameConfigurationServiceExceptionTypeConversionException@Deprecated public void loadCategories(@Argument(name="taggedCategories",description="a list of pairs categoryName:configurationName") String... taggedCategories)
taggedCategories - a list of pairs categoryName:configurationNameConfigurationServiceException@Deprecated public void change(String componentName, String parameterName, Object value)
componentName - the name of the component the parameter belongs to.parameterName - the name of the parameter.value - the new value to affect to this parameter@Deprecated public void submitChange(String componentName, String parameterName, Object value)
componentName - parameterName - value - IllegalArgumentException - if componentName does not
have a configurable parameter named parameterName@Deprecated public void commitBulkChange()
@Deprecated public void dropAllSubmittedChanges()
@Deprecated public void dropSubmittedChangesForComponent(@Argument(description="the component name") String name)
@Deprecated public Map<String,String> getSubmittedChangesForComponent(@Argument(description="the component name") String name)
@Deprecated public Map<String,Map<String,String>> getAllSubmittedChanges()
@Deprecated public Set<String> getCategories()
@Deprecated public Set<String> findAvailableConfigurationsForCategory(String category)
category - @Deprecated public Map<String,String> getCurrentValuesForComponent(String componentName, Set<String> categorySet)
@Deprecated public boolean isParameterConfigurable(String componentName, String parameterName)
componentName - the component nameparameterName - the parameter name@Deprecated public ConfigurationInfo getConfigurationInfo()
@Deprecated public String getTag()
public String getDescription()
public static final Subsystem getSubsystemForObject(Object obj)
public ComponentConfigurationEnvironment getComponentConfigurationEnvironment(Object obj)
public ComponentConfigurationEnvironment getComponentConfigurationEnvironmentByName(String name)
public void setPeriodicTaskPeriod(String taskName, long period)
setPeriodicTaskPeriod in class AgenttaskName - The name of the taskperiod - The period in millisecondsCopyright © 2017 LSST. All rights reserved.