PlatformMessagepublic class PlatformMessage extends Object
Fields Summary |
---|
private final String | messageID | private final String | listenerID | private final String | operationID | private final Map | parameters | private final long | fireBeforeDate | private final long | messageCreatedOn | private long | lSequenceNo |
Constructors Summary |
---|
public PlatformMessage(String messageID, String listenerID, String operationID, Map parameters, long maxDelayMS)
this.messageID = messageID;
this.listenerID = listenerID;
this.operationID = operationID;
this.parameters = JSONUtils.encodeToJSONObject(parameters);
messageCreatedOn = SystemTime.getCurrentTime();
fireBeforeDate = messageCreatedOn + maxDelayMS;
| public PlatformMessage(String messageID, String listenerID, String operationID, Object[] parameters, long maxDelayMS)
this.messageID = messageID;
this.listenerID = listenerID;
this.operationID = operationID;
this.parameters = JSONUtils.encodeToJSONObject(parseParams(parameters));
messageCreatedOn = SystemTime.getCurrentTime();
fireBeforeDate = messageCreatedOn + maxDelayMS;
|
Methods Summary |
---|
public long | getFireBefore()
return fireBeforeDate;
| public java.lang.String | getListenerID()
return listenerID;
| public long | getMessageCreated()
return messageCreatedOn;
| public java.lang.String | getMessageID()
return messageID;
| public java.lang.String | getOperationID()
return operationID;
| public java.util.Map | getParameters()
return parameters;
| protected long | getSequenceNo()
return lSequenceNo;
| public static java.util.Map | parseParams(java.lang.Object[] parameters)
Map result = new HashMap();
for (int i = 0; i < parameters.length - 1; i += 2) {
try {
if (parameters[i] instanceof String) {
if (parameters[i + 1] instanceof String[]) {
List list = Arrays.asList((String[]) parameters[i + 1]);
result.put((String) parameters[i], list);
} else if (parameters[i + 1] instanceof Object[]) {
result.put((String) parameters[i],
parseParams((Object[]) parameters[i + 1]));
} else if (parameters[i + 1] instanceof Map) {
result.put((String) parameters[i], (Map) parameters[i + 1]);
} else {
result.put((String) parameters[i], parameters[i + 1]);
}
}
} catch (Exception e) {
Debug.out("making JSONObject out of parsedParams", e);
}
}
return result;
| protected void | setSequenceNo(long sequenceNo)
lSequenceNo = sequenceNo;
| public java.lang.String | toString()
return "PlaformMessage {" + lSequenceNo + ", " + messageID + ", "
+ listenerID + ", " + operationID + ","
+ parameters + "}";
|
|