|
|||||||||||
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 java.util.Map |
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 java.beans.ExceptionListener |
exceptionListener
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 void |
checkDisposed()
|
protected UMOMessageDispatcher |
createDispatcher()
|
abstract UMOMessageReceiver |
createReceiver(UMOComponent component,
UMOEndpoint endpoint)
|
void |
destroyReceiver(UMOMessageReceiver receiver,
UMOEndpoint endpoint)
|
void |
dispose()
A lifecycle method where implementor should fee up any resources If an exception is thrown it should just be logged and processing should continue. |
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 |
java.util.Map |
getDispatchers()
|
ThreadingProfile |
getDispatcherThreadingProfile()
|
java.beans.ExceptionListener |
getExceptionListener()
|
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.Exception exception)
|
void |
initialise()
Method used to perform any initialisation work. |
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 |
setExceptionListener(java.beans.ExceptionListener listener)
|
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 java.beans.ExceptionListener exceptionListener
protected SynchronizedBoolean disposed
protected UMOMessageDispatcherFactory dispatcherFactory
protected java.util.Map 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
Initialisable
InitialisationException
should be thrown, causing the Mule instance to shutdown. If the error is
recoverable, say by retrying to connect, a RecoverableException
should be thrown. There is no guarantee that by throwing a Recoverable exception
that the Mule instance will not shut down.
initialise
in interface Initialisable
InitialisationException
- if a fatal error occurs causing the Mule instance to
shutdownpublic 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()
Disposable
dispose
in interface Disposable
public boolean isDisposed()
isDisposed
in interface UMOConnector
public void handleException(java.lang.Exception exception)
handleException
in interface UMOConnector
exception
- the exception that was caughtpublic void exceptionThrown(java.lang.Exception e)
exceptionThrown
in interface java.beans.ExceptionListener
public java.beans.ExceptionListener getExceptionListener()
getExceptionListener
in interface UMOConnector
ExceptionListener
public void setExceptionListener(java.beans.ExceptionListener listener)
setExceptionListener
in interface UMOConnector
listener
- the ExceptionStrategy to use with this endpointExceptionListener
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 void checkDisposed() throws DisposeException
DisposeException
protected 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()
public 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()
public java.util.Map getDispatchers()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |