org.mule.impl
Class ImmutableMuleEndpoint

java.lang.Object
  extended byorg.mule.impl.ImmutableMuleEndpoint
All Implemented Interfaces:
Cloneable, Initialisable, Serializable, UMOImmutableEndpoint, UMOMessageDispatching
Direct Known Subclasses:
MuleEndpoint

public class ImmutableMuleEndpoint
extends Object
implements UMOImmutableEndpoint

ImmutableMuleEndpoint describes a Provider in the Mule Server. A endpoint is a grouping of an endpoint, an endpointUri and a transformer.

See Also:
Serialized Form

Field Summary
protected  UMOConnector connector
          The endpoint used to communicate with the external system
protected  int createConnector
          determines if a new connector should be created for this endpoint
protected  boolean deleteUnacceptedMessages
          determines whether unaccepted filtered events should be removed from the source.
protected  String endpointEncoding
           
protected  UMOEndpointURI endpointUri
          The endpointUri on which to send or receive information
protected  UMOFilter filter
          event filter for this endpoint
protected  AtomicBoolean initialised
          has this endpoint been initialised
protected  String initialState
          The state that the endpoint is initialised in such as started or stopped
protected static Log logger
          logger used by this class
protected  String name
          The name for the endpoint
protected  Map properties
          Any additional properties for the endpoint
protected  Boolean remoteSync
          Determines whether a synchronous call should block to obtain a response from a remote server (if the transport supports it).
protected  Integer remoteSyncTimeout
          How long to block when performing a remote synchronisation to a remote host.
protected  UMOTransformer responseTransformer
          The transformer used to transform the incoming or outgoing data
protected  UMOEndpointSecurityFilter securityFilter
          The security filter to apply to this endpoint
protected  boolean streaming
          Determines whether the endpoint should deal with requests as streams
protected  Boolean synchronous
          whether events received by this endpoint should execute in a single thread
protected  UMOTransactionConfig transactionConfig
          The transaction configuration for this endpoint
protected  UMOTransformer transformer
          The transformer used to transform the incoming or outgoing data
protected  String type
          Determines whether the endpoint is a receiver or sender or both
 
Fields inherited from interface org.mule.umo.endpoint.UMOImmutableEndpoint
ENDPOINT_TYPE_RECEIVER, ENDPOINT_TYPE_RESPONSE, ENDPOINT_TYPE_SENDER, ENDPOINT_TYPE_SENDER_AND_RECEIVER, INITIAL_STATE_STARTED, INITIAL_STATE_STOPPED
 
Fields inherited from interface org.mule.umo.provider.UMOMessageDispatching
RECEIVE_NO_WAIT, RECEIVE_WAIT_INDEFINITELY
 
Constructor Summary
ImmutableMuleEndpoint(String endpointName, boolean receiver)
           
ImmutableMuleEndpoint(String name, UMOEndpointURI endpointUri, UMOConnector connector, UMOTransformer transformer, String type, int createConnector, String endpointEncoding, Map props)
           
ImmutableMuleEndpoint(UMOImmutableEndpoint source)
           
 
Method Summary
 boolean canReceive()
          Determines whether this endpoint can be used to receive events
 boolean canSend()
          Determines whether this endpoint can be used to send events
 Object clone()
          Make a deep copy of this endpoint
static UMOEndpoint createEndpointFromUri(UMOEndpointURI uri, String type)
           
 void dispatch(UMOEvent event)
          Dispatches an event from the endpoint to the external system
 boolean equals(Object o)
           
 UMOConnector getConnector()
          The endpoint that will be used to send the message on.
 int getCreateConnector()
          Determines if a new connector is created for this endpoint or an exising one must already be present
 String getEncoding()
          Decides the encoding to be used for events received by this endpoint
static UMOEndpoint getEndpointFromUri(String uri)
           
static UMOEndpoint getEndpointFromUri(UMOEndpointURI uri)
           
 UMOEndpointURI getEndpointURI()
          This specifes the communication endpointUri.
 UMOFilter getFilter()
          The filter to apply to incoming messages.
 String getInitialState()
          Sets the state the endpoint will be loaded in.
 String getName()
          The name is the identifier for the endpoint
static UMOEndpoint getOrCreateEndpointForUri(String uriIdentifier, String type)
           
