}
protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint) {
// create the endpoint, manager and the algorithms
SALoadbalanceEndpoint loadbalanceEndpoint = new SALoadbalanceEndpoint();
// get the session for this endpoint
OMElement sessionElement = epConfig.
getFirstChildWithName(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "session"));
if (sessionElement != null) {
String type = sessionElement.getAttributeValue(new QName("type"));
if (type.equalsIgnoreCase("soap")) {
Dispatcher soapDispatcher = new SoapSessionDispatcher();
loadbalanceEndpoint.setDispatcher(soapDispatcher);
} else if (type.equalsIgnoreCase("http")) {
Dispatcher httpDispatcher = new HttpSessionDispatcher();
loadbalanceEndpoint.setDispatcher(httpDispatcher);
} else if (type.equalsIgnoreCase("simpleClientSession")) {
Dispatcher csDispatcher = new SimpleClientSessionDispatcher();
loadbalanceEndpoint.setDispatcher(csDispatcher);
}
} else {
handleException("Session affinity endpoints should " +
"have a session element in the configuration.");
}
// set endpoint name
OMAttribute name = epConfig.getAttribute(new QName(
org.apache.synapse.config.xml.XMLConfigConstants.NULL_NAMESPACE, "name"));
if (name != null) {
loadbalanceEndpoint.setName(name.getAttributeValue());
}
OMElement loadbalanceElement;
loadbalanceElement = epConfig.getFirstChildWithName
(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "loadbalance"));
if(loadbalanceElement != null) {
// set endpoints
ArrayList<Endpoint> endpoints = getEndpoints(loadbalanceElement, loadbalanceEndpoint);
loadbalanceEndpoint.setEndpoints(endpoints);
// set load balance algorithm
LoadbalanceAlgorithm algorithm = LoadbalanceAlgorithmFactory.
createLoadbalanceAlgorithm(loadbalanceElement, endpoints);
loadbalanceEndpoint.setAlgorithm(algorithm);
// set abandon time
//long abandonTime = 0;
//OMAttribute atAttribute = loadbalanceElement.getAttribute(new QName(
// null, org.apache.synapse.config.xml.Constants.RETRY_AFTER_FAILURE_TIME));