org.mule.endpoint
Class AbstractEndpointBuilder

java.lang.Object
  extended by org.mule.endpoint.AbstractEndpointBuilder
All Implemented Interfaces:
java.lang.Cloneable, MuleContextAware, EndpointBuilder
Direct Known Subclasses:
EndpointURIEndpointBuilder

public abstract class AbstractEndpointBuilder
extends java.lang.Object
implements EndpointBuilder

Abstract endpoint builder used for externalizing the complex creation logic of endpoints out of the endpoint instance itself.
The use of a builder allows i) Endpoints to be configured once and created in a repeatable fashion (global endpoints), ii) Allow for much more extensibility in endpoint creation for transport specific endpoints, streaming endpoints etc.


Field Summary
protected  Connector connector
           
protected  java.lang.Integer createConnector
           
protected  java.lang.Boolean deleteUnacceptedMessages
           
protected  java.lang.Boolean disableTransportTransformer
           
protected  java.lang.String encoding
           
protected  java.lang.String initialState
           
protected  Log logger
           
protected  MessageExchangePattern messageExchangePattern
           
protected  java.util.List<MessageProcessor> messageProcessors
           
protected  EndpointMessageProcessorChainFactory messageProcessorsFactory
           
protected  java.lang.String mimeType
           
protected  MuleContext muleContext
           
protected  java.lang.String name
           
protected  java.util.Map<java.lang.Object,java.lang.Object> properties
           
static java.lang.String PROPERTY_RESPONSE_PROPERTIES
           
static java.lang.String PROPERTY_RESPONSE_TIMEOUT
           
protected  java.lang.String registryId
           
protected  java.util.List<MessageProcessor> responseMessageProcessors
           
protected  java.lang.String responsePropertiesList
           
protected  java.lang.Integer responseTimeout
           
protected  java.util.List<Transformer> responseTransformers
           
protected  RetryPolicyTemplate retryPolicyTemplate
           
protected  java.lang.Boolean synchronous
           
protected  TransactionConfig transactionConfig
           
protected  java.util.List<Transformer> transformers
           
protected  URIBuilder uriBuilder
           
 
Constructor Summary
AbstractEndpointBuilder()
           
 
Method Summary
 void addMessageProcessor(MessageProcessor messageProcessor)
           
 void addResponseMessageProcessor(MessageProcessor messageProcessor)
           
 void addResponseTransformer(Transformer transformer)
          Deprecated. Use addResponseMessageProcessor()
protected  java.util.List<MessageProcessor> addResponseTransformerProcessors(EndpointURI endpointURI)
           
 void addTransformer(Transformer transformer)
          Deprecated. Use addMessageProcessor()
protected  java.util.List<MessageProcessor> addTransformerProcessors(EndpointURI endpointURI)
           
 InboundEndpoint buildInboundEndpoint()
          Constructs inbound endpoints
 OutboundEndpoint buildOutboundEndpoint()
          Constructs outbound endpoints
protected  void checkInboundExchangePattern()
           
 java.lang.Object clone()
           
protected  InboundEndpoint doBuildInboundEndpoint()
           
protected  OutboundEndpoint doBuildOutboundEndpoint()
           
protected static boolean equal(java.lang.Object a, java.lang.Object b)
           
 boolean equals(java.lang.Object obj)
           
protected  Connector getConnector()
           
protected  Connector getDefaultConnector()
           
protected  boolean getDefaultDeleteUnacceptedMessages(Connector connector)
           
protected  boolean getDefaultDisableTransportTransformer()
           
protected  java.lang.String getDefaultEndpointEncoding(Connector connector)
           
protected  java.lang.String getDefaultInitialState(Connector connector)
           
protected  EndpointMessageProcessorChainFactory getDefaultMessageProcessorsFactory()
           
protected  int getDefaultResponseTimeout(Connector connector)
           
protected  EndpointSecurityFilter getDefaultSecurityFilter()
           
protected  TransactionConfig getDefaultTransactionConfig()
           
protected  boolean getDeleteUnacceptedMessages(Connector connector)
           
 URIBuilder getEndpointBuilder()
           
protected  java.lang.String getEndpointEncoding(Connector connector)
           
protected  java.lang.String getInitialState(Connector connector)
           
 java.util.List<MessageProcessor> getMessageProcessors()
           
protected  EndpointMessageProcessorChainFactory getMessageProcessorsFactory()
           
protected  java.lang.String getMimeType()
           
protected  java.lang.String getName(EndpointURI endpointURI)
           
protected  java.util.Map<java.lang.Object,java.lang.Object> getProperties()
           
 java.util.List<MessageProcessor> getResponseMessageProcessors()
           
protected  int getResponseTimeout(Connector connector)
           
protected  java.util.List<Transformer> getResponseTransformersFromUri(EndpointURI endpointURI)
           
protected  RetryPolicyTemplate getRetryPolicyTemplate(Connector conn)
           
protected  java.lang.String getScheme()
           
protected  EndpointSecurityFilter getSecurityFilter()
           
protected  TransactionConfig getTransactionConfig()
           
protected  java.util.List<Transformer> getTransformersFromUri(EndpointURI endpointURI)
           
 int hashCode()
           
protected  void initExchangePatternFromConnectorDefault(TransportServiceDescriptor serviceDescriptor)
           
protected  boolean isAlwaysCreateConnector()
          Some endpoint may always require a new connector to be created for every endpoint
protected  boolean isDisableTransportTransformer()
           
protected  void prepareToBuildEndpoint()
           
 void setConnector(Connector connector)
           
 void setCreateConnector(int createConnector)
           
 void setDeleteUnacceptedMessages(boolean deleteUnacceptedMessages)
           
 void setDisableTransportTransformer(boolean disableTransportTransformer)
           
 void setEncoding(java.lang.String encoding)
           
 void setExchangePattern(MessageExchangePattern mep)
           
 void setInitialState(java.lang.String initialState)
           
 void setMessageProcessors(java.util.List<MessageProcessor> newMessageProcessors)
           
 void setMimeType(java.lang.String mimeType)
           
 void setMuleContext(MuleContext muleContext)
           
 void setName(java.lang.String name)
           
 void setProperties(java.util.Map<java.lang.Object,java.lang.Object> properties)
          NOTE - this appends properties.
protected  void setPropertiesFromProperties(java.util.Map<java.lang.Object,java.lang.Object> properties)
           
 void setProperty(java.lang.Object key, java.lang.Object value)
          Sets a property on the endpoint
 void setRegistryId(java.lang.String registryId)
           
 void setResponseMessageProcessors(java.util.List<MessageProcessor> newResponseMessageProcessors)
           
 void setResponseTimeout(int responseTimeout)
           
 void setResponseTransformers(java.util.List<Transformer> newResponseTransformers)
          Deprecated. Use setResponseMessageProcessors()
 void setRetryPolicyTemplate(RetryPolicyTemplate retryPolicyTemplate)
           
 void setTransactionConfig(TransactionConfig transactionConfig)
           
 void setTransformers(java.util.List<Transformer> newTransformers)
          Deprecated. Use setMessageProcessors()
 void setURIBuilder(URIBuilder URIBuilder)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_RESPONSE_TIMEOUT

public static final java.lang.String PROPERTY_RESPONSE_TIMEOUT
See Also:
Constant Field Values

PROPERTY_RESPONSE_PROPERTIES

public static final java.lang.String PROPERTY_RESPONSE_PROPERTIES
See Also:
Constant Field Values

uriBuilder

protected URIBuilder uriBuilder

connector

protected Connector connector

name

protected java.lang.String name

properties

protected java.util.Map<java.lang.Object,java.lang.Object> properties

transactionConfig

protected TransactionConfig transactionConfig

deleteUnacceptedMessages

protected java.lang.Boolean deleteUnacceptedMessages

synchronous

protected java.lang.Boolean synchronous

messageExchangePattern

protected MessageExchangePattern messageExchangePattern

responseTimeout

protected java.lang.Integer responseTimeout

initialState

protected java.lang.String initialState

encoding

protected java.lang.String encoding

createConnector

protected java.lang.Integer createConnector

retryPolicyTemplate

protected RetryPolicyTemplate retryPolicyTemplate

responsePropertiesList

protected java.lang.String responsePropertiesList

messageProcessorsFactory

protected EndpointMessageProcessorChainFactory messageProcessorsFactory

messageProcessors

protected java.util.List<MessageProcessor> messageProcessors

responseMessageProcessors

protected java.util.List<MessageProcessor> responseMessageProcessors

transformers

protected java.util.List<Transformer> transformers

responseTransformers

protected java.util.List<Transformer> responseTransformers

disableTransportTransformer

protected java.lang.Boolean disableTransportTransformer

mimeType

protected java.lang.String mimeType

registryId

protected java.lang.String registryId

muleContext

protected MuleContext muleContext

logger

protected transient Log logger
Constructor Detail

AbstractEndpointBuilder

public AbstractEndpointBuilder()
Method Detail

