Skip to content

Commit

Permalink
Provide JSON payload field names in central Constants class.
Browse files Browse the repository at this point in the history
Previously this was only available to request response APIs, in the
future these fields will be present in notifications that are evaluated
in northbound applications, so a central place to define them seems to
be more appropriate.

Signed-off-by: Karsten Frank <Karsten.Frank@bosch-si.com>
  • Loading branch information
sysexcontrol committed Apr 10, 2018
1 parent 8d4a53a commit bc6cd9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions core/src/main/java/org/eclipse/hono/util/Constants.java
Expand Up @@ -121,6 +121,16 @@ public final class Constants {
*/
public static final String SUBJECT_ANONYMOUS = "ANONYMOUS";

/**
* The field name of JSON payloads containing a tenant ID.
*/
public static final String JSON_FIELD_TENANT_ID = "tenant-id";

/**
* The field name of JSON payloads containing a device ID.
*/
public static final String JSON_FIELD_DEVICE_ID = "device-id";

/**
* The principal to use for anonymous clients.
*/
Expand Down
Expand Up @@ -36,8 +36,8 @@ public abstract class RequestResponseApiConstants {
public static final String CONTENT_TYPE_APPLICATION_JSON = "application/json";

/* message payload fields */
public static final String FIELD_PAYLOAD_DEVICE_ID = "device-id";
public static final String FIELD_PAYLOAD_TENANT_ID = "tenant-id";
public static final String FIELD_PAYLOAD_DEVICE_ID = Constants.JSON_FIELD_DEVICE_ID;
public static final String FIELD_PAYLOAD_TENANT_ID = Constants.JSON_FIELD_TENANT_ID;

public static final String FIELD_ENABLED = "enabled";
public static final String FIELD_ERROR = "error";
Expand Down

0 comments on commit bc6cd9b

Please sign in to comment.