|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.providers.AbstractConnector
AbstractConnector
provides base functionality for all connectors provided with
Mule. Connectors are the mechanism used to connect to external systems and protocols in order to
send and receive data.
AbstractConnector
provides getter and setter methods for endpoint
name, transport name and protocol. It also provides methods to stop and start
connecotors and sets up a dispatcher threadpool which allows deriving connectors the possibility
to dispatch work to separate threads. This functionality is controlled with the
doThreading property on the threadingProfiles for dispachers and receivers.
Field Summary | |
static int |
DEFAULT_RETRY_COUNT
|
static long |
DEFAULT_RETRY_FREQUENCY
|
protected UMOTransformer |
defaultInboundTransformer
The service descriptor can define a default inbound transformer to be used on an endpoint if no other is set |
protected UMOTransformer |
defaultOutboundTransformer
The service descriptor can define a default outbound transformer to be used on an endpoint if no other is set |
protected UMOTransformer |
defaultResponseTransformer
For some connectors such as http, a response transformer is required or where a replyTo needs a trnasformer |
protected UMOMessageDispatcherFactory |
dispatcherFactory
Factory used to create dispatchers for this connector |
protected LRUMap |
dispatchers
A pool of dispatchers for this connector, the pool is keyed on endpointUri |
protected SynchronizedBoolean |
disposed
Determines in the endpoint is alive and well |
protected UMOExceptionStrategy |
exceptionStrategy
The exception strategy used by this endpoint |
protected SynchronizedBoolean |
initialised
True once the endpoint has been initialsed |
protected Log |
logger
logger used by this class |
protected java.lang.String |
name
The name that identifies the endpoint |
protected ConcurrentHashMap |
receivers
The collection of listeners on this connector. |
protected SynchronizedBoolean |
started
Specifies if the endpoint started |
Constructor Summary | |
AbstractConnector()
|
Method Summary | |
protected UMOMessageDispatcher |
createDispatcher()
|
abstract UMOMessageReceiver |
createReceiver(UMOComponent component,
UMOEndpoint endpoint)
|
void |
destroyReceiver(UMOMessageReceiver receiver,
UMOEndpoint endpoint)
|
void |
dispose()
|
protected void |
disposeConnector()
Template method to perform any work when destroying the connectoe |
void |
doInitialise()
|
void |
exceptionThrown(java.lang.Exception e)
|
UMOTransformer |
getDefaultInboundTransformer()
|
UMOTransformer |
getDefaultOutboundTransformer()
|
UMOTransformer |
getDefaultResponseTransformer()
|
UMOMessageDispatcher |
getDispatcher(java.lang.String endpoint)
The connector can pool dispatchers based on their endpointUri or can ingnore the endpointUri altogether and use a ThreadLocal or always create new. |
UMOMessageDispatcherFactory |
getDispatcherFactory()
The dispatcher factory is used to create a message dispatcher of the current request |
ThreadingProfile |
getDispatcherThreadingProfile()
|
UMOExceptionStrategy |
getExceptionStrategy()
|
java.lang.String |
getName()
|
abstract java.lang.String |
getProtocol()
|
protected java.lang.Object |
getReceiverKey(UMOComponent component,
UMOEndpoint endpoint)
|
ThreadingProfile |
getReceiverThreadingProfile()
|
ReplyToHandler |
getReplyToHandler()
|
int |
getRetryCount()
|
long |
getRetryFrequency()
|
void |
handleException(java.lang.Object message,
java.lang.Throwable exception)
|
void |
initialise()
|
boolean |
isDisposed()
|
boolean |
isDisposeDispatcherOnCompletion()
|
boolean |
isStarted()
|
UMOMessageReceiver |
registerListener(UMOComponent component,
UMOEndpoint endpoint)
This creates a UMOMessageReceiver associated with this endpoint and registers it
with the endpoint |
void |
setDefaultInboundTransformer(UMOTransformer defaultInboundTransformer)
|
void |
setDefaultOutboundTransformer(UMOTransformer defaultOutboundTransformer)
|
void |
setDefaultResponseTransformer(UMOTransformer defaultResponseTransformer)
|
void |
setDispatcherFactory(UMOMessageDispatcherFactory dispatcerFactory)
The dispatcher factory is used to create a message dispatcher of the current request |
void |
setDispatcherThreadingProfile(ThreadingProfile dispatcherThreadingProfile)
|
void |
setDisposeDispatcherOnCompletion(boolean disposeDispatcherOnCompletion)
|
void |
setExceptionStrategy(UMOExceptionStrategy strategy)
|
void |
setName(java.lang.String newName)
|
void |
setReceiverThreadingProfile(ThreadingProfile receiverThreadingProfile)
|
void |
setRetryCount(int retryCount)
|
void |
setRetryFrequency(long retryFrequency)
|
void |
start()
|
protected void |
startConnector()
Template method to perform any work when starting the connectoe |
void |
stop()
|
protected void |
stopConnector()
Template method to perform any work when stopping the connectoe |
void |
unregisterListener(UMOComponent component,
UMOEndpoint endpoint)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.mule.umo.provider.UMOConnector |
getMessageAdapter |
Field Detail |
protected transient Log logger
public static final long DEFAULT_RETRY_FREQUENCY
public static final int DEFAULT_RETRY_COUNT
protected SynchronizedBoolean started
protected SynchronizedBoolean initialised
protected java.lang.String name
protected UMOExceptionStrategy exceptionStrategy
protected SynchronizedBoolean disposed
protected UMOMessageDispatcherFactory dispatcherFactory
protected LRUMap dispatchers
protected ConcurrentHashMap receivers
protected UMOTransformer defaultInboundTransformer
protected UMOTransformer defaultOutboundTransformer
protected UMOTransformer defaultResponseTransformer
Constructor Detail |
public AbstractConnector()
Method Detail |
public java.lang.String getName()
getName
in interface UMOConnector
public void setName(java.lang.String newName)
setName
in interface UMOConnector
newName
- the name to associate with the endpointpublic final void initialise() throws InitialisationException
initialise
in interface Initialisable
InitialisationException
public abstract java.lang.String getProtocol()
getProtocol
in interface UMOConnector
public long getRetryFrequency()
public void setRetryFrequency(long retryFrequency)
public int getRetryCount()
public void setRetryCount(int retryCount)
public final void start() throws UMOException
start
in interface Startable
UMOException
public boolean isStarted()
isStarted
in interface UMOConnector
public final void stop() throws UMOException
stop
in interface Stoppable
UMOException
public final void dispose() throws UMOException
dispose
in interface Disposable
UMOException
public boolean isDisposed()
isDisposed
in interface UMOConnector
public void handleException(java.lang.Object message, java.lang.Throwable exception)
handleException
in interface UMOConnector
message
- the object that was being processed when the exception occurredexception
- the exception that was caughtpublic void exceptionThrown(java.lang.Exception e)
exceptionThrown
in interface java.beans.ExceptionListener
public UMOExceptionStrategy getExceptionStrategy()
getExceptionStrategy
in interface UMOConnector
UMOExceptionStrategy
public void setExceptionStrategy(UMOExceptionStrategy strategy)
setExceptionStrategy
in interface UMOConnector
strategy
- the ExceptionStrategy to use with this endpointUMOExceptionStrategy
public UMOMessageDispatcherFactory getDispatcherFactory()
UMOConnector
getDispatcherFactory
in interface UMOConnector
public void setDispatcherFactory(UMOMessageDispatcherFactory dispatcerFactory)
UMOConnector
setDispatcherFactory
in interface UMOConnector
dispatcerFactory
- The dispatcherFactory to set.public UMOMessageDispatcher getDispatcher(java.lang.String endpoint) throws UMOException
UMOConnector
getDispatcher
in interface UMOConnector
endpoint
- the endpointUri that can be used to key cached dispatchers
UMOException
- if creation of a component failsprotected UMOMessageDispatcher createDispatcher() throws UMOException
UMOException
public UMOMessageReceiver registerListener(UMOComponent component, UMOEndpoint endpoint) throws java.lang.Exception
UMOConnector
UMOMessageReceiver
associated with this endpoint and registers it
with the endpoint
registerListener
in interface UMOConnector
component
- the listening componentendpoint
- the endpoint contains the listener endpointUri on which to listen on.
java.lang.Exception
- if the UMOMessageReceiver cannot be created or the Receiver cannot be registeredprotected java.lang.Object getReceiverKey(UMOComponent component, UMOEndpoint endpoint)
public final void unregisterListener(UMOComponent component, UMOEndpoint endpoint) throws java.lang.Exception
unregisterListener
in interface UMOConnector
component
- the listening componentendpoint
- the associated endpointDescriptor with the listener
java.lang.Exception
- if the listener cannot be unregistered. If a listener is not
associated with the given endpoint this will not throw an exceptionpublic ThreadingProfile getDispatcherThreadingProfile()
public void setDispatcherThreadingProfile(ThreadingProfile dispatcherThreadingProfile)
public ThreadingProfile getReceiverThreadingProfile()
public void setReceiverThreadingProfile(ThreadingProfile receiverThreadingProfile)
public abstract UMOMessageReceiver createReceiver(UMOComponent component, UMOEndpoint endpoint) throws java.lang.Exception
java.lang.Exception
public void destroyReceiver(UMOMessageReceiver receiver, UMOEndpoint endpoint) throws java.lang.Exception
java.lang.Exception
protected void startConnector() throws UMOException
UMOException
- if the method failsprotected void stopConnector() throws UMOException
UMOException
- if the method failspublic boolean isDisposeDispatcherOnCompletion()
public void setDisposeDispatcherOnCompletion(boolean disposeDispatcherOnCompletion)
protected void disposeConnector() throws UMOException
UMOException
- if the method failspublic void doInitialise() throws InitialisationException
InitialisationException
public UMOTransformer getDefaultInboundTransformer()
public void setDefaultInboundTransformer(UMOTransformer defaultInboundTransformer)
public UMOTransformer getDefaultResponseTransformer()
public UMOTransformer getDefaultOutboundTransformer()
public void setDefaultOutboundTransformer(UMOTransformer defaultOutboundTransformer)
public void setDefaultResponseTransformer(UMOTransformer defaultResponseTransformer)
public ReplyToHandler getReplyToHandler()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |