org.mule.umo.provider
Interface UMOConnector

All Superinterfaces:
Disposable, Initialisable
All Known Subinterfaces:
MailConnector
All Known Implementing Classes:
AbstractConnector, Pop3Connector, SmtpConnector

public interface UMOConnector
extends Disposable, Initialisable

UMOConnector is the mechanism used to connect to external systems and protocols in order to send and receive data.

Version:
$Revision: 3798 $
Author:
Ross Mason

Field Summary
static int INT_VALUE_NOT_SET
           
 
Method Summary
 UMOMessageDispatcher getDispatcher(UMOImmutableEndpoint 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
 ExceptionListener getExceptionListener()
           
 UMOMessageAdapter getMessageAdapter(Object message)
          Gets a UMOMessageAdapter from the connector for the given message (data)
 String getName()
           
 String getProtocol()
           
 UMOStreamMessageAdapter getStreamMessageAdapter(InputStream in, OutputStream out)
          Gets a UMOStreamMessageAdapter from the connector for the given message.
 void handleException(Exception exception)
           
 boolean isDisposed()
           
 boolean isDisposing()
           
 boolean isRemoteSyncEnabled()
           
 boolean isStarted()
           
 UMOMessageReceiver registerListener(UMOComponent component, UMOEndpoint endpoint)
          This creates a UMOMessageReceiver associated with this endpoint and registers it with the connector
 void setDispatcherFactory(UMOMessageDispatcherFactory factory)
          The dispatcher factory is used to create a message dispatcher of the current request
 void setExceptionListener(ExceptionListener listener)
           
 void setName(String newName)
           
 void startConnector()
           
 void stopConnector()
           
 boolean supportsProtocol(String protocol)
           
 void unregisterListener(UMOComponent component, UMOEndpoint endpoint)
           
 
Methods inherited from interface org.mule.umo.lifecycle.Disposable
dispose
 
Methods inherited from interface org.mule.umo.lifecycle.Initialisable
initialise
 

Field Detail

INT_VALUE_NOT_SET

public static final int INT_VALUE_NOT_SET
See Also:
Constant Field Values
Method Detail

registerListener

public UMOMessageReceiver registerListener(UMOComponent component,
                                           UMOEndpoint endpoint)
                                    throws Exception
This creates a UMOMessageReceiver associated with this endpoint and registers it with the connector

Parameters:
component - the listening component
endpoint - the endpoint contains the listener endpointUri on which to listen on.
Throws:
Exception - if the UMOMessageReceiver cannot be created or the Receiver cannot be registered

unregisterListener

public void unregisterListener(UMOComponent component,
                               UMOEndpoint endpoint)
                        throws Exception
Parameters:
component - the listening component
endpoint - the associated endpointDescriptor with the listener
Throws:
Exception - if the listener cannot be unregistered. If a listener is not associated with the given endpoint this will not throw an exception

isStarted

public boolean isStarted()
Returns:
true if the endpoint is started

isDisposed

public boolean isDisposed()
Returns:
false if the connector is alive and well or true if the connector is being destroyed

isDisposing

public boolean isDisposing()
Returns:
false if the connector is alive and well or true if the connector has been told to dispose

getMessageAdapter

public UMOMessageAdapter getMessageAdapter(Object message)
                                    throws MessagingException
Gets a UMOMessageAdapter from the connector for the given message (data)

Parameters:
message - the data with which to initialise the UMOMessageAdapter
Returns:
the UMOMessageAdapter for the endpoint
Throws:
MessagingException - if the message parameter is not supported
See Also:
UMOMessageAdapter

getStreamMessageAdapter

public UMOStreamMessageAdapter getStreamMessageAdapter(InputStream in,
                                                       OutputStream out)
                                                throws MessagingException
Gets a UMOStreamMessageAdapter from the connector for the given message. This Adapter will correctly handle data streaming for this type of connector

Parameters:
in - the input stream to read the data from
out - the outputStream to write data to. This can be null.
Returns:
the UMOStreamMessageAdapter for the endpoint
Throws:
MessagingException - if the message parameter is not supported
See Also:
UMOStreamMessageAdapter

getName

public String getName()
Returns:
the name associated with the endpoint

setName

public void setName(String newName)
Parameters:
newName - the name to associate with the endpoint

getProtocol

public String getProtocol()
Returns:
the protocol name for the endpoint

supportsProtocol

public boolean supportsProtocol(String protocol)
Returns:
true if the protocol is supported by this connector.

getDispatcher

public UMOMessageDispatcher getDispatcher(UMOImmutableEndpoint endpoint)
                                   throws UMOException
The connector can pool dispatchers based on their endpointUri or can ingnore the endpointUri altogether and use a ThreadLocal or always create new.

Parameters:
endpoint - the endpoint that can be used to key cached dispatchers
Returns:
the component associated with the endpointUri If there is no component for the current thread one will be created
Throws:
UMOException - if creation of a component fails

setExceptionListener

public void setExceptionListener(ExceptionListener listener)
Parameters:
listener - the exception strategy to use with this endpoint
See Also:
ExceptionListener

getExceptionListener

public ExceptionListener getExceptionListener()
Returns:
the Exception stategy used by the endpoint
See Also:
ExceptionListener

handleException

public void handleException(Exception exception)
Parameters:
exception - the exception that was caught

setDispatcherFactory

public void setDispatcherFactory(UMOMessageDispatcherFactory factory)
The dispatcher factory is used to create a message dispatcher of the current request

Parameters:
factory - the factory to use when a dispatcher request is madr

getDispatcherFactory

public UMOMessageDispatcherFactory getDispatcherFactory()
The dispatcher factory is used to create a message dispatcher of the current request

Returns:
the factory to use when a dispatcher request is madr

startConnector

public void startConnector()
                    throws UMOException
Throws:
UMOException

stopConnector

public void stopConnector()
                   throws UMOException
Throws:
UMOException

isRemoteSyncEnabled

public boolean isRemoteSyncEnabled()


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.