本文整理匯總了Java中org.red5.compatibility.flex.messaging.messages.Constants類的典型用法代碼示例。如果您正苦於以下問題:Java Constants類的具體用法?Java Constants怎麽用?Java Constants使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Constants類屬於org.red5.compatibility.flex.messaging.messages包,在下文中一共展示了Constants類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: evaluateDataUpdate
import org.red5.compatibility.flex.messaging.messages.Constants; //導入依賴的package包/類
/**
* Evaluate update requests sent by a client.
*
* @param msg
* @param event
*/
@SuppressWarnings("unchecked")
private void evaluateDataUpdate(DataMessage msg, DataMessage event) {
switch (event.operation) {
case Constants.DATA_OPERATION_UPDATE_ATTRIBUTES:
List<Object> contents = (List<Object>) event.body;
@SuppressWarnings("unused")
List<String> attributeNames = (List<String>) contents.get(0);
@SuppressWarnings("unused")
Map<String, Object> oldValues = (Map<String, Object>) contents.get(1);
@SuppressWarnings("unused")
Map<String, Object> newValues = (Map<String, Object>) contents.get(2);
/*
// Commented out as it triggeres a crash in the compiler on Java 1.5
for (@SuppressWarnings("unused") String name: attributeNames) {
// TODO: store attribute change for registered clients
}
*/
break;
default:
log.error("Unknown data update request: {}", event);
}
}
示例2: evaluateDataUpdate
import org.red5.compatibility.flex.messaging.messages.Constants; //導入依賴的package包/類
/**
* Evaluate update requests sent by a client.
*
* @param msg
* @param event
*/
@SuppressWarnings("unchecked")
private void evaluateDataUpdate(DataMessage msg, DataMessage event) {
switch (event.operation) {
case Constants.DATA_OPERATION_UPDATE_ATTRIBUTES:
List<Object> contents = (List<Object>) event.body;
@SuppressWarnings("unused")
List<String> attributeNames = (List<String>) contents.get(0);
@SuppressWarnings("unused")
Map<String, Object> oldValues = (Map<String, Object>) contents.get(1);
@SuppressWarnings("unused")
Map<String, Object> newValues = (Map<String, Object>) contents.get(2);
/*
// Commented out as it triggeres a crash in the compiler on Java 1.5
for (@SuppressWarnings("unused") String name: attributeNames) {
// TODO: store attribute change for registered clients
}
*/
break;
default:
log.error("Unknown data update request: {}", event);
}
}
示例3: handleRequest
import org.red5.compatibility.flex.messaging.messages.Constants; //導入依賴的package包/類
/**
* Handle messages related to shared objects.
*
* @param msg
* message
* @return async message
*/
@SuppressWarnings("unchecked")
public AsyncMessage handleRequest(DataMessage msg) {
log.debug("Handle DataMessage request");
log.trace("{}", msg);
setClientId(msg);
SequencedMessage result = new SequencedMessage();
result.clientId = msg.clientId;
result.destination = msg.destination;
result.correlationId = msg.messageId;
switch (msg.operation) {
case Constants.DATA_OPERATION_SET:
result.body = new Object[] { msg.body };
result.sequenceId = 0;
result.sequenceSize = 1;
// TODO: store initial version of object
break;
case Constants.DATA_OPERATION_UPDATE:
for (DataMessage event : (List<DataMessage>) msg.body) {
evaluateDataUpdate(msg, event);
}
AcknowledgeMessage res = new AcknowledgeMessage();
res.clientId = msg.clientId;
res.destination = msg.destination;
res.correlationId = msg.messageId;
res.body = msg.body;
return res;
default:
log.error("Unknown DataMessage request: {}", msg);
String errMsg = String.format("Don't know how to handle %s", msg);
return returnError(msg, "notImplemented", errMsg, errMsg);
}
return result;
}
示例4: handleRequest
import org.red5.compatibility.flex.messaging.messages.Constants; //導入依賴的package包/類
/**
* Handle messages related to shared objects.
*
* @param msg message
* @return async message
*/
@SuppressWarnings("unchecked")
public AsyncMessage handleRequest(DataMessage msg) {
log.debug("Handle DataMessage request");
log.trace("{}", msg);
setClientId(msg);
SequencedMessage result = new SequencedMessage();
result.clientId = msg.clientId;
result.destination = msg.destination;
result.correlationId = msg.messageId;
switch (msg.operation) {
case Constants.DATA_OPERATION_SET:
result.body = new Object[] { msg.body };
result.sequenceId = 0;
result.sequenceSize = 1;
// TODO: store initial version of object
break;
case Constants.DATA_OPERATION_UPDATE:
for (DataMessage event : (List<DataMessage>) msg.body) {
evaluateDataUpdate(msg, event);
}
AcknowledgeMessage res = new AcknowledgeMessage();
res.clientId = msg.clientId;
res.destination = msg.destination;
res.correlationId = msg.messageId;
res.body = msg.body;
return res;
default:
log.error("Unknown DataMessage request: {}", msg);
String errMsg = String.format("Don't know how to handle %s", msg);
return returnError(msg, "notImplemented", errMsg, errMsg);
}
return result;
}