buildInboundEndpoint

public InboundEndpoint buildInboundEndpoint()
                                     throws EndpointException,
                                            InitialisationException
Description copied from interface: EndpointBuilder
Constructs inbound endpoints

Specified by:
buildInboundEndpoint in interface EndpointBuilder
Throws:
EndpointException
InitialisationException

buildOutboundEndpoint

public OutboundEndpoint buildOutboundEndpoint()
                                       throws EndpointException,
                                              InitialisationException
Description copied from interface: EndpointBuilder
Constructs outbound endpoints

Specified by:
buildOutboundEndpoint in interface EndpointBuilder
Throws:
EndpointException
InitialisationException

setPropertiesFromProperties

protected void setPropertiesFromProperties(java.util.Map<java.lang.Object,java.lang.Object> properties)

doBuildInboundEndpoint

protected InboundEndpoint doBuildInboundEndpoint()
                                          throws InitialisationException,
                                                 EndpointException
Throws:
InitialisationException
EndpointException

doBuildOutboundEndpoint

protected OutboundEndpoint doBuildOutboundEndpoint()
                                            throws InitialisationException,
                                                   EndpointException
Throws:
InitialisationException
EndpointException

addTransformerProcessors

protected java.util.List<MessageProcessor> addTransformerProcessors(EndpointURI endpointURI)
                                                             throws TransportFactoryException
Throws:
TransportFactoryException

addResponseTransformerProcessors

protected java.util.List<MessageProcessor> addResponseTransformerProcessors(EndpointURI endpointURI)
                                                                     throws TransportFactoryException
Throws:
TransportFactoryException

prepareToBuildEndpoint

protected void prepareToBuildEndpoint()

checkInboundExchangePattern

protected void checkInboundExchangePattern()
                                    throws EndpointException
Throws:
EndpointException

initExchangePatternFromConnectorDefault

protected void initExchangePatternFromConnectorDefault(TransportServiceDescriptor serviceDescriptor)
                                                throws EndpointException
Throws:
EndpointException

getRetryPolicyTemplate

protected RetryPolicyTemplate getRetryPolicyTemplate(Connector conn)

getTransactionConfig

protected TransactionConfig getTransactionConfig()

getDefaultTransactionConfig

protected TransactionConfig getDefaultTransactionConfig()

getSecurityFilter

protected EndpointSecurityFilter getSecurityFilter()

getDefaultSecurityFilter

protected EndpointSecurityFilter getDefaultSecurityFilter()

getConnector

protected Connector getConnector()
                          throws EndpointException
Throws:
EndpointException

getDefaultConnector

protected Connector getDefaultConnector()
                                 throws EndpointException
Throws:
EndpointException

getName

protected java.lang.String getName(EndpointURI endpointURI)

getProperties

protected java.util.Map<java.lang.Object,java.lang.Object> getProperties()

getDeleteUnacceptedMessages

protected boolean getDeleteUnacceptedMessages(Connector connector)

getDefaultDeleteUnacceptedMessages

protected boolean getDefaultDeleteUnacceptedMessages(Connector connector)

getEndpointEncoding

protected java.lang.String getEndpointEncoding(Connector connector)

getDefaultEndpointEncoding

protected java.lang.String getDefaultEndpointEncoding(Connector connector)

getInitialState

protected java.lang.String getInitialState(Connector connector)

getDefaultInitialState

protected java.lang.String getDefaultInitialState(Connector connector)

getResponseTimeout

protected int getResponseTimeout(Connector connector)

getDefaultResponseTimeout

protected int getDefaultResponseTimeout(Connector connector)

getTransformersFromUri

protected java.util.List<Transformer> getTransformersFromUri(EndpointURI endpointURI)
                                                      throws TransportFactoryException
Throws:
TransportFactoryException

getResponseTransformersFromUri

protected java.util.List<Transformer> getResponseTransformersFromUri(EndpointURI endpointURI)
                                                              throws TransportFactoryException
Throws:
TransportFactoryException

getMimeType

protected java.lang.String getMimeType()

setMimeType

public void setMimeType(java.lang.String mimeType)

getScheme

protected java.lang.String getScheme()

isAlwaysCreateConnector

protected boolean isAlwaysCreateConnector()
Some endpoint may always require a new connector to be created for every endpoint

Returns:
the default if false but cusotm endpoints can override
Since:
3.0.0

setConnector

public void setConnector(Connector connector)
Specified by:
setConnector in interface EndpointBuilder

addTransformer

@Deprecated
public void addTransformer(Transformer transformer)
Deprecated. Use addMessageProcessor()

