org.mule.module.jca
Class DefaultMuleConnection

java.lang.Object
  extended by org.mule.module.jca.DefaultMuleConnection
All Implemented Interfaces:
MuleConnection

public class DefaultMuleConnection
extends Object
implements MuleConnection

MuleConnection TODO


Constructor Summary
DefaultMuleConnection(MuleManagedConnection managedConnection, MuleContext muleContext, MuleCredentials credentials)
           
 
Method Summary
 void associateConnection(MuleManagedConnection newMc)
          Associates connection handle with new managed connection.
 void close()
          Closes the connection.
 void dispatch(String url, Object payload, Map messageProperties)
          Dispatches an event asynchronously to a endpointUri via a mule server.
protected  MuleEvent getEvent(MuleMessage message, OutboundEndpoint endpoint)
          Packages a mule event for the current request
 MuleManagedConnection getManagedConnection()
          Retrieves a ManagedConnection.
protected  OutboundEndpoint getOutboundEndpoint(String uri, MessageExchangePattern exchangePattern)
           
 MuleMessage request(String url, long timeout)
          Will receive an event from an endpointUri determined by the url
 MuleMessage send(String url, Object payload, Map messageProperties)
          Sends an object (payload) synchronous to the given url and returns a MuleMessage response back.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMuleConnection

public DefaultMuleConnection(MuleManagedConnection managedConnection,
                             MuleContext muleContext,
                             MuleCredentials credentials)
Method Detail

dispatch

public void dispatch(String url,
                     Object payload,
                     Map messageProperties)
              throws MuleException
Dispatches an event asynchronously to a endpointUri via a mule server. the Url determines where to dispathc the event to, this can be in the form of

Specified by:
dispatch in interface MuleConnection
Parameters:
url - the Mule url used to determine the destination and transport of the message
payload - the object that is the payload of the event
messageProperties - any properties to be associated with the payload. In the case of Jms you could set the JMSReplyTo property in these properties.
Throws:
MuleException

send

public MuleMessage send(String url,
                        Object payload,
                        Map messageProperties)
                 throws MuleException
Sends an object (payload) synchronous to the given url and returns a MuleMessage response back.

Specified by:
send in interface MuleConnection
Parameters:
url - the Mule url used to determine the destination and transport of the message
payload - the object that is the payload of the event
messageProperties - any properties to be associated with the payload. In the case of Jms you could set the JMSReplyTo property in these properties.
Returns:
a response.
Throws:
MuleException

request

public MuleMessage request(String url,
                           long timeout)
                    throws MuleException
Will receive an event from an endpointUri determined by the url

Specified by:
request in interface MuleConnection
Parameters:
url - the Mule url used to determine the destination and transport of the message
timeout - how long to block waiting to receive the event, if set to 0 the receive will not wait at all and if set to -1 the receive will wait forever
Returns:
the message received or null if no message was received
Throws:
MuleException

getOutboundEndpoint

protected OutboundEndpoint getOutboundEndpoint(String uri,
                                               MessageExchangePattern exchangePattern)
                                        throws MuleException
Throws:
MuleException

getEvent

protected MuleEvent getEvent(MuleMessage message,
                             OutboundEndpoint endpoint)
                      throws MuleException
Packages a mule event for the current request

Throws:
MuleException

getManagedConnection

public MuleManagedConnection getManagedConnection()
Retrieves a ManagedConnection.

Specified by:
getManagedConnection in interface MuleConnection
Returns:
a ManagedConnection instance representing the physical connection to the EIS

close

public void close()
           throws ResourceException
Closes the connection.

Specified by:
close in interface MuleConnection
Throws:
ResourceException

associateConnection

public void associateConnection(MuleManagedConnection newMc)
                         throws ResourceException
Associates connection handle with new managed connection.

Specified by:
associateConnection in interface MuleConnection
Parameters:
newMc - new managed connection
Throws:
ResourceException


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.