static UMOEndpoint getOrCreateEndpointForUri(UMOEndpointURI uri, String type)
           
 Map getProperties()
          Returns any properties set on this endpoint
 Object getProperty(Object key)
          Retrieves a property set on the endpoint
 String getProtocol()
          The transport protocol name that the message endpoint communicates over.
 int getRemoteSyncTimeout()
          The timeout value for remoteSync invocations
 UMOTransformer getResponseTransformer()
          The transformer used when a response is returned from invoking this endpoint
 UMOEndpointSecurityFilter getSecurityFilter()
          Returns an UMOEndpointSecurityFilter for this endpoint.
 UMOTransactionConfig getTransactionConfig()
          Returns the transaction configuration for this endpoint
 UMOTransformer getTransformer()
          The transformer is responsible for transforming data when it is received or sent by the UMO (depending on whether this endpoint is a receiver or not).
 String getType()
          Determines whether the message endpoint is a sender or receiver or both.
 int hashCode()
           
protected  void initFromDescriptor(UMOImmutableEndpoint source)
           
 void initialise()
          Method used to perform any initialisation work.
 boolean isDeleteUnacceptedMessages()
          If a filter is configured on this endpoint, this property will determine if message that are not excepted by the filter are deleted
 boolean isReadOnly()
           
 boolean isRemoteSync()
          For certain providers that support the notion of a backchannel such as sockets (outputStream) or Jms (ReplyTo) Mule can automatically wait for a response from a backchannel when dispatching over these protocols.
 boolean isStreaming()
          Determines whether the endpoint should deal with requests as streams
 boolean isSynchronous()
          Determines if requests originating from this endpoint should be synchronous i.e.
 boolean isSynchronousSet()
          Determines if the synchronous porperty has been set on the endpoint
 UMOMessage receive(long timeout)
          Make a specific request to the underlying transport
 UMOMessage send(UMOEvent event)
          Sends an event from the endpoint to the external system
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final Log logger
logger used by this class


connector

protected UMOConnector connector
The endpoint used to communicate with the external system


endpointUri

protected UMOEndpointURI endpointUri
The endpointUri on which to send or receive information


transformer

protected UMOTransformer transformer
The transformer used to transform the incoming or outgoing data


responseTransformer

protected UMOTransformer responseTransformer
The transformer used to transform the incoming or outgoing data


name

protected String name
The name for the endpoint


type

protected String type
Determines whether the endpoint is a receiver or sender or both


properties

protected Map properties
Any additional properties for the endpoint


transactionConfig

protected UMOTransactionConfig transactionConfig
The transaction configuration for this endpoint


filter

protected UMOFilter filter
event filter for this endpoint


deleteUnacceptedMessages

protected boolean deleteUnacceptedMessages
determines whether unaccepted filtered events should be removed from the source. If they are not removed its up to the Message receiver to handle recieving the same message again


initialised

protected AtomicBoolean initialised
has this endpoint been initialised


securityFilter

protected UMOEndpointSecurityFilter securityFilter
The security filter to apply to this endpoint


synchronous

protected Boolean synchronous
whether events received by this endpoint should execute in a single thread


remoteSync

protected Boolean remoteSync
Determines whether a synchronous call should block to obtain a response from a remote server (if the transport supports it). For example for Jms endpoints, setting remote sync will cause a temporary destination to be set up as a replyTo destination and will send the message a wait for a response on the replyTo destination. If the JMSReplyTo is already set on the message that destination will be used instead.


remoteSyncTimeout

protected Integer remoteSyncTimeout
How long to block when performing a remote synchronisation to a remote host. This property is optional and will be set to the default Synchonous Event time out value if not set


streaming

protected boolean streaming
Determines whether the endpoint should deal with requests as streams


initialState

protected String initialState
The state that the endpoint is initialised in such as started or stopped


endpointEncoding

protected String endpointEncoding

createConnector

protected int createConnector
determines if a new connector should be created for this endpoint

Constructor Detail

ImmutableMuleEndpoint

public ImmutableMuleEndpoint(String name,
                             UMOEndpointURI endpointUri,
                             UMOConnector connector,
                             UMOTransformer transformer,
                             String type,
                             int createConnector,
                             String endpointEncoding,
                             Map props)

ImmutableMuleEndpoint

public ImmutableMuleEndpoint(UMOImmutableEndpoint source)

ImmutableMuleEndpoint

public ImmutableMuleEndpoint(String endpointName,
                             boolean receiver)
                      throws UMOException
Method Detail

initFromDescriptor

protected void initFromDescriptor(UMOImmutableEndpoint source)

getEndpointURI

public UMOEndpointURI getEndpointURI()
Description copied from interface: UMOImmutableEndpoint
This specifes the communication endpointUri. This will have a different format depending on the transport protocol being used i.e.

if an endpointUri is not specifed it will be assumed that it will be determined at run-time by the calling application. The endpointUri can be aliteral endpointUri such as an email address or it can be a logical name for an endpointUri as long as it is declared in a message-endpointUri block. When the message-provider is created the endpointUri is first lookup in the endpointUri registry and if nothing is returned the endpointUri value itself is used.

