Class Constants


  • public final class Constants
    extends Object
    Constants used throughout Hono.
    • Field Detail

      • AMQP_BAD_REQUEST

        public static final org.apache.qpid.proton.amqp.Symbol AMQP_BAD_REQUEST
        Indicates that an AMQP request cannot be processed due to a perceived client error.
      • AMQP_ERROR_INACTIVITY

        public static final org.apache.qpid.proton.amqp.Symbol AMQP_ERROR_INACTIVITY
        Indicates that an AMQP connection is closed due to inactivity.
      • DEFAULT_PATH_SEPARATOR

        public static final String DEFAULT_PATH_SEPARATOR
        The default separator character for target addresses.
        See Also:
        Constant Field Values
      • PROTOCOL_ADAPTER_TYPE_AMQP

        public static final String PROTOCOL_ADAPTER_TYPE_AMQP
        The type of the AMQP protocol adapter.
        See Also:
        Constant Field Values
      • PROTOCOL_ADAPTER_TYPE_COAP

        public static final String PROTOCOL_ADAPTER_TYPE_COAP
        The type of the CoAP protocol adapter.
        See Also:
        Constant Field Values
      • PROTOCOL_ADAPTER_TYPE_HTTP

        public static final String PROTOCOL_ADAPTER_TYPE_HTTP
        The type of the HTTP protocol adapter.
        See Also:
        Constant Field Values
      • PROTOCOL_ADAPTER_TYPE_KURA

        public static final String PROTOCOL_ADAPTER_TYPE_KURA
        The type of the Eclipse Kura protocol adapter.
        See Also:
        Constant Field Values
      • PROTOCOL_ADAPTER_TYPE_LORA

        public static final String PROTOCOL_ADAPTER_TYPE_LORA
        The type of the LoRaWAN protocol adapter.
        See Also:
        Constant Field Values
      • PROTOCOL_ADAPTER_TYPE_MQTT

        public static final String PROTOCOL_ADAPTER_TYPE_MQTT
        The type of the MQTT protocol adapter.
        See Also:
        Constant Field Values
      • PROTOCOL_ADAPTER_TYPE_SIGFOX

        public static final String PROTOCOL_ADAPTER_TYPE_SIGFOX
        The type of the sigfox protocol adapter.
        See Also:
        Constant Field Values
      • SERVICE_NAME_AUTH

        public static final String SERVICE_NAME_AUTH
        The (short) name of the Auth Server component.
        See Also:
        Constant Field Values
      • SERVICE_NAME_DEVICE_CONNECTION

        public static final String SERVICE_NAME_DEVICE_CONNECTION
        The (short) name of the Device Connection service.
        See Also:
        Constant Field Values
      • SERVICE_NAME_DEVICE_REGISTRY

        public static final String SERVICE_NAME_DEVICE_REGISTRY
        The (short) name of the Device Registry component.
        See Also:
        Constant Field Values
      • HEADER_QOS_LEVEL

        public static final String HEADER_QOS_LEVEL
        The "QoS-Level" request header indicating the quality of service level supported by the HTTP Adapter. The HTTP adapter supports QoS level AT_LEAST_ONCE when uploading telemetry messages.
        See Also:
        Constant Field Values
      • CAP_REG_ASSERTION_VALIDATION

        public static final org.apache.qpid.proton.amqp.Symbol CAP_REG_ASSERTION_VALIDATION
        The AMQP capability indicating support for validating registration assertions issued by a Device Registration service.
      • CAP_ANONYMOUS_RELAY

        public static final org.apache.qpid.proton.amqp.Symbol CAP_ANONYMOUS_RELAY
        The AMQP capability indicating support for routing messages as defined by Anonymous Terminus for Message Routing.
      • KEY_CLIENT_PRINCIPAL

        public static final String KEY_CLIENT_PRINCIPAL
        The key that an authenticated client's principal is stored under in a ProtonConnection's attachments.
        See Also:
        Constant Field Values
      • KEY_CONNECTION_ID

        public static final String KEY_CONNECTION_ID
        The key that the (surrogate) ID of a connection is stored under in a ProtonConnection's and/or ProtonLink's attachments.
        See Also:
        Constant Field Values
      • EVENT_BUS_ADDRESS_CONNECTION_CLOSED

        public static final String EVENT_BUS_ADDRESS_CONNECTION_CLOSED
        The address that the ID of a connection that has been closed by a client is published to.
        See Also:
        Constant Field Values
      • EVENT_BUS_ADDRESS_TENANT_TIMED_OUT

        public static final String EVENT_BUS_ADDRESS_TENANT_TIMED_OUT
        The vert.x event bus address that the ID of a tenant that timed out is published to.
        See Also:
        Constant Field Values
      • PORT_AMQP

        public static final int PORT_AMQP
        The AMQP 1.0 port defined by IANA for unencrypted connections.
        See Also:
        Constant Field Values
      • PORT_AMQPS

        public static final int PORT_AMQPS
        The AMQP 1.0 port defined by IANA for TLS encrypted connections.
        See Also:
        Constant Field Values
      • PORT_UNCONFIGURED

        public static final int PORT_UNCONFIGURED
        Default value for a port that is not explicitly configured.
        See Also:
        Constant Field Values
      • LOOPBACK_DEVICE_ADDRESS

        public static final String LOOPBACK_DEVICE_ADDRESS
        The loopback device address.
        See Also:
        Constant Field Values
      • QUALIFIER_AMQP

        public static final String QUALIFIER_AMQP
        The qualifier to use for referring to AMQP based components.
        See Also:
        Constant Field Values
      • QUALIFIER_DOWNSTREAM

        public static final String QUALIFIER_DOWNSTREAM
        The qualifier to use for referring to components scoped to the AMQP 1.0 messaging network.
        See Also:
        Constant Field Values
      • QUALIFIER_HTTP

        public static final String QUALIFIER_HTTP
        The qualifier to use for referring to HTTP based components.
        See Also:
        Constant Field Values
      • QUALIFIER_MESSAGING

        public static final String QUALIFIER_MESSAGING
        The qualifier to use for referring to the AMQP Messaging Network.
        See Also:
        Constant Field Values
      • SUBJECT_ANONYMOUS

        public static final String SUBJECT_ANONYMOUS
        The subject name to use for anonymous clients.
        See Also:
        Constant Field Values
      • JSON_FIELD_DEVICE_ID

        public static final String JSON_FIELD_DEVICE_ID
        The field name of JSON payloads containing a device ID.
        See Also:
        Constant Field Values
      • JSON_FIELD_TENANT_ID

        public static final String JSON_FIELD_TENANT_ID
        The field name of JSON payloads containing a tenant ID.
        See Also:
        Constant Field Values
      • PRINCIPAL_ANONYMOUS

        public static final HonoUser PRINCIPAL_ANONYMOUS
        The principal to use for anonymous clients.
      • HEADER_TIME_TILL_DISCONNECT

        public static final String HEADER_TIME_TILL_DISCONNECT
        The header name defined for setting the time till disconnect for device command readiness notification events.
        See Also:
        Constant Field Values
      • HEADER_TIME_TO_LIVE

        public static final String HEADER_TIME_TO_LIVE
        The header name defined for setting the time-to-live for the event messages.
        See Also:
        Constant Field Values
      • HEADER_COMMAND_REQUEST_ID

        public static final String HEADER_COMMAND_REQUEST_ID
        The header name defined for setting the request id for device responses to a command. This id is sent to the device and has to be used in replies to the command to correlate the original command with the response.
        See Also:
        Constant Field Values
      • HEADER_COMMAND_TARGET_DEVICE

        public static final String HEADER_COMMAND_TARGET_DEVICE
        The header name defined for setting the target device id when sending a command to a gateway acting on behalf of the device.
        See Also:
        Constant Field Values
      • HEADER_COMMAND

        public static final String HEADER_COMMAND
        The header name defined for setting the command that is sent to the device.
        See Also:
        Constant Field Values
      • HEADER_COMMAND_RESPONSE_STATUS

        public static final String HEADER_COMMAND_RESPONSE_STATUS
        The header name defined for setting the status code of a device respond to a command that was previously received by the device.
        See Also:
        Constant Field Values
    • Method Detail

      • getClientPrincipal

        public static HonoUser getClientPrincipal​(org.apache.qpid.proton.engine.Record record)
        Gets the principal representing an authenticated peer.
        Parameters:
        record - The attachments to retrieve the principal from.
        Returns:
        The principal representing the authenticated client or PRINCIPAL_ANONYMOUS if the client has not been authenticated or record is null.
      • getClientPrincipal

        public static HonoUser getClientPrincipal​(io.vertx.proton.ProtonConnection con)
        Gets the principal representing a connection's client.
        Parameters:
        con - The connection to get the principal for.
        Returns:
        The principal representing the authenticated client or PRINCIPAL_ANONYMOUS if the client has not been authenticated.
        Throws:
        NullPointerException - if the connection is null.
      • setClientPrincipal

        public static void setClientPrincipal​(io.vertx.proton.ProtonConnection con,
                                              HonoUser principal)
        Gets the principal representing a connection's client.
        Parameters:
        con - The connection to get the principal for.
        principal - The principal representing the authenticated client.
        Throws:
        NullPointerException - if any of the parameters is null.
      • copyProperties

        public static void copyProperties​(io.vertx.proton.ProtonConnection source,
                                          io.vertx.proton.ProtonLink<?> target)
        Copies properties from a connection's attachments to a link's attachments.

        The properties copied are

        Parameters:
        source - The connection.
        target - The link.
      • getConnectionId

        public static String getConnectionId​(io.vertx.proton.ProtonLink<?> link)
        Gets the (surrogate) identifier of the AMQP connection that a link is part of.
        Parameters:
        link - The link to determine the connection id for.
        Returns:
        The identifier retrieved from the link's attachment using key KEY_CONNECTION_ID or null if the attachments do not contain a value for that a key.
      • getConnectionId

        public static String getConnectionId​(io.vertx.proton.ProtonConnection connection)
        Gets the (surrogate) identifier of an AMQP connection.
        Parameters:
        connection - The connection to determine the connection id for.
        Returns:
        The identifier retrieved from the connection's attachments using key KEY_CONNECTION_ID or null if the attachments do not contain a value for that a key.
      • setConnectionId

        public static void setConnectionId​(io.vertx.proton.ProtonConnection connection,
                                           String id)
        Sets the (surrogate) identifier of an AMQP connection.

        The identifier will be added to the connection's attachments under key KEY_CONNECTION_ID.

        Parameters:
        connection - The connection to set id for.
        id - The identifier to set.
        Throws:
        NullPointerException - if any of the parameters is null.
      • isDefaultTenant

        public static boolean isDefaultTenant​(String tenantId)
        Checks if a given tenant identifier is the DEFAULT_TENANT.
        Parameters:
        tenantId - The identifier to check.
        Returns:
        true if the given identifier is equal to DEFAULT_TENANT.