fac = OMAbstractFactory.getOMFactory();
OMElement endpointElement
= fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE);
LoadbalanceEndpoint loadbalanceEndpoint = (LoadbalanceEndpoint) endpoint;
String name = loadbalanceEndpoint.getName();
if (name != null) {
endpointElement.addAttribute("name", name, null);
}
OMElement loadbalanceElement
= fac.createOMElement("loadbalance", SynapseConstants.SYNAPSE_OMNAMESPACE);
endpointElement.addChild(loadbalanceElement);
LoadbalanceAlgorithm algorithm = loadbalanceEndpoint.getAlgorithm();
String algorithmName = "roundRobin";
if (algorithm instanceof RoundRobin) {
algorithmName = "roundRobin";
}
loadbalanceElement.addAttribute(XMLConfigConstants.ALGORITHM_NAME, algorithmName, null);
// set if failover is turned off in the endpoint
if (!loadbalanceEndpoint.isFailover()) {
loadbalanceElement.addAttribute("failover", "false", null);
}
for (Endpoint childEndpoint : loadbalanceEndpoint.getEndpoints()) {
loadbalanceElement.addChild(EndpointSerializer.getElementFromEndpoint(childEndpoint));
}
return endpointElement;
}