Specified by:
getEndpointURI in interface UMOImmutableEndpoint
Returns:
the endpointUri on which the endpoint sends or receives data

getEncoding

public String getEncoding()
Description copied from interface: UMOImmutableEndpoint
Decides the encoding to be used for events received by this endpoint

Specified by:
getEncoding in interface UMOImmutableEndpoint
Returns:
the encoding set on the endpoint or null if no codin has been specified

getType

public String getType()
Description copied from interface: UMOImmutableEndpoint
Determines whether the message endpoint is a sender or receiver or both. The possible values are- The default is 'senderAndReceiver'.

Specified by:
getType in interface UMOImmutableEndpoint
Returns:
the endpoint type

getConnector

public UMOConnector getConnector()
Description copied from interface: UMOImmutableEndpoint
The endpoint that will be used to send the message on. It is important that the endpointUri and the connection correlate i.e. if your endpointUri is a jms queue your connection must be a JMS endpoint.

Specified by:
getConnector in interface UMOImmutableEndpoint
Returns:
the endpoint associated with the endpoint

getName

public String getName()
Description copied from interface: UMOImmutableEndpoint
The name is the identifier for the endpoint

Specified by:
getName in interface UMOImmutableEndpoint
Returns:
the endpoint name

getTransformer

public UMOTransformer getTransformer()
Description copied from interface: UMOImmutableEndpoint
The transformer is responsible for transforming data when it is received or sent by the UMO (depending on whether this endpoint is a receiver or not). A tranformation for an inbound event can be forced by the user by calling the inbound event.getTransformedMessage(). A tranformation for an outbound event is called or when the UMO dispatchEvent() or sendEvent() methods are called.

This attribute represents the name of the transformer to use as declared in the transformers section of the configuration file. IF a name for the transformer is not set on the configuration element, it will default to the name of the className attribute minus the package name.

Specified by:
getTransformer in interface UMOImmutableEndpoint
Returns:
the transformer to use when receiving or sending data

getProperties

public Map getProperties()
Description copied from interface: UMOImmutableEndpoint
Returns any properties set on this endpoint

Specified by:
getProperties in interface UMOImmutableEndpoint
Returns:
a map of properties for this endpoint

clone

public Object clone()
Description copied from interface: UMOImmutableEndpoint
Make a deep copy of this endpoint

Specified by:
clone in interface UMOImmutableEndpoint

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface UMOImmutableEndpoint
Returns:
true if this endpoint is read-only and none of it's properties can change. Global endpoints should be read-only so that unexpected behaviour is avoided.

toString

public String toString()

getProtocol

public String getProtocol()
Description copied from interface: UMOImmutableEndpoint
The transport protocol name that the message endpoint communicates over. i.e. jms, sms, smtp etc. The protocol must match that of the associated endpoint

Specified by:
getProtocol in interface UMOImmutableEndpoint
Returns:
the protocol name

canReceive

public boolean canReceive()
Description copied from interface: UMOImmutableEndpoint
Determines whether this endpoint can be used to receive events

Specified by:
canReceive in interface UMOImmutableEndpoint
Returns:
true if it has been configured to receive events, false otherwise

canSend

public boolean canSend()
Description copied from interface: UMOImmutableEndpoint
Determines whether this endpoint can be used to send events

Specified by:
canSend in interface UMOImmutableEndpoint
Returns:
true if it has been configured to send events, false otherwise

getTransactionConfig

public UMOTransactionConfig getTransactionConfig()
Description copied from interface: UMOImmutableEndpoint
Returns the transaction configuration for this endpoint

Specified by:
getTransactionConfig in interface UMOImmutableEndpoint
Returns:
the transaction configuration for this endpoint or null if the endpoint is not transactional

equals

public boolean equals(Object o)

hashCode

public int hashCode()

getFilter

public UMOFilter getFilter()
Description copied from interface: UMOImmutableEndpoint
The filter to apply to incoming messages. Only applies when the endpoint endpointUri is a receiver

Specified by:
getFilter in interface UMOImmutableEndpoint
Returns:
the UMOFilter to use or null if one is not set

createEndpointFromUri

public static UMOEndpoint createEndpointFromUri(UMOEndpointURI uri,
                                                String type)
                                         throws UMOException
Throws:
UMOException

getEndpointFromUri

public static UMOEndpoint getEndpointFromUri(String uri)

getEndpointFromUri

public static UMOEndpoint getEndpointFromUri(UMOEndpointURI uri)
                                      throws UMOException
Throws:
UMOException

getOrCreateEndpointForUri

