Class CommandConstants

java.lang.Object
org.eclipse.hono.util.CommandConstants

public class CommandConstants extends Object
Constants & utility methods used throughout the Command and Control API.
  • Field Details

    • COMMAND_ENDPOINT

      public static final String COMMAND_ENDPOINT
      The name of the Command and Control API endpoint.
      See Also:
    • COMMAND_ENDPOINT_SHORT

      public static final String COMMAND_ENDPOINT_SHORT
      The short name of the Command and Control endpoint.
      See Also:
    • COMMAND_RESPONSE_ENDPOINT

      public static final String COMMAND_RESPONSE_ENDPOINT
      The name of the Command and Control API endpoint provided by protocol adapters that use a separate endpoint for command responses.
      See Also:
    • COMMAND_RESPONSE_ENDPOINT_SHORT

      public static final String COMMAND_RESPONSE_ENDPOINT_SHORT
      The short name of the Command and Control API endpoint provided by protocol adapters that use a separate endpoint for command responses.
      See Also:
    • INTERNAL_COMMAND_ENDPOINT

      public static final String INTERNAL_COMMAND_ENDPOINT
      The name of the internal Command and Control API endpoint provided by protocol adapters for delegating commands from one adapter to another.
      See Also:
    • NORTHBOUND_COMMAND_REQUEST_ENDPOINT

      public static final String NORTHBOUND_COMMAND_REQUEST_ENDPOINT
      The name of the northbound Command and Control API request endpoint used by northbound applications.
      See Also:
    • NORTHBOUND_COMMAND_RESPONSE_ENDPOINT

      public static final String NORTHBOUND_COMMAND_RESPONSE_ENDPOINT
      The name of the northbound Command and Control API response endpoint used by northbound applications.
      See Also:
    • COMMAND_RESPONSE_REQUEST_PART

      public static final String COMMAND_RESPONSE_REQUEST_PART
      The part of the address for a command response between a device and an adapter, which identifies the request.
      See Also:
    • COMMAND_RESPONSE_REQUEST_PART_SHORT

      public static final String COMMAND_RESPONSE_REQUEST_PART_SHORT
      Short version of COMMAND_RESPONSE_REQUEST_PART.
      See Also:
    • COMMAND_RESPONSE_RESPONSE_PART

      public static final String COMMAND_RESPONSE_RESPONSE_PART
      The part of the address for a command response between a device and an adapter, which identifies the response.
      See Also:
    • COMMAND_RESPONSE_RESPONSE_PART_SHORT

      public static final String COMMAND_RESPONSE_RESPONSE_PART_SHORT
      Short version of COMMAND_RESPONSE_RESPONSE_PART.
      See Also:
    • CONTENT_TYPE_DELIVERY_FAILURE_NOTIFICATION

      public static final String CONTENT_TYPE_DELIVERY_FAILURE_NOTIFICATION
      The content type that is defined for error command response messages sent by a protocol adapter or Command Router.
      See Also:
    • MSG_PROPERTY_ADAPTER_INSTANCE_ID

      public static final String MSG_PROPERTY_ADAPTER_INSTANCE_ID
      The name of the message property containing the identifier of a protocol adapter instance.
      See Also:
    • MSG_PROPERTY_DEVICE_TTD

      public static final String MSG_PROPERTY_DEVICE_TTD
      The name of the message property containing the time (in seconds) until a device will be available for receiving an upstream (command) message (short for Time till Disconnect).
      See Also:
    • TOPIC_POSITION_RESPONSE_STATUS

      public static final int TOPIC_POSITION_RESPONSE_STATUS
      Position of the status code in the MQTT command response topic. command/[tenant]/[device-id]/res/<req-id>/<status>
      See Also:
    • TOPIC_POSITION_RESPONSE_REQ_ID

      public static final int TOPIC_POSITION_RESPONSE_REQ_ID
      Position of the request id in the MQTT command response topic. command/[tenant]/[device-id]/res/<req-id>/<status>
      See Also:
  • Method Details

    • isCommandEndpoint

      public static boolean isCommandEndpoint(String endpoint)
      Returns true if the passed endpoint denotes a command endpoint (full or short version).
      Parameters:
      endpoint - The endpoint as a string.
      Returns:
      true if the endpoint is a command endpoint.
    • isNorthboundCommandResponseEndpoint

      public static boolean isNorthboundCommandResponseEndpoint(String endpoint)
      Returns true if the passed endpoint denotes a command response endpoint as used by northbound applications.
      Parameters:
      endpoint - The endpoint as a string.
      Returns:
      true if the endpoint is a command response endpoint.
    • getNewAdapterInstanceId

      public static String getNewAdapterInstanceId(String adapterName, int counter)
      Creates a new adapter instance identifier.

      If this method is invoked from within a docker container in a Kubernetes cluster, the format is [prefix]_[docker_container_id]_[counter], with prefix being the name of the Kubernetes pod. See also getK8sPodNameAndContainerIdFromAdapterInstanceId(String).

      If not running in a Kubernetes cluster, a random id with the given adapter name as prefix is used.

      Parameters:
      adapterName - The adapter name.
      counter - The counter value to use.
      Returns:
      The new adapter instance identifier.
    • getNewAdapterInstanceIdForNonK8sEnv

      public static String getNewAdapterInstanceIdForNonK8sEnv(String adapterName)
      Creates a new adapter instance identifier for use in a non-Kubernetes environment.

      The format is [adapterName]_[uuid].

      Parameters:
      adapterName - The adapter name to use.
      Returns:
      The new adapter instance identifier.
    • getNewAdapterInstanceIdForK8sEnv

      public static String getNewAdapterInstanceIdForK8sEnv(String podName, String containerId, int counter)
      Creates a new adapter instance identifier for use in a Kubernetes environment.

      The format is [pod_name]_[docker_container_id]_[counter].

      Parameters:
      podName - The pod name to use.
      containerId - The container identifier to use.
      counter - The counter value to use.
      Returns:
      The new adapter instance identifier.
      Throws:
      NullPointerException - If containerId is null.
    • getK8sPodNameAndContainerIdFromAdapterInstanceId

      public static Pair<String,String> getK8sPodNameAndContainerIdFromAdapterInstanceId(String adapterInstanceId)
      Gets the pod name and container identifier from a given adapter instance identifier that was created via getNewAdapterInstanceIdForK8sEnv(String, String, int).
      Parameters:
      adapterInstanceId - The adapter instance identifier.
      Returns:
      The pod name and container identifier pair or null if the adapter instance identifier didn't match.
      Throws:
      NullPointerException - If adapterInstanceId is null.