* @return the created endpoint definition
*/
public EndpointDefinition createDefinition(OMElement elem) {
EndpointDefinition definition = new EndpointDefinition();
OMAttribute optimize
= elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "optimize"));
OMAttribute encoding
= elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "encoding"));
OMAttribute trace = elem.getAttribute(new QName(
XMLConfigConstants.NULL_NAMESPACE, XMLConfigConstants.TRACE_ATTRIB_NAME));
if (trace != null && trace.getAttributeValue() != null) {
String traceValue = trace.getAttributeValue();
if (XMLConfigConstants.TRACE_ENABLE.equals(traceValue)) {
definition.setTraceState(SynapseConstants.TRACING_ON);
} else if (XMLConfigConstants.TRACE_DISABLE.equals(traceValue)) {
definition.setTraceState(SynapseConstants.TRACING_OFF);
}
} else {
definition.setTraceState(SynapseConstants.TRACING_UNSET);
}
if (optimize != null && optimize.getAttributeValue().length() > 0) {
String method = optimize.getAttributeValue().trim();
if ("mtom".equalsIgnoreCase(method)) {
definition.setUseMTOM(true);
} else if ("swa".equalsIgnoreCase(method)) {
definition.setUseSwa(true);
}
}
if (encoding != null && encoding.getAttributeValue() != null) {
definition.setCharSetEncoding(encoding.getAttributeValue());
}
OMElement wsAddr = elem.getFirstChildWithName(
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "enableAddressing"));
if (wsAddr != null) {
definition.setAddressingOn(true);
OMAttribute version = wsAddr.getAttribute(new QName("version"));
if (version != null && version.getAttributeValue() != null) {
String versionValue = version.getAttributeValue().trim().toLowerCase();
if (SynapseConstants.ADDRESSING_VERSION_FINAL.equals(versionValue) ||
SynapseConstants.ADDRESSING_VERSION_SUBMISSION.equals(versionValue)) {
definition.setAddressingVersion(version.getAttributeValue());
} else {
handleException("Unknown value for the addressing version. Possible values " +
"for the addressing version are 'final' and 'submission' only.");
}
}
String useSepList = wsAddr.getAttributeValue(new QName("separateListener"));
if (useSepList != null) {
if ("true".equals(useSepList.trim().toLowerCase())) {
definition.setUseSeparateListener(true);
}
}
}
OMElement wsSec = elem.getFirstChildWithName(
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "enableSec"));
if (wsSec != null) {
definition.setSecurityOn(true);
OMAttribute policyKey = wsSec.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, "policy"));
OMAttribute inboundPolicyKey = wsSec.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, "inboundPolicy"));
OMAttribute outboundPolicyKey = wsSec.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, "outboundPolicy"));
if (policyKey != null && policyKey.getAttributeValue() != null) {
definition.setWsSecPolicyKey(policyKey.getAttributeValue());
} else {
if (inboundPolicyKey != null && inboundPolicyKey.getAttributeValue() != null) {
definition.setInboundWsSecPolicyKey(inboundPolicyKey.getAttributeValue());
}
if (outboundPolicyKey != null && outboundPolicyKey.getAttributeValue() != null) {
definition.setOutboundWsSecPolicyKey(outboundPolicyKey.getAttributeValue());
}
}
}
OMElement wsRm = elem.getFirstChildWithName(
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "enableRM"));
if (wsRm != null) {
definition.setReliableMessagingOn(true);
OMAttribute policy
= wsRm.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "policy"));
if (policy != null) {
definition.setWsRMPolicyKey(policy.getAttributeValue());
}
}
// set the timeout configuration
OMElement timeout = elem.getFirstChildWithName(