org.mule.api.transport
Interface Connector

All Superinterfaces:
Disposable, Initialisable, Lifecycle, MuleContextAware, NamedObject, Startable, Stoppable
All Known Implementing Classes:
AbstractConnector, AbstractJndiConnector, AbstractMailConnector, AbstractRetrieveMailConnector, AbstractTlsRetrieveMailConnector, ActiveMQJmsConnector, ActiveMQXAJmsConnector, AxisConnector, AxisWsdlConnector, CxfConnector, CxfWsdlConnector, EjbConnector, FileConnector, FtpConnector, GmailSmtpConnector, HttpConnector, HttpPollingConnector, HttpsConnector, HttpsPollingConnector, ImapConnector, ImapsConnector, JdbcConnector, JettyHttpConnector, JettyHttpsConnector, JmsConnector, JnpConnector, MulticastConnector, Pop3Connector, Pop3sConnector, ProcessConnector, PromptStdioConnector, QuartzConnector, RmiConnector, ServletConnector, SmtpConnector, SmtpsConnector, SslConnector, StdioConnector, TcpConnector, TlsConnector, UdpConnector, VMConnector, WeblogicJmsConnector, WebsphereJmsConnector, XmppConnector, XmppsConnector

public interface Connector
extends Lifecycle, MuleContextAware, NamedObject

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


Field Summary
static int INT_VALUE_NOT_SET
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Method Summary
 void dispatch(OutboundEndpoint endpoint, MuleEvent event)
          Dispatches an event from the endpoint to the external system
 MessageDispatcherFactory getDispatcherFactory()
          The dispatcher factory is used to create a message dispatcher of the current request
 ExceptionListener getExceptionListener()
           
 MessageAdapter getMessageAdapter(Object message)
          Gets a MessageAdapter from the connector for the given message (data)
 MuleContext getMuleContext()
           
 OutputStream getOutputStream(OutboundEndpoint endpoint, MuleMessage message)
          Will get the output stream for this type of transport.
 String getProtocol()
           
 MessageRequesterFactory getRequesterFactory()
          The requester factory is used to create a message requester of the current request
 RetryPolicyTemplate getRetryPolicyTemplate()
           
 void handleException(Exception exception)
           
 boolean isConnected()
           
 boolean isDisposed()
           
 boolean isResponseEnabled()
           
 boolean isStarted()
           
 boolean isSyncEnabled(String protocol)
          Used to define is this connectors endpoints' should be synchronous by default rather than using Mule's instance wide default.
 MessageReceiver registerListener(Service service, InboundEndpoint endpoint)
          This creates a MessageReceiver associated with this endpoint and registers it with the connector
 MuleMessage request(InboundEndpoint endpoint, long timeout)
          Make a specific request to the underlying transport
 MuleMessage request(String uri, long timeout)
          Deprecated. Use request(ImmutableEndpoint endpoint, long timeout)
 MuleMessage send(OutboundEndpoint endpoint, MuleEvent event)
          Sends an event from the endpoint to the external system
 void setDispatcherFactory(MessageDispatcherFactory factory)
          The dispatcher factory is used to create a message dispatcher of the current request
 void setExceptionListener(ExceptionListener listener)
           
 void setRequesterFactory(MessageRequesterFactory factory)
          The requester factory is used to create a message requester of the current request
 boolean supportsProtocol(String protocol)
           
 void unregisterListener(Service service, InboundEndpoint endpoint)
           
 
Methods inherited from interface org.mule.api.lifecycle.Initialisable
initialise
 
Methods inherited from interface org.mule.api.lifecycle.Startable
start
 
Methods inherited from interface org.mule.api.lifecycle.Stoppable
stop
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 
Methods inherited from interface org.mule.api.context.MuleContextAware
setMuleContext
 
Methods inherited from interface org.mule.api.NamedObject
getName, setName
 

Field Detail

INT_VALUE_NOT_SET

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

