org.mule.ra
Class MuleManagedConnection

java.lang.Object
  extended byorg.mule.ra.MuleManagedConnection

public class MuleManagedConnection
extends java.lang.Object

MuleManagedConnection TODO

Version:
$Revision: 1.4 $
Author:
Ross Mason

Field Summary
protected static Log logger
          logger used by this class
 
Method Summary
 void addConnection(MuleConnection connection)
          Associate connection handle with the physical connection.
 void addConnectionEventListener(ConnectionEventListener listener)
          Adds a connection event listener to the ManagedConnection instance.
 void associateConnection(java.lang.Object connection)
          Used by the container to change the association of an application-level connection handle with a ManagedConnection instance.
 void cleanup()
          Initiates a cleanup of the client-specific state maintained by a ManagedConnection instance.
 void destroy()
          Destroys the physical connection.
 java.lang.Object getConnection(javax.security.auth.Subject subject, ConnectionRequestInfo connectionRequestInfo)
          Creates a new connection handle to the Mail Server represented by the ManagedConnection instance.
 javax.resource.spi.LocalTransaction getLocalTransaction()
          Returns a javax.resource.spi.LocalTransaction instance.
 java.io.PrintWriter getLogWriter()
          Gets the log writer for this ManagedConnection instance.
 MuleManagedConnectionFactory getManagedConnectionFactory()
          Returns the ManagedConnectionFactory that created this instance of ManagedConnection.
 ManagedConnectionMetaData getMetaData()
          Gets the metadata information for this connection's underlying EIS resource manager instance.
 PasswordCredential getPasswordCredential()
          Gets the password for the user associated with the ManagedConnection instance.
 java.lang.String getUsername()
          Gets the user name of the user associated with the ManagedConnection instance.
 javax.transaction.xa.XAResource getXAResource()
          Returns a javax.transaction.xa.XAresource instance.
 void removeConnection(MuleConnection connection)
          Removes the associated connection handle from the connections set to the physical connection.
 void removeConnectionEventListener(ConnectionEventListener listener)
          Removes an already registered connection event listener from the ManagedConnection instance.
 void setLogWriter(java.io.PrintWriter out)
          Sets the log writer for this ManagedConnection instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static transient Log logger
logger used by this class

Method Detail

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      ConnectionRequestInfo connectionRequestInfo)
                               throws ResourceException
Creates a new connection handle to the Mail Server represented by the ManagedConnection instance. This connection handle is used by the application code to refer to the underlying physical connection.

Parameters:
subject - security context as JAAS subject
connectionRequestInfo - ConnectionRequestInfo instance
Returns:
Connection instance representing the connection handle
Throws:
ResourceException - if the method fails to get a connection

destroy

public void destroy()
             throws ResourceException
Destroys the physical connection.

Throws:
ResourceException - if the method fails to destroy the connection

cleanup

public void cleanup()
             throws ResourceException
Initiates a cleanup of the client-specific state maintained by a ManagedConnection instance. The cleanup should invalidate all connection handles created using this ManagedConnection instance.

Throws:
ResourceException - if the cleanup fails

associateConnection

public void associateConnection(java.lang.Object connection)
                         throws ResourceException
Used by the container to change the association of an application-level connection handle with a ManagedConnection instance. The container should find the right ManagedConnection instance and call the associateConnection method.

Parameters:
connection - application-level connection handle
Throws:
ResourceException - if the attempt to change the association fails

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener listener)
Adds a connection event listener to the ManagedConnection instance. The registered ConnectionEventListener instances are notified of connection close and error events as well as local-transaction-related events on the Managed Connection.

Parameters:
listener - a new ConnectionEventListener to be registered

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)
Removes an already registered connection event listener from the ManagedConnection instance.

Parameters:
listener - already registered connection event listener to be removed

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws ResourceException
Returns a javax.transaction.xa.XAresource instance. An application server enlists this XAResource instance with the Transaction Manager if the ManagedConnection instance is being used in a JTA transaction that is being coordinated by the Transaction Manager.

Because this implementation does not support transactions, the method throws an exception.

Returns:
the XAResource instance
Throws:
ResourceException - if transactions are not supported

getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws ResourceException
Returns a javax.resource.spi.LocalTransaction instance. The LocalTransaction interface is used by the container to manage local transactions for a RM instance.

Because this implementation does not support transactions, the method throws an exception.

Returns:
javax.resource.spi.LocalTransaction instance
Throws:
ResourceException - if transactions are not supported

getMetaData

public ManagedConnectionMetaData getMetaData()
                                      throws ResourceException
Gets the metadata information for this connection's underlying EIS resource manager instance. The ManagedConnectionMetaData interface provides information about the underlying EIS instance associated with the ManagedConnection instance.

Returns:
ManagedConnectionMetaData ManagedConnectionMetaData instance
Throws:
ResourceException - if the metadata cannot be retrieved

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws ResourceException
Sets the log writer for this ManagedConnection instance. The log writer is a character output stream to which all logging and tracing messages for this ManagedConnection instance will be printed.

Parameters:
out - character output stream to be associated
Throws:
ResourceException - if the method fails

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws ResourceException
Gets the log writer for this ManagedConnection instance.

Returns:
the character output stream associated with this ManagedConnection instance
Throws:
ResourceException - if the method fails

getUsername

public java.lang.String getUsername()
Gets the user name of the user associated with the ManagedConnection instance.

Returns:
the username for this connection

getPasswordCredential

public PasswordCredential getPasswordCredential()
Gets the password for the user associated with the ManagedConnection instance.

Returns:
the password for this connection

addConnection

public void addConnection(MuleConnection connection)
Associate connection handle with the physical connection.

Parameters:
connection - connection handle

removeConnection

public void removeConnection(MuleConnection connection)
Removes the associated connection handle from the connections set to the physical connection.

Parameters:
connection - the connection handle

getManagedConnectionFactory

public MuleManagedConnectionFactory getManagedConnectionFactory()
Returns the ManagedConnectionFactory that created this instance of ManagedConnection.

Returns:
the ManagedConnectionFactory for this connection


Copyright © 2003-2005 SymphonySoft Limited. All Rights Reserved.