Class CommandQueueManager

All Implemented Interfaces:, ParameterProcessor, SystemParametersProducer

public class CommandQueueManager extends implements ParameterProcessor, SystemParametersProducer
Implements the management of the control queues for one processor:
  • for each command that is sent, based on the sender it finds the queue where the command should go
  • depending on the queue state the command can be immediately sent, stored in the queue or rejected
  • when the command is immediately sent or rejected, the command queue monitor is not notified
  • if the command has transmissionConstraints with timeout > 0, the command can sit in the queue even if the queue is not on hold
Note: the update of the command monitors is done in the same thread. That means that if the connection to one of the monitors is lost, there may be a delay of a few seconds. As the monitoring clients will be priviledged users most likely connected in the same LAN, I don't consider this to be an issue.
  • Constructor Details

  • Method Details

    • doStart

      public void doStart()
      called at processor startup
      Specified by:
      doStart in class
    • doStop

      public void doStop()
      Specified by:
      doStop in class
    • getQueues

      public List<CommandQueue> getQueues()
    • getQueue

      public CommandQueue getQueue(String name)
    • addCommand

      public CommandQueue addCommand(User user, ActiveCommand activeCommand)
      Called from the CommandingImpl to add a command to the queue.

      First the command is added to the command history. Depending on the status of the queue, the command is rejected by setting the CommandFailed in the command history added to the queue or directly sent using the command releaser.

      user -
      activeCommand -
      the queue the command was added to
    • addToCommandHistory

      public void addToCommandHistory(Commanding.CommandId commandId, Commanding.CommandHistoryAttribute attribute)
    • getQueue

      public CommandQueue getQueue(User user, PreparedCommand pc)
      user -
      pc -
      the queue where the command should be placed.
    • rejectCommand

      public PreparedCommand rejectCommand(Commanding.CommandId commandId, String username)
      Called by external clients to remove a command from the queue
      commandId -
      username - the username rejecting the command
      the command removed from the queeu
    • rejectCommand

      @Deprecated public PreparedCommand rejectCommand(UUID uuid, String username)
    • rejectCommand

      public PreparedCommand rejectCommand(String commandId, String username)
    • sendCommand

      public PreparedCommand sendCommand(Commanding.CommandId commandId)
      Called from external client to release a command from the queue
      commandId - - if to rebuild the command binary from the source
      the prepared command sent
    • sendCommand

      @Deprecated public PreparedCommand sendCommand(UUID uuid)
    • sendCommand

      public PreparedCommand sendCommand(String commandId)
    • setQueueState

      public CommandQueue setQueueState(String queueName, Commanding.QueueState newState)
      Called from external clients to change the state of the queue
      queueName - the queue whose state has to be set
      newState - the new state of the queue
      the queue whose state has been changed or null if no queue by the name exists
    • registerListener

      public void registerListener(CommandQueueListener cqm)
      Called from a queue monitor to register itself in order to be notified when new commands are added/removed from the queue.
      cqm - the callback which will be called with updates
    • removeListener

      public boolean removeListener(CommandQueueListener cqm)
    • getInstance

      public String getInstance()
    • getChannelName

      public String getChannelName()
    • process

      public void process(ProcessingData tmData)
      Called from PRM when new telemetry data is available
      Specified by:
      process in interface ParameterProcessor
    • getSystemParameters

      public Collection<ParameterValue> getSystemParameters(long time)
      Description copied from interface: SystemParametersProducer
      return the next bunch of parameter values.

      The gentime is the mission time when the parameter collection started. The returning parameters can use this time to allow all parameters in one collection interval to be timestamped with the same time.

      Specified by:
      getSystemParameters in interface SystemParametersProducer