OMAttribute force = elem.getAttribute(new QName(
Constants.NULL_NAMESPACE, "force"));
OMAttribute optimize = elem.getAttribute(new QName(
Constants.NULL_NAMESPACE, "optimize"));
Endpoint endpoint = new Endpoint();
if (!anonymousEndpoint) {
if (name == null) {
handleException("The 'name' attribute is required for a named endpoint definition");
} else {
endpoint.setName(name.getAttributeValue());
}
if (address != null) {
endpoint.setAddress(address.getAttributeValue());
} else {
// right now an address is *required*
handleException("The 'address' attribute is required for an endpoint");
}
} else {
OMAttribute reference = elem.getAttribute(new QName(
Constants.NULL_NAMESPACE, "ref"));
if (reference != null) {
endpoint.setRef(reference.getAttributeValue());
} else if (address != null) {
endpoint.setAddress(address.getAttributeValue());
} else {
handleException("One of the 'address' or 'ref' attributes are required in an "
+ "anonymous endpoint");
}
}
if (force != null)
{
String forceValue = force.getAttributeValue().trim().toLowerCase();
if (forceValue.equals("pox")) {
endpoint.setForcePOX(true);
} else if (forceValue.equals("soap")) {
endpoint.setForceSOAP(true);
} else {
handleException("force value -\""+forceValue+"\" not yet implemented");
}
}
if (optimize != null && optimize.getAttributeValue().length() > 0) {
String method = optimize.getAttributeValue().trim();
if ("mtom".equalsIgnoreCase(method)) {
endpoint.setUseMTOM(true);
} else if ("swa".equalsIgnoreCase(method)) {
endpoint.setUseSwa(true);
}
}
OMElement wsAddr = elem.getFirstChildWithName(new QName(
Constants.SYNAPSE_NAMESPACE, "enableAddressing"));
if (wsAddr != null) {
endpoint.setAddressingOn(true);
String useSepList = wsAddr.getAttributeValue(new QName(
"separateListener"));
if (useSepList != null) {
if (useSepList.trim().toLowerCase().startsWith("tr")
|| useSepList.trim().startsWith("1")) {
endpoint.setUseSeparateListener(true);
}
}
}
OMElement wsSec = elem.getFirstChildWithName(new QName(
Constants.SYNAPSE_NAMESPACE, "enableSec"));
if (wsSec != null) {
endpoint.setSecurityOn(true);
OMAttribute policy = wsSec.getAttribute(new QName(
Constants.NULL_NAMESPACE, "policy"));
if (policy != null) {
endpoint.setWsSecPolicyKey(policy.getAttributeValue());
}
}
OMElement wsRm = elem.getFirstChildWithName(new QName(
Constants.SYNAPSE_NAMESPACE, "enableRM"));
if (wsRm != null) {
endpoint.setReliableMessagingOn(true);
OMAttribute policy = wsRm.getAttribute(new QName(
Constants.NULL_NAMESPACE, "policy"));
if (policy != null) {
endpoint.setWsRMPolicyKey(policy.getAttributeValue());
}
}
return endpoint;
// }