Class EndpointFactory
- java.lang.Object
-
- org.apache.synapse.config.xml.endpoints.EndpointFactory
-
- All Implemented Interfaces:
XMLToObjectMapper
- Direct Known Subclasses:
ClassEndpointFactory
,DefaultEndpointFactory
,DynamicLoadbalanceEndpointFactory
,FailoverEndpointFactory
,IndirectEndpointFactory
,LoadbalanceEndpointFactory
,RecipientListEndpointFactory
,ResolvingEndpointFactory
,SALoadbalanceEndpointFactory
,ServiceDynamicLoadbalanceEndpointFactory
,TemplateEndpointFactory
public abstract class EndpointFactory extends Object implements XMLToObjectMapper
All endpoint factories should extend from this abstract class. Use EndpointFactory to obtain the correct endpoint for particular endpoint configuration. As endpoints can be nested inside each other, EndpointFactory implementations may call other EndpointFactory implementations recursively to obtain the required endpoint hierarchy. This also serves as theXMLToObjectMapper
implementation for specific endpoint implementations. If the endpoint type is not known useXMLToEndpointMapper
as the genericXMLToObjectMapper
for all endpoints.
-
-
Field Summary
Fields Modifier and Type Field Description static QName
ON_FAULT_Q
-
Constructor Summary
Constructors Modifier Constructor Description protected
EndpointFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Endpoint
createEndpoint(org.apache.axiom.om.OMElement epConfig, boolean anonymousEndpoint, Properties properties)
Creates the Endpoint implementation for the given XML endpoint configuration.protected void
extractSpecificEndpointProperties(EndpointDefinition definition, org.apache.axiom.om.OMElement elem)
DefinitionFactory
getEndpointDefinitionFactory()
return current factory for building this endpoint definitionstatic Endpoint
getEndpointFromElement(org.apache.axiom.om.OMElement elem, boolean isAnonymous, Properties properties)
Core method which is exposed for the external use, and this will find the properEndpointFactory
and create the endpoint which is of the formatEndpoint
.static Endpoint
getEndpointFromElement(org.apache.axiom.om.OMElement elem, DefinitionFactory factory, boolean isAnonymous, Properties properties)
Core method which is exposed for the external use, and this will find the properEndpointFactory
and create the endpoint which is of the formatEndpoint
.However definition for this endpoint will be built using a custom Endpoint Defn factory.protected ArrayList<Endpoint>
getEndpoints(org.apache.axiom.om.OMElement listEndpointElement, Endpoint parent, Properties properties)
Helper method to construct children endpointsObject
getObjectFromOMNode(org.apache.axiom.om.OMNode om, Properties properties)
Creates theEndpoint
object from the providedOMNode
protected static void
handleException(String msg)
protected static void
handleException(String msg, Exception e)
protected void
processProperties(PropertyInclude endpoint, org.apache.axiom.om.OMElement endpointElement)
Helper method to extract endpoint properties.void
setEndpointDefinitionFactory(DefinitionFactory factory)
provide a custom Endpoint definition factory
-
-
-
Field Detail
-
ON_FAULT_Q
public static final QName ON_FAULT_Q
-
-
Method Detail
-
getEndpointFromElement
public static Endpoint getEndpointFromElement(org.apache.axiom.om.OMElement elem, boolean isAnonymous, Properties properties)
Core method which is exposed for the external use, and this will find the properEndpointFactory
and create the endpoint which is of the formatEndpoint
.- Parameters:
elem
- XML from which the endpoint will be builtisAnonymous
- whether this is an anonymous endpoint or notproperties
- bag of properties to pass in any information to the factory- Returns:
- created endpoint
-
getEndpointFromElement
public static Endpoint getEndpointFromElement(org.apache.axiom.om.OMElement elem, DefinitionFactory factory, boolean isAnonymous, Properties properties)
Core method which is exposed for the external use, and this will find the properEndpointFactory
and create the endpoint which is of the formatEndpoint
.However definition for this endpoint will be built using a custom Endpoint Defn factory.- Parameters:
elem
- XML from which the endpoint will be builtfactory
- custom definition factory which this endpoint will be used to buildisAnonymous
- whether this is an anonymous endpoint or notproperties
- bag of properties to pass in any information to the factory- Returns:
- created endpoint
-
getObjectFromOMNode
public Object getObjectFromOMNode(org.apache.axiom.om.OMNode om, Properties properties)
Creates theEndpoint
object from the providedOMNode
- Specified by:
getObjectFromOMNode
in interfaceXMLToObjectMapper
- Parameters:
om
- XML node from which the endpoint will be builtproperties
- bag of properties to pass in any information to the factory- Returns:
- created endpoint as an
Object
-
createEndpoint
protected abstract Endpoint createEndpoint(org.apache.axiom.om.OMElement epConfig, boolean anonymousEndpoint, Properties properties)
Creates the Endpoint implementation for the given XML endpoint configuration. If the endpoint configuration is an inline one, it should be an anonymous endpoint. If it is defined as an immediate child element of the definitions tag it should have a name, which is used as the key in local registry.- Parameters:
epConfig
- OMElement containing the endpoint configuration.anonymousEndpoint
- false if the endpoint has a name. true otherwise.properties
- bag of properties to pass in any information to the factory- Returns:
- Endpoint implementation for the given configuration.
-
extractSpecificEndpointProperties
protected void extractSpecificEndpointProperties(EndpointDefinition definition, org.apache.axiom.om.OMElement elem)
-
getEndpoints
protected ArrayList<Endpoint> getEndpoints(org.apache.axiom.om.OMElement listEndpointElement, Endpoint parent, Properties properties)
Helper method to construct children endpoints- Parameters:
listEndpointElement
- OMElement representing the children endpointsparent
- Parent endpointproperties
- bag of properties to pass in any information to the factory- Returns:
- List of children endpoints
-
setEndpointDefinitionFactory
public void setEndpointDefinitionFactory(DefinitionFactory factory)
provide a custom Endpoint definition factory- Parameters:
factory
-
-
getEndpointDefinitionFactory
public DefinitionFactory getEndpointDefinitionFactory()
return current factory for building this endpoint definition- Returns:
-
processProperties
protected void processProperties(PropertyInclude endpoint, org.apache.axiom.om.OMElement endpointElement)
Helper method to extract endpoint properties.- Parameters:
endpoint
- actual endpoint to set the propertiesendpointElement
- actual endpoint element
-
handleException
protected static void handleException(String msg)
-
-