Package org.yamcs.commanding
Class CommandQueueManager
java.lang.Object
com.google.common.util.concurrent.AbstractService
org.yamcs.commanding.CommandQueueManager
- All Implemented Interfaces:
com.google.common.util.concurrent.Service
,ParameterProcessor
,SystemParametersProducer
public class CommandQueueManager
extends com.google.common.util.concurrent.AbstractService
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State
-
Constructor Summary
ConstructorDescriptionCommandQueueManager
(CommandingManager commandingManager) Constructs a Command Queue Manager. -
Method Summary
Modifier and TypeMethodDescriptionaddCommand
(User user, ActiveCommand activeCommand) Called from the CommandingImpl to add a command to the queue.void
addToCommandHistory
(Commanding.CommandId commandId, Commanding.CommandHistoryAttribute attribute) void
doStart()
called at processor startupvoid
doStop()
getQueue
(User user, PreparedCommand pc) getSystemParameters
(long time) return the next bunch of parameter values.void
process
(ProcessingData tmData) Called from PRM when new telemetry data is availablevoid
Called from a queue monitor to register itself in order to be notified when new commands are added/removed from the queue.rejectCommand
(String commandId, String username) rejectCommand
(Commanding.CommandId commandId, String username) Called by external clients to remove a command from the queueboolean
sendCommand
(String commandId) sendCommand
(Commanding.CommandId commandId) Called from external client to release a command from the queuesetQueueState
(String queueName, Commanding.QueueState newState) Called from external clients to change the state of the queueMethods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.yamcs.parameter.SystemParametersProducer
getFrequency
-
Constructor Details
-
CommandQueueManager
public CommandQueueManager(CommandingManager commandingManager) throws ConfigurationException, ValidationException Constructs a Command Queue Manager.- Parameters:
commandingManager
-- Throws:
ConfigurationException
- When there is an error in the configuration file. Note: if the configuration file doesn't exist, this exception is not thrown.ValidationException
- When configuration file is incorrect.
-
-
Method Details
-
doStart
public void doStart()called at processor startup- Specified by:
doStart
in classcom.google.common.util.concurrent.AbstractService
-
doStop
public void doStop()- Specified by:
doStop
in classcom.google.common.util.concurrent.AbstractService
-
getQueues
-
getQueue
-
addCommand
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.
- Parameters:
user
-activeCommand
-- Returns:
- the queue the command was added to
-
addToCommandHistory
public void addToCommandHistory(Commanding.CommandId commandId, Commanding.CommandHistoryAttribute attribute) -
getQueue
- Parameters:
user
-pc
-- Returns:
- the queue where the command should be placed.
-
rejectCommand
Called by external clients to remove a command from the queue- Parameters:
commandId
-username
- the username rejecting the command- Returns:
- the command removed from the queeu
-
rejectCommand
-
sendCommand
Called from external client to release a command from the queue- Parameters:
commandId
- - if to rebuild the command binary from the source- Returns:
- the prepared command sent
-
sendCommand
-
setQueueState
Called from external clients to change the state of the queue- Parameters:
queueName
- the queue whose state has to be setnewState
- the new state of the queue- Returns:
- the queue whose state has been changed or null if no queue by the name exists
-
registerListener
Called from a queue monitor to register itself in order to be notified when new commands are added/removed from the queue.- Parameters:
cqm
- the callback which will be called with updates
-
removeListener
-
getInstance
-
getChannelName
-
process
Called from PRM when new telemetry data is available- Specified by:
process
in interfaceParameterProcessor
-
getSystemParameters
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 interfaceSystemParametersProducer
-