FileDocCategorySizeDatePackage
PlatformMessage.javaAPI DocAzureus 3.0.3.43857Mon Jun 04 17:50:14 BST 2007com.aelitis.azureus.core.messenger

PlatformMessage

public class PlatformMessage extends Object
author
TuxPaper
created
Sep 25, 2006

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)

param
messageID
param
listenerID
param
operationID
param
parameters
param
maxDelay


	          	 
	    
			      

		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 longgetFireBefore()

		return fireBeforeDate;
	
public java.lang.StringgetListenerID()

		return listenerID;
	
public longgetMessageCreated()

		return messageCreatedOn;
	
public java.lang.StringgetMessageID()

		return messageID;
	
public java.lang.StringgetOperationID()

		return operationID;
	
public java.util.MapgetParameters()

		return parameters;
	
protected longgetSequenceNo()

		return lSequenceNo;
	
public static java.util.MapparseParams(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 voidsetSequenceNo(long sequenceNo)

		lSequenceNo = sequenceNo;
	
public java.lang.StringtoString()

		return "PlaformMessage {" + lSequenceNo + ", " + messageID + ", "
				+ listenerID + ", " + operationID + ","
				+ parameters + "}";