Specified by:
addTransformer in interface EndpointBuilder

setTransformers

@Deprecated
public void setTransformers(java.util.List<Transformer> newTransformers)
Deprecated. Use setMessageProcessors()

Specified by:
setTransformers in interface EndpointBuilder

getMessageProcessorsFactory

protected EndpointMessageProcessorChainFactory getMessageProcessorsFactory()

getDefaultMessageProcessorsFactory

protected EndpointMessageProcessorChainFactory getDefaultMessageProcessorsFactory()

addResponseTransformer

@Deprecated
public void addResponseTransformer(Transformer transformer)
Deprecated. Use addResponseMessageProcessor()

Specified by:
addResponseTransformer in interface EndpointBuilder

setResponseTransformers

@Deprecated
public void setResponseTransformers(java.util.List<Transformer> newResponseTransformers)
Deprecated. Use setResponseMessageProcessors()

Specified by:
setResponseTransformers in interface EndpointBuilder

addMessageProcessor

public void addMessageProcessor(MessageProcessor messageProcessor)
Specified by:
addMessageProcessor in interface EndpointBuilder

setMessageProcessors

public void setMessageProcessors(java.util.List<MessageProcessor> newMessageProcessors)
Specified by:
setMessageProcessors in interface EndpointBuilder

getMessageProcessors

public java.util.List<MessageProcessor> getMessageProcessors()

addResponseMessageProcessor

public void addResponseMessageProcessor(MessageProcessor messageProcessor)
Specified by:
addResponseMessageProcessor in interface EndpointBuilder

setResponseMessageProcessors

public void setResponseMessageProcessors(java.util.List<MessageProcessor> newResponseMessageProcessors)
Specified by:
setResponseMessageProcessors in interface EndpointBuilder

getResponseMessageProcessors

public java.util.List<MessageProcessor> getResponseMessageProcessors()

isDisableTransportTransformer

protected boolean isDisableTransportTransformer()

getDefaultDisableTransportTransformer

protected boolean getDefaultDisableTransportTransformer()

setName

public void setName(java.lang.String name)
Specified by:
setName in interface EndpointBuilder

setProperties

public void setProperties(java.util.Map<java.lang.Object,java.lang.Object> properties)
NOTE - this appends properties.

Specified by:
setProperties in interface EndpointBuilder

setProperty

public void setProperty(java.lang.Object key,
                        java.lang.Object value)
Sets a property on the endpoint

Specified by:
setProperty in interface EndpointBuilder
Parameters:
key - the property key
value - the value of the property

setTransactionConfig

public void setTransactionConfig(TransactionConfig transactionConfig)
Specified by:
setTransactionConfig in interface EndpointBuilder

setDeleteUnacceptedMessages

public void setDeleteUnacceptedMessages(boolean deleteUnacceptedMessages)
Specified by:
setDeleteUnacceptedMessages in interface EndpointBuilder

setExchangePattern

public void setExchangePattern(MessageExchangePattern mep)
Specified by:
setExchangePattern in interface EndpointBuilder

setResponseTimeout

public void setResponseTimeout(int responseTimeout)
Specified by:
setResponseTimeout in interface EndpointBuilder

setInitialState

public void setInitialState(java.lang.String initialState)
Specified by:
setInitialState in interface EndpointBuilder

setEncoding

public void setEncoding(java.lang.String encoding)
Specified by:
setEncoding in interface EndpointBuilder

setCreateConnector

public void setCreateConnector(int createConnector)

setRegistryId

public void setRegistryId(java.lang.String registryId)
Specified by:
setRegistryId in interface EndpointBuilder

setMuleContext

public void setMuleContext(MuleContext muleContext)
Specified by:
setMuleContext in interface MuleContextAware
Specified by:
setMuleContext in interface EndpointBuilder

setRetryPolicyTemplate

public void setRetryPolicyTemplate(RetryPolicyTemplate retryPolicyTemplate)
Specified by:
setRetryPolicyTemplate in interface EndpointBuilder

setDisableTransportTransformer

public void setDisableTransportTransformer(boolean disableTransportTransformer)
Specified by:
setDisableTransportTransformer in interface EndpointBuilder

getEndpointBuilder

public URIBuilder getEndpointBuilder()

setURIBuilder

public void setURIBuilder(URIBuilder URIBuilder)
Specified by:
setURIBuilder in interface EndpointBuilder

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

equal

protected static boolean equal(java.lang.Object a,
                               java.lang.Object b)

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface EndpointBuilder
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException


Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.