Package org.eclipse.hono.util
Class RequestResponseApiConstants
- java.lang.Object
-
- org.eclipse.hono.util.RequestResponseApiConstants
-
- Direct Known Subclasses:
CredentialsConstants
,DeviceConnectionConstants
,RegistrationConstants
,RegistryManagementConstants
,TenantConstants
public abstract class RequestResponseApiConstants extends Object
Constants & utility methods that are common to APIs that follow the request response pattern.
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONTENT_TYPE_APPLICATION_JSON
The MIME type representing the String representation of a JSON Object.static String
FIELD_ENABLED
The name of the field that contains a boolean indicating the status of an entity.static String
FIELD_ERROR
The name of the field that contains additional information about an error that has occurred while processing a request message.static String
FIELD_OBJECT_ID
The name of the field that contains the identifier of the object.static String
FIELD_PAYLOAD
The name of the field that contains the payload of a request or response message.static String
FIELD_PAYLOAD_DEFAULTS
The name of the property which contains default properties that protocol adapters should add to messages published by a device.static String
FIELD_PAYLOAD_DEVICE_ID
The name of the property that contains the identifier of a device.static String
FIELD_PAYLOAD_SUBJECT_DN
The name of the property that contains the subject DN of the CA certificate that has been configured for a tenant.static String
FIELD_PAYLOAD_TENANT_ID
The name of the property that contains the identifier of a tenant.
-
Constructor Summary
Constructors Modifier Constructor Description protected
RequestResponseApiConstants()
Empty default constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.qpid.proton.message.Message
getAmqpReply(String endpoint, String tenantId, org.apache.qpid.proton.message.Message request, RequestResponseResult<io.vertx.core.json.JsonObject> result)
Creates an AMQP message from a result to a service invocation.static org.apache.qpid.proton.message.Message
getAmqpReply(String endpoint, EventBusMessage response)
Creates an AMQP message from a response to a service invocation.static org.apache.qpid.proton.message.Message
getErrorMessage(int status, String errorDescription, org.apache.qpid.proton.message.Message requestMessage)
Creates an AMQP (response) message for conveying an erroneous outcome of an operation.
-
-
-
Field Detail
-
CONTENT_TYPE_APPLICATION_JSON
public static final String CONTENT_TYPE_APPLICATION_JSON
The MIME type representing the String representation of a JSON Object.- See Also:
- Constant Field Values
-
FIELD_PAYLOAD_DEFAULTS
public static final String FIELD_PAYLOAD_DEFAULTS
The name of the property which contains default properties that protocol adapters should add to messages published by a device.- See Also:
- Constant Field Values
-
FIELD_PAYLOAD_DEVICE_ID
public static final String FIELD_PAYLOAD_DEVICE_ID
The name of the property that contains the identifier of a device.- See Also:
- Constant Field Values
-
FIELD_PAYLOAD_SUBJECT_DN
public static final String FIELD_PAYLOAD_SUBJECT_DN
The name of the property that contains the subject DN of the CA certificate that has been configured for a tenant. The subject DN is serialized as defined by RFC 2253, Section 2.- See Also:
- Constant Field Values
-
FIELD_PAYLOAD_TENANT_ID
public static final String FIELD_PAYLOAD_TENANT_ID
The name of the property that contains the identifier of a tenant.- See Also:
- Constant Field Values
-
FIELD_ENABLED
public static final String FIELD_ENABLED
The name of the field that contains a boolean indicating the status of an entity.- See Also:
- Constant Field Values
-
FIELD_ERROR
public static final String FIELD_ERROR
The name of the field that contains additional information about an error that has occurred while processing a request message.- See Also:
- Constant Field Values
-
FIELD_PAYLOAD
public static final String FIELD_PAYLOAD
The name of the field that contains the payload of a request or response message.- See Also:
- Constant Field Values
-
FIELD_OBJECT_ID
public static final String FIELD_OBJECT_ID
The name of the field that contains the identifier of the object.- See Also:
- Constant Field Values
-
-
Method Detail
-
getAmqpReply
public static final org.apache.qpid.proton.message.Message getAmqpReply(String endpoint, EventBusMessage response)
Creates an AMQP message from a response to a service invocation.- Parameters:
endpoint
- The service endpoint that the operation has been invoked on.response
- The response message.- Returns:
- The AMQP message.
- Throws:
NullPointerException
- if endpoint isnull
.IllegalArgumentException
- if the response does not contain a correlation ID.
-
getAmqpReply
public static final org.apache.qpid.proton.message.Message getAmqpReply(String endpoint, String tenantId, org.apache.qpid.proton.message.Message request, RequestResponseResult<io.vertx.core.json.JsonObject> result)
Creates an AMQP message from a result to a service invocation.- Parameters:
endpoint
- The service endpoint that the operation has been invoked on.tenantId
- The id of the tenant (may benull
).request
- The request message.result
- The result message.- Returns:
- The AMQP message.
- Throws:
NullPointerException
- if endpoint, request or result isnull
.IllegalArgumentException
- if the result does not contain a correlation ID.
-
getErrorMessage
public static final org.apache.qpid.proton.message.Message getErrorMessage(int status, String errorDescription, org.apache.qpid.proton.message.Message requestMessage)
Creates an AMQP (response) message for conveying an erroneous outcome of an operation.- Parameters:
status
- The status code.errorDescription
- An (optional) error description which will be put to a Data section.requestMessage
- The request message.- Returns:
- The response message.
-
-