Package org.sensorhub.api.command
Class CommandStatus
java.lang.Object
org.sensorhub.api.command.CommandStatus
- All Implemented Interfaces:
ICommandStatus
Immutable class used as command status report
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
CommandStatus.CommandStatusBuilder<B extends CommandStatus.CommandStatusBuilder<B,
T>, T extends CommandStatus> Nested classes/interfaces inherited from interface org.sensorhub.api.command.ICommandStatus
ICommandStatus.CommandStatusCode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BigId
protected TimeExtent
protected String
protected int
protected Instant
protected ICommandResult
protected ICommandStatus.CommandStatusCode
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
protected
CommandStatus
(BigId commandID, ICommandStatus.CommandStatusCode statusCode, TimeExtent executionTime) -
Method Summary
Modifier and TypeMethodDescriptionstatic ICommandStatus
Generate a status report for a command that was immediately accepted but will be executed later onstatic ICommandStatus
Generate a status report for a command that was immediately executed and completed successfullystatic ICommandStatus
completed
(BigId commandID, TimeExtent execTime) Generate a status report for a command that was asynchronously executed and completed successfullystatic ICommandStatus
completed
(BigId commandID, TimeExtent execTime, ICommandResult result) Generate a status report for a command that was asynchronously executed and completed successfully with a resultstatic ICommandStatus
Generate a status report for a command that failed during executionint
static ICommandStatus
Generate a status report for a command that is pending and will be processed later onstatic ICommandStatus
progress
(BigId commandID, int progress, String message, TimeExtent execTime) Generate a status report for a command that is in-progressstatic ICommandStatus
Generate a status report for a command that was immediately rejectedstatic ICommandStatus
scheduled
(BigId commandID, TimeExtent execTime) Generate a status report for a command that is scheduled to be executed later ontoString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.sensorhub.api.command.ICommandStatus
isFinal
-
Field Details
-
commandID
-
reportTime
-
executionTime
-
statusCode
-
progress
protected int progress -
message
-
result
-
-
Constructor Details
-
CommandStatus
protected CommandStatus() -
CommandStatus
protected CommandStatus(BigId commandID, ICommandStatus.CommandStatusCode statusCode, TimeExtent executionTime)
-
-
Method Details
-
completed
Generate a status report for a command that was immediately executed and completed successfully- Parameters:
commandID
- The ID of the command triggering the report- Returns:
- The status report
-
rejected
Generate a status report for a command that was immediately rejected- Parameters:
commandID
- The ID of the command triggering the reporterrorMsg
- The error message- Returns:
- The status report
-
failed
Generate a status report for a command that failed during execution- Parameters:
commandID
- The ID of the command triggering the reporterrorMsg
- The error message- Returns:
- The status report
-
pending
Generate a status report for a command that is pending and will be processed later on- Parameters:
commandID
- The ID of the command triggering the reporttaskID
- ID assigned to the command/task- Returns:
- The status report
-
accepted
Generate a status report for a command that was immediately accepted but will be executed later on- Parameters:
commandID
- The ID of the command triggering the report- Returns:
- The status report
-
scheduled
Generate a status report for a command that is scheduled to be executed later on- Parameters:
commandID
- The ID of the command triggering the reportexecTime
- The time (instant or period) at which the command is scheduled to execute- Returns:
- The status report
-
progress
public static ICommandStatus progress(BigId commandID, int progress, String message, TimeExtent execTime) Generate a status report for a command that is in-progress- Parameters:
commandID
- The ID of the command triggering the reportprogress
- The estimated progress expressed in percentmessage
- A message describing the current progress (can be null)execTime
- The new estimate of the execution time- Returns:
- The status report
-
completed
Generate a status report for a command that was asynchronously executed and completed successfully- Parameters:
commandID
- The ID of the command triggering the reportexecTime
- The actual time (or time period) the command was executed- Returns:
- The status report
-
completed
Generate a status report for a command that was asynchronously executed and completed successfully with a result- Parameters:
commandID
- The ID of the command triggering the reportexecTime
- The actual time (or time period) the command was executedresult
- The result (observations) produced during execution of the command- Returns:
- The status report
-
getCommandID
- Specified by:
getCommandID
in interfaceICommandStatus
- Returns:
- The internal ID of the command that this status relates to. The initial status report must always include the command ID.
-
getReportTime
- Specified by:
getReportTime
in interfaceICommandStatus
- Returns:
- The time at which this status report was generated by the command receiver
-
getStatusCode
- Specified by:
getStatusCode
in interfaceICommandStatus
- Returns:
- The command status code
-
getExecutionTime
- Specified by:
getExecutionTime
in interfaceICommandStatus
- Returns:
- The execution time of the command. This can be an estimated,
scheduled or actual execution time depending on the command status.
See
ICommandStatus.CommandStatusCode
-
getProgress
public int getProgress()- Specified by:
getProgress
in interfaceICommandStatus
- Returns:
- The percentage of progress if it can be computed, -1 otherwise.
-
getMessage
- Specified by:
getMessage
in interfaceICommandStatus
- Returns:
- A status message, which can be either an error message or an informative message, depending on the status code
-
getResult
- Specified by:
getResult
in interfaceICommandStatus
- Returns:
- The result of the command (either inline of by reference)
-
toString
-