Class CommandStatus

java.lang.Object
org.sensorhub.api.command.CommandStatus
All Implemented Interfaces:
ICommandStatus

public class CommandStatus extends Object implements ICommandStatus

Immutable class used as command status report

  • Field Details

  • Constructor Details

  • Method Details

    • completed

      public static ICommandStatus completed(BigId commandID)
      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

      public static ICommandStatus rejected(BigId commandID, String errorMsg)
      Generate a status report for a command that was immediately rejected
      Parameters:
      commandID - The ID of the command triggering the report
      errorMsg - The error message
      Returns:
      The status report
    • failed

      public static ICommandStatus failed(BigId commandID, String errorMsg)
      Generate a status report for a command that failed during execution
      Parameters:
      commandID - The ID of the command triggering the report
      errorMsg - The error message
      Returns:
      The status report
    • pending

      public static ICommandStatus pending(BigId commandID)
      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 report
      taskID - ID assigned to the command/task
      Returns:
      The status report
    • accepted

      public static ICommandStatus accepted(BigId commandID)
      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

      public static ICommandStatus scheduled(BigId commandID, TimeExtent execTime)
      Generate a status report for a command that is scheduled to be executed later on
      Parameters:
      commandID - The ID of the command triggering the report
      execTime - 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 report
      progress - The estimated progress expressed in percent
      message - A message describing the current progress (can be null)
      execTime - The new estimate of the execution time
      Returns:
      The status report
    • completed

      public static ICommandStatus completed(BigId commandID, TimeExtent execTime)
      Generate a status report for a command that was asynchronously executed and completed successfully
      Parameters:
      commandID - The ID of the command triggering the report
      execTime - The actual time (or time period) the command was executed
      Returns:
      The status report
    • completed

      public static ICommandStatus completed(BigId commandID, TimeExtent execTime, ICommandResult result)
      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 report
      execTime - The actual time (or time period) the command was executed
      result - The result (observations) produced during execution of the command
      Returns:
      The status report
    • getCommandID

      public BigId getCommandID()
      Specified by:
      getCommandID in interface ICommandStatus
      Returns:
      The internal ID of the command that this status relates to. The initial status report must always include the command ID.
    • getReportTime

      public Instant getReportTime()
      Specified by:
      getReportTime in interface ICommandStatus
      Returns:
      The time at which this status report was generated by the command receiver
    • getStatusCode

      public ICommandStatus.CommandStatusCode getStatusCode()
      Specified by:
      getStatusCode in interface ICommandStatus
      Returns:
      The command status code
    • getExecutionTime

      public TimeExtent getExecutionTime()
      Specified by:
      getExecutionTime in interface ICommandStatus
      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 interface ICommandStatus
      Returns:
      The percentage of progress if it can be computed, -1 otherwise.
    • getMessage

      public String getMessage()
      Specified by:
      getMessage in interface ICommandStatus
      Returns:
      A status message, which can be either an error message or an informative message, depending on the status code
    • getResult

      public ICommandResult getResult()
      Specified by:
      getResult in interface ICommandStatus
      Returns:
      The result of the command (either inline of by reference)
    • toString

      public String toString()
      Overrides:
      toString in class Object