Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 24fceff62a932e5f0851265723aad1306481f82d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package org.eclipse.om2m.binding.mqtt.util;

import java.util.regex.Pattern;

import org.eclipse.om2m.commons.constants.Constants;

/**
 * A set of MQTT constants retrieved from the System.getProperty method.
 *
 */
public final class MqttConstants {
	
	private MqttConstants(){}

	/** Hostname of the main broker */
	public static final String MQTT_BROKER_HOSTNAME = System.getProperty("org.eclipse.om2m.mqtt.ip", "127.0.0.1");
	
	/** IP of the main broker */
	public static final int MQTT_BROKER_PORT = Integer.valueOf(System.getProperty("org.eclipse.om2m.mqtt.port", "1883"));
	
	/** Username to connect to broker */
	public static final String MQTT_BROKER_USERNAME = System.getProperty("org.eclipse.om2m.mqtt.username");
	
	/** Password to connect to broker */
	public static final String MQTT_BROKER_PASSWORD = System.getProperty("org.eclipse.om2m.mqtt.password");
	
	/** MQTT Protocol prefix */
	public static final String PROTOCOL = "mqtt";
	
	/** Size of the request sender queue */
	public static final int MQTT_QUEUE_SENDER_SIZE = Integer.valueOf(System.getProperty("org.eclipse.om2m.mqtt.queue.size", "8"));
	
	/** Request pattern to parse the request topic on message reception */
	public static final Pattern REQUEST_PATTERN_IN = Pattern.compile("/oneM2M/req/([^/]+)/" + Constants.CSE_ID + "/(.*)");
	
	/** Request pattern when sending a message. */
	public static final Pattern REQUEST_PATTERN_OUT = Pattern.compile("/oneM2M/req/" + Constants.CSE_ID+ "/([^/]+)+/(.*)");
	
	/** Time out duration when waiting for a response. Unit in second. */ 
	public static final long TIME_OUT_DURATION = Long.valueOf(System.getProperty("org.eclipse.om2m.mqtt.timeout", "20"));
	
	/** MQTT format for XML in topic */
	public static final String MQTT_XML = "xml";
	
	/** MQTT format for JSON in topic */
	public static final String MQTT_JSON = "json";
	
}

Back to the top