Class DefaultCommandExecutor

java.lang.Object
org.eso.ias.command.DefaultCommandExecutor
All Implemented Interfaces:
CommandListener

public class DefaultCommandExecutor extends Object implements CommandListener
The DefaultCommandExecutor provides a default implementation of the commands defined in CommandType. An object of this class as usually passed as parameter of CommandManager.start(CommandListener, AutoCloseable) if the default behavior is acceptable. Otherwise it is possible to pass an object that extends this one overloading just the behavior to customize. If RESTART or SHUTDOWN are invoked, the implementations of those commands can execute a pice of code before the process is effectively restarted or shutdown. The restart and shutdwon of the process must be executed by the CommandManager that is in charge to send the reply to the caller and free the resources before shutting down the current process.
  • Constructor Details

    • DefaultCommandExecutor

      public DefaultCommandExecutor()
  • Method Details

    • newCommand

      public final CommandListener.CmdExecutionResult newCommand(CommandMessage cmd) throws Exception
      The method that processes the commands received from the command topic
      Specified by:
      newCommand in interface CommandListener
      Parameters:
      cmd - The command received from the command topic
      Returns:
      The result of the execution of the command
      Throws:
      Exception
    • tfChanged

      A TF has been changed. This message is aimed to the ASCEs that produce th eoutput applying the TF with the passed ID. The receiver of the message is the Supervisor on behalf of the ASCE(s). This implementation does nothing and return OK. Normally this message is broadcast.
      Parameters:
      cmd - The TF_CHANGED command received from the command topic
      Returns:
      The result of the execution of the command
      Throws:
      Exception
    • alarmAcknowledged

      public CommandListener.CmdExecutionResult alarmAcknowledged(CommandMessage cmd) throws Exception
      A an Alarm has been acknowledged. This message is aimed to the DASU that produces such alarm (i.e. received by the Supervisor where the DASU is deployed) all the other tools can safely ignore the command. This implementation does nothing and return OK.
      Parameters:
      cmd - The ACK command received from the command topic
      Returns:
      The result of the execution of the command
      Throws:
      Exception
    • ping

      The default implementation of the PING command returns OK
      Parameters:
      cmd - The PING command received from the command topic
      Returns:
      The result of the execution of the command
      Throws:
      Exception
    • setLogLevel

      The default implementation of the SET_LOG_LEVEL. The first parameter of the command is a string representing the new log level i.e. one of the following: - OFF - ERROR - WARN - INFO - DEBUG - TRACE - ALL
      Parameters:
      cmd - The PING command received from the command topic
      Returns:
      The result of the execution of the command
      Throws:
      Exception
    • restart

      The method called when a RESTART command has been executed. The implementation of this method must not effectively restart the process but ask for the restarting in the returned CommandListener.CmdExecutionResult The implementation can add here additional code to be executed before the process is shutdown
      Parameters:
      cmd - The RESTART command received from the command topic
      Returns:
      The result of the execution of the command
      Throws:
      Exception
    • shutdown

      The method called when a SHUTDOWN command has been executed. The implementation of this method must not effectively restart the process but ask for the restarting in the returned CommandListener.CmdExecutionResult. The implementation can add here additional code to be executed before the process is shutdown
      Parameters:
      cmd - The RESTART command received from the command topic
      Returns:
      The result of the execution of the command
      Throws:
      Exception