public static UMOEndpoint getOrCreateEndpointForUri(String uriIdentifier,
                                                    String type)
                                             throws UMOException
Throws:
UMOException

getOrCreateEndpointForUri

public static UMOEndpoint getOrCreateEndpointForUri(UMOEndpointURI uri,
                                                    String type)
                                             throws UMOException
Throws:
UMOException

isDeleteUnacceptedMessages

public boolean isDeleteUnacceptedMessages()
Description copied from interface: UMOImmutableEndpoint
If a filter is configured on this endpoint, this property will determine if message that are not excepted by the filter are deleted

Specified by:
isDeleteUnacceptedMessages in interface UMOImmutableEndpoint
Returns:
true if message should be deleted, false otherwise

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an 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.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown

getSecurityFilter

public UMOEndpointSecurityFilter getSecurityFilter()
Returns an UMOEndpointSecurityFilter for this endpoint. If one is not set, there will be no authentication on events sent via this endpoint

Specified by:
getSecurityFilter in interface UMOImmutableEndpoint
Returns:
UMOEndpointSecurityFilter responsible for authenticating message flow via this endpoint.
See Also:
UMOEndpointSecurityFilter

isSynchronous

public boolean isSynchronous()
Determines if requests originating from this endpoint should be synchronous i.e. execute in a single thread and possibly return an result. This property is only used when the endpoint is of type 'receiver'

Specified by:
isSynchronous in interface UMOImmutableEndpoint
Returns:
whether requests on this endpoint should execute in a single thread. This property is only used when the endpoint is of type 'receiver'

isSynchronousSet

public boolean isSynchronousSet()
Description copied from interface: UMOImmutableEndpoint
Determines if the synchronous porperty has been set on the endpoint

Specified by:
isSynchronousSet in interface UMOImmutableEndpoint
Returns:

getCreateConnector

public int getCreateConnector()
Description copied from interface: UMOImmutableEndpoint
Determines if a new connector is created for this endpoint or an exising one must already be present

Specified by:
getCreateConnector in interface UMOImmutableEndpoint
Returns:

isRemoteSync

public boolean isRemoteSync()
For certain providers that support the notion of a backchannel such as sockets (outputStream) or Jms (ReplyTo) Mule can automatically wait for a response from a backchannel when dispatching over these protocols. This is different for synchronous as synchronous behavior only applies to in

Specified by:
isRemoteSync in interface UMOImmutableEndpoint
Returns:

getRemoteSyncTimeout

public int getRemoteSyncTimeout()
The timeout value for remoteSync invocations

Specified by:
getRemoteSyncTimeout in interface UMOImmutableEndpoint
Returns:
the timeout in milliseconds

getInitialState

public String getInitialState()
Sets the state the endpoint will be loaded in. The States are 'stopped' and 'started' (default)

Specified by:
getInitialState in interface UMOImmutableEndpoint
Returns:
the endpoint starting state

getResponseTransformer

public UMOTransformer getResponseTransformer()
Description copied from interface: UMOImmutableEndpoint
The transformer used when a response is returned from invoking this endpoint

Specified by:
getResponseTransformer in interface UMOImmutableEndpoint
Returns:
the transformer to use when receiving the response data

isStreaming

public boolean isStreaming()
Determines whether the endpoint should deal with requests as streams

Specified by:
isStreaming in interface UMOImmutableEndpoint
Returns:
true if the request should be streamed

getProperty

public Object getProperty(Object key)
Description copied from interface: UMOImmutableEndpoint
Retrieves a property set on the endpoint

Specified by:
getProperty in interface UMOImmutableEndpoint
Parameters:
key - the name of the property
Returns:
the property value or null if it does not exist

dispatch

public void dispatch(UMOEvent event)
              throws DispatchException
Description copied from interface: UMOMessageDispatching
Dispatches an event from the endpoint to the external system

Specified by:
dispatch in interface UMOMessageDispatching
Parameters:
event - The event to dispatch
Throws:
DispatchException - if the event fails to be dispatched

receive

public UMOMessage receive(long timeout)
                   throws Exception
Description copied from interface: UMOMessageDispatching
Make a specific request to the underlying transport

Specified by:
receive in interface UMOMessageDispatching
Parameters:
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 UMOMessage object. Null will be returned if no data was avaialable
Throws:
Exception - if the call to the underlying protocal cuases an exception

send

public UMOMessage send(UMOEvent event)
                throws DispatchException
Description copied from interface: UMOMessageDispatching
Sends an event from the endpoint to the external system

Specified by:
send in interface UMOMessageDispatching
Parameters:
event - The event to send
Returns:
event the response form the external system wrapped in a UMOEvent
Throws:
DispatchException - if the event fails to be dispatched


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