in core/src/main/java/flex/messaging/config/ServerConfigurationParser.java [1017:1091]
private void destination(Node dest, ServiceSettings serviceSettings) {
// Validation
requiredAttributesOrElements(dest, DESTINATION_REQ_CHILDREN);
allowedAttributes(dest, DESTINATION_ATTR);
allowedChildElements(dest, DESTINATION_CHILDREN);
String serviceId = serviceSettings.getId();
DestinationSettings destinationSettings;
String id = getAttributeOrChildElement(dest, ID_ATTR);
if (isValidID(id)) {
destinationSettings = (DestinationSettings) serviceSettings.getDestinationSettings().get(id);
if (destinationSettings != null) {
// Duplicate destination definition '{id}' in service '{serviceId}'.
ConfigurationException e = new ConfigurationException();
e.setMessage(DUPLICATE_DESTINATION_ERROR, new Object[]{id, serviceId});
throw e;
}
destinationSettings = new DestinationSettings(id);
destinationSettings.setSourceFile(getSourceFileOf(dest));
serviceSettings.addDestinationSettings(destinationSettings);
} else {
//Invalid {DESTINATION_ELEMENT} id '{id}' for service '{serviceId}'.
ConfigurationException ex = new ConfigurationException();
ex.setMessage(INVALID_ID_IN_SERVICE, new Object[]{DESTINATION_ELEMENT, id, serviceId});
throw ex;
}
// Destination Properties
NodeList properties = selectNodeList(dest, PROPERTIES_ELEMENT + "/*");
if (properties.getLength() > 0) {
ConfigMap map = properties(properties, getSourceFileOf(dest));
destinationSettings.addProperties(map);
// Sniff for <network><reliable>true|false</reliable></network> setting.
// Also sniff for inbound and outbound throttle policies of buffer and conflate.
// All these features are only supported when advanced messaging support is enabled.
if (!verifyAdvancedMessagingSupport) {
ConfigMap networkSettings = map.getPropertyAsMap(NetworkSettings.NETWORK_ELEMENT, null);
if (networkSettings != null) {
String reliable = networkSettings.getPropertyAsString(NetworkSettings.RELIABLE_ELEMENT, null);
if (reliable != null && Boolean.valueOf(reliable)) {
verifyAdvancedMessagingSupport = true;
} else {
ConfigMap inbound = networkSettings.getPropertyAsMap(ThrottleSettings.ELEMENT_INBOUND, null);
if (inbound != null) {
String policy = inbound.getPropertyAsString(ThrottleSettings.ELEMENT_POLICY, null);
if (policy != null && (Policy.BUFFER.toString().equalsIgnoreCase(policy)
|| Policy.CONFLATE.toString().equalsIgnoreCase(policy)))
verifyAdvancedMessagingSupport = true;
}
if (!verifyAdvancedMessagingSupport) {
ConfigMap outbound = networkSettings.getPropertyAsMap(ThrottleSettings.ELEMENT_OUTBOUND, null);
if (outbound != null) {
String policy = outbound.getPropertyAsString(ThrottleSettings.ELEMENT_POLICY, null);
if (policy != null && (Policy.BUFFER.toString().equalsIgnoreCase(policy)
|| Policy.CONFLATE.toString().equalsIgnoreCase(policy)))
verifyAdvancedMessagingSupport = true;
}
}
}
}
}
}
// Channels
destinationChannels(dest, destinationSettings, serviceSettings);
// Security
destinationSecurity(dest, destinationSettings, serviceSettings);
// Service Adapter
destinationAdapter(dest, destinationSettings, serviceSettings);
}