registerListener

MessageReceiver registerListener(Service service,
                                 InboundEndpoint endpoint)
                                 throws Exception
This creates a MessageReceiver associated with this endpoint and registers it with the connector

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

unregisterListener

void unregisterListener(Service service,
                        InboundEndpoint endpoint)
                        throws Exception
Parameters:
service - the listening service
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

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

isConnected

boolean isConnected()

isDisposed

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

getMessageAdapter

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

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

getProtocol

String getProtocol()
Returns:
the primary protocol name for endpoints of this connector

supportsProtocol

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

setExceptionListener

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

getExceptionListener

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

handleException

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

setDispatcherFactory

void setDispatcherFactory(MessageDispatcherFactory 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

MessageDispatcherFactory 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

setRequesterFactory

void setRequesterFactory(MessageRequesterFactory factory)
The requester factory is used to create a message requester of the current request

Parameters:
factory - the factory to use when a request is made

getRequesterFactory

MessageRequesterFactory getRequesterFactory()
The requester factory is used to create a message requester of the current request

Returns:
the factory to use when a request is made

isResponseEnabled

boolean isResponseEnabled()

isSyncEnabled

boolean isSyncEnabled(String protocol)
Used to define is this connectors endpoints' should be synchronous by default rather than using Mule's instance wide default. The endpoint is passed through to this method so that transports like Axis/CXF can determine if synchronous should be default depending on the endpoint transport e.g. http/vm/jms etc.

Parameters:
endpoint -
Returns:
See Also:
ImmutableEndpoint.isSynchronous()

dispatch

void dispatch(OutboundEndpoint endpoint,
              MuleEvent event)
              throws DispatchException
Dispatches an event from the endpoint to the external system

Parameters:
event - The event to dispatch
Throws:
DispatchException - if the event fails to be dispatched

request

MuleMessage request(String uri,
                    long timeout)
                    throws Exception
Deprecated. Use request(ImmutableEndpoint endpoint, long timeout)

Make a specific request to the underlying transport

Parameters:
uri - the endpoint uri to use when connecting to the resource
timeout - the maximum time the operation should block before returning. The call should return immediately if there is data available. If no data becomes available before the timeout elapses, null will be returned
Returns:
the result of the request wrapped in a MuleMessage object. Null will be returned if no data was avaialable
Throws:
Exception - if the call to the underlying protocal cuases an exception

request

MuleMessage request(InboundEndpoint endpoint,
                    long timeout)
                    throws Exception
Make a specific request to the underlying transport

Parameters:
endpoint - the endpoint to use when connecting to the resource
timeout - the maximum time the operation should block before returning. The call should return immediately if there is data available. If no data becomes available before the timeout elapses, null will be returned
Returns:
the result of the request wrapped in a MuleMessage object. Null will be returned if no data was avaialable
Throws:
Exception - if the call to the underlying protocal cuases an exception

send

MuleMessage send(OutboundEndpoint endpoint,
                 MuleEvent event)
                 throws DispatchException
Sends an event from the endpoint to the external system

Parameters:
event - The event to send
Returns:
event the response form the external system wrapped in a MuleEvent
Throws:
DispatchException - if the event fails to be dispatched

getOutputStream

OutputStream getOutputStream(OutboundEndpoint endpoint,
                             MuleMessage message)
                             throws MuleException
Will get the output stream for this type of transport. Typically this will be called only when Streaming is being used on an outbound endpoint. If Streaming is not supported by this transport an UnsupportedOperationException is thrown. Note that the stream MUST release resources on close. For help doing so, see CallbackOutputStream.

Parameters:
endpoint - the endpoint that releates to this Dispatcher
message - the current message being processed
Returns:
the output stream to use for this request
Throws:
MuleException

getMuleContext

MuleContext getMuleContext()

getRetryPolicyTemplate

RetryPolicyTemplate getRetryPolicyTemplate()


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.