Package org.lsst.ccs

Class Subsystem

java.lang.Object
org.lsst.ccs.Agent
org.lsst.ccs.Subsystem
All Implemented Interfaces:
CommandExecutor, ServiceLifecycle
Direct Known Subclasses:
JythonInterpreterConsole, LogTracer, Py4JServer, Tracer

public class Subsystem extends Agent
The base class for a CCS subsystem.

This object will register itself on the three buses (control, status, log). It broadcasts its status, and can receive Commands.

Author:
Eric Aubourg, Bernard AMADE
  • Constructor Details

    • Subsystem

      public Subsystem(String name, AgentInfo.AgentType type)
      Constructs a Subsystem of a given type with no inner structure.
      Parameters:
      name - name of the subsystem : cannot be null
      type - Agent type
  • Method Details

    • setLogLevel

      @Command(description="set the level of a Logger", type=QUERY, category=CORE, level=0) public void setLogLevel(String keyLogger, String levelName)
      Command to set the Level of a named Logger.
      Parameters:
      keyLogger - name of Logger
      levelName - the name of a JUL Level or null or "null" to revert to inherited Level
    • getLogLevel

      @Command(description="get the level of a Logger", type=QUERY, category=CORE, level=0) public Level getLogLevel(String keyLogger)
      Command to get the Level of a named Logger.
      Parameters:
      keyLogger - name of Logger
      Returns:
      the Logger level (either inherited or directly set)
    • isLogLevelInherited

      @Command(description="check if the level of a Logger is inherited", type=QUERY, category=CORE, level=0) public boolean isLogLevelInherited(String keyLogger)
      Command to check if the Level of a named Logger is inherited.
      Parameters:
      keyLogger - name of Logger
      Returns:
      true if the Level is inherited, false if it's set directly on the Logger
    • printLoggersLevel

      @Command(description="check if the level of a Logger is inherited", type=QUERY, category=CORE, level=0) public String printLoggersLevel()
    • setStackTraceDepth

      @Command(description="sets the the depth of stacktraces in Logger messages", type=QUERY, category=CORE, level=1) public void setStackTraceDepth(int depth)
      Will modify the depth of stackTrace printing for ALL handlers (including the LogBusHandler)
      Parameters:
      depth - could be negative if we want all the stackTrace
    • setLogFormat

      @Command(description="sets the format used by TextFormatter for LogEvent messages ", type=QUERY, category=CORE, level=1) public void setLogFormat(String format)
      Command to set a format for the TextFormatter of LogBusHandler (see logging.properties doc).
      Parameters:
      format -
    • setLogHandlerLevel

      @Command(description="sets the handler (ConsoleHandler, FileHandler, LogBusHandler) log level", type=QUERY, category=CORE, level=0) public 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.
      Parameters:
      handlerName - The name of the LogHandler. Valid names are: LogBusHandler, LogBus, ConsoleHandler, Console, FileHandler, File
      level - A String corresponding to a java.util.logging.Level
    • getLogHandlerLevel

      @Command(description="sets the handler (ConsoleHandler, FileHandler, LogBusHandler) log level", type=QUERY, category=CORE, level=0) public Level getLogHandlerLevel(String handlerName)
      Command to get the level for a given handler.
      Parameters:
      handlerName - The name of the LogHandler. Valid names are: LogBusHandler, LogBus, ConsoleHandler, Console, FileHandler, File
      Returns:
      The Level of the specified Handler
    • printLogHandlersLevel

      @Command(description="print the levels for all the log handlers", type=QUERY, category=CORE, level=0) public String printLogHandlersLevel()
    • getLogHandler

      public Handler getLogHandler(String handlerName)
      Get a LogHandler for a given name.
      Parameters:
      handlerName - The name of the LogHandler. Valid names are: LogBusHandler, LogBus, ConsoleHandler, Console, FileHandler, File
      Returns:
      The corresponding Handler or null if nothing was found.
    • getNumberCommandThreads

      @Command(description="gets the number of commands which are currently running (except the current one!)", type=QUERY, category=SYSTEM) public int getNumberCommandThreads()
      Command that returns the number of currently running commands.
      Returns:
      the number of commands currently executing (except the current one)
    • printRunningCommands

      @Command(description="gets the name of commands which are currently running", type=QUERY, category=CORE) public String printRunningCommands()
      Command returning a String describing which commands are running.
      Returns:
      summary of currently running commands.
    • ping

      @Command(description="broadcast on the status bus a message of presence", type=QUERY, category=SYSTEM) public void ping()
      Command to broadcast a message of presence on the status bus.