new QName(SynapseConstants.SYNAPSE_NAMESPACE, "recipientlist"));
if(recipientListElement != null){
//create endpoint
RecipientListEndpoint recipientListEndpoint = new RecipientListEndpoint();
// set endpoint name
OMAttribute name = epConfig.getAttribute(new QName(
org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE, "name"));
if (name != null) {
recipientListEndpoint.setName(name.getAttributeValue());
}
// set endpoints or members
if (recipientListElement.
getFirstChildWithName(XMLConfigConstants.ENDPOINT_ELT) != null) {
if (recipientListElement.getChildrenWithName((MEMBER)).hasNext()) {
String msg = "Invalid Synapse configuration. child elements";
log.error(msg);
throw new SynapseException(msg);
}
List<Endpoint> endpoints = getEndpoints(recipientListElement,
recipientListEndpoint, properties);
recipientListEndpoint.setChildren(endpoints);
} else if (recipientListElement.getFirstChildWithName(MEMBER) != null) {
if(recipientListElement.
getChildrenWithName((XMLConfigConstants.ENDPOINT_ELT)).hasNext()){
String msg =
"Invalid Synapse configuration. " +
"recipientListElement element cannot have both member & endpoint " +
"child elements";
log.error(msg);
throw new SynapseException(msg);
}
List<Member> members = getMembers(recipientListElement);
recipientListEndpoint.setMembers(members);
} else if (recipientListElement.getFirstChildWithName(DYNAMIC_SET) != null) {
OMElement dynamicSetElement = recipientListElement.getFirstChildWithName(DYNAMIC_SET);
Value dynamicEndpointSet = new ValueFactory().createValue("value", dynamicSetElement);
String maxCacheStr = dynamicSetElement.getAttributeValue(new QName("max-cache"));
int maxCache = RecipientListEndpoint.DEFAULT_MAX_POOL ;
if (maxCacheStr != null) {
maxCache = Integer.parseInt(maxCacheStr);
}
recipientListEndpoint = new RecipientListEndpoint(maxCache);
if (name != null) {
recipientListEndpoint.setName(name.getAttributeValue());
}
recipientListEndpoint.setDynamicEndpointSet(dynamicEndpointSet);
}
if (recipientListEndpoint.getChildren() == null &&
recipientListEndpoint.getMembers() == null &&
recipientListEndpoint.getDynamicEndpointSet() == null) {
String msg = "A RecipientListEndpoint must have child/member elements, but the " +
"RecipientListEndpoint " + "'" + recipientListEndpoint.getName() + "' " +
"does not have any child/member/dynamic endpoint elements.";
log.error(msg);
throw new SynapseException(msg);
}