@Override
protected OMElement serializeEndpoint(Endpoint endpoint) {
if (!(endpoint instanceof HTTPEndpoint)) {
handleException("Invalid endpoint type.");
}
fac = OMAbstractFactory.getOMFactory();
OMElement endpointElement
= fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE);
HTTPEndpoint httpEndpoint = (HTTPEndpoint) endpoint;
EndpointDefinition epDefinitionHttp = httpEndpoint.getDefinition();
OMElement httpEPElement = serializeEndpointDefinition(epDefinitionHttp);
if (httpEndpoint.getHttpMethod() != null) {
httpEPElement.addAttribute(
fac.createOMAttribute("method", null, httpEndpoint.getHttpMethod()));
}
if (httpEndpoint.getUriTemplate() != null) {
if (httpEndpoint.isLegacySupport()) {
httpEPElement.addAttribute(
fac.createOMAttribute("uri-template", null, HTTPEndpoint.legacyPrefix + httpEndpoint.getUriTemplate().getTemplate()));
} else {
httpEPElement.addAttribute(
fac.createOMAttribute("uri-template", null, httpEndpoint.getUriTemplate().getTemplate()));
}
}
endpointElement.addChild(httpEPElement);
serializeProperties(httpEndpoint, endpointElement);
serializeCommonAttributes(endpoint, endpointElement);
return endpointElement;
}