Joram ${version}

org.objectweb.joram.client.connector
Class ManagedConnectionImpl

java.lang.Object
  extended byorg.objectweb.joram.client.connector.ManagedConnectionImpl
All Implemented Interfaces:
javax.jms.ExceptionListener, javax.resource.spi.LocalTransaction, javax.resource.spi.ManagedConnection

public class ManagedConnectionImpl
extends java.lang.Object
implements javax.resource.spi.ManagedConnection, javax.resource.spi.LocalTransaction, javax.jms.ExceptionListener

A ManagedConnectionImpl instance wraps a physical connection to an underlying JORAM server, and provides "handles" for handling this physical connection.


Method Summary
 void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
          Adds a connection event listener.
 void associateConnection(java.lang.Object connection)
          Dissociates a given connection handle and associates it to this managed connection.
 void begin()
          Notifies that the local transaction is beginning.
 void cleanup()
          Invalidates the created handles and prepares the physical connection to be put back into a connection pool.
 void commit()
          Commits the local transaction.
 void destroy()
          Destroys the physical connection to the underlying JORAM server.
 boolean equals(java.lang.Object o)
          Compares ManagedConnectionImpl instances according to their server and user identification parameters.
 java.lang.Object getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          Returns a new OutboundConnection instance for handling the physical connection.
 javax.resource.spi.LocalTransaction getLocalTransaction()
          Returns this managed connection instance as a LocalTransaction instance for managing local transactions.
 java.io.PrintWriter getLogWriter()
          Gets the log writer for this ManagedConnectionImpl instance.
 javax.resource.spi.ManagedConnectionMetaData getMetaData()
          Returns the metadata information for the underlying JORAM server.
 javax.transaction.xa.XAResource getXAResource()
          Provides a XAResource instance for managing distributed transactions.
 int hashCode()
          Returns a code based on the JORAM server and user identification parameters.
 void onException(javax.jms.JMSException exc)
          Notifies that the wrapped physical connection has been lost.
 void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
          Removes a connection event listener.
 void rollback()
          Rollsback the local transaction.
 void setLogWriter(java.io.PrintWriter out)
          Sets the log writer for this ManagedConnectionImpl instance.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                               throws javax.resource.ResourceException
Returns a new OutboundConnection instance for handling the physical connection.

Specified by:
getConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.spi.CommException - If the wrapped physical connection is lost.
javax.resource.ResourceException

associateConnection

public void associateConnection(java.lang.Object connection)
                         throws javax.resource.ResourceException
Dissociates a given connection handle and associates it to this managed connection.

Specified by:
associateConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.spi.CommException - If the wrapped physical connection is lost.
javax.resource.ResourceException - If the provided handle is invalid.

addConnectionEventListener

public void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Adds a connection event listener.

Specified by:
addConnectionEventListener in interface javax.resource.spi.ManagedConnection

removeConnectionEventListener

public void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
Removes a connection event listener.

Specified by:
removeConnectionEventListener in interface javax.resource.spi.ManagedConnection

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws javax.resource.ResourceException
Provides a XAResource instance for managing distributed transactions.

Specified by:
getXAResource in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.spi.CommException - If the physical connection is lost.
javax.resource.spi.IllegalStateException - If the managed connection is involved in a local transaction.
javax.resource.spi.ResourceAdapterInternalException - If the XA resource can't be retrieved.
javax.resource.ResourceException

getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException
Returns this managed connection instance as a LocalTransaction instance for managing local transactions.

Specified by:
getLocalTransaction in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.spi.CommException - If the physical connection is lost.
javax.resource.spi.IllegalStateException - If the managed connection is involved in a distributed transaction.
javax.resource.spi.LocalTransactionException - If the LocalTransaction resource can't be created.
javax.resource.ResourceException

getMetaData

public javax.resource.spi.ManagedConnectionMetaData getMetaData()
                                                         throws javax.resource.ResourceException
Returns the metadata information for the underlying JORAM server.

Specified by:
getMetaData in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - Never thrown.

setLogWriter

public void setLogWriter(java.io.PrintWriter out)
                  throws javax.resource.ResourceException
Sets the log writer for this ManagedConnectionImpl instance.

Specified by:
setLogWriter in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - Never thrown.

getLogWriter

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

Specified by:
getLogWriter in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - Never thrown.

cleanup

public void cleanup()
             throws javax.resource.ResourceException
Invalidates the created handles and prepares the physical connection to be put back into a connection pool.

Specified by:
cleanup in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - Never thrown.

destroy

public void destroy()
             throws javax.resource.ResourceException
Destroys the physical connection to the underlying JORAM server.

Specified by:
destroy in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException - Never thrown.

hashCode

public int hashCode()
Returns a code based on the JORAM server and user identification parameters.


equals

public boolean equals(java.lang.Object o)
Compares ManagedConnectionImpl instances according to their server and user identification parameters.


onException

public void onException(javax.jms.JMSException exc)
Notifies that the wrapped physical connection has been lost.

Specified by:
onException in interface javax.jms.ExceptionListener

begin

public void begin()
           throws javax.resource.ResourceException
Notifies that the local transaction is beginning.

Specified by:
begin in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.spi.CommException - If the wrapped physical connection is lost.
javax.resource.spi.LocalTransactionException - If a local transaction has already begun.
javax.resource.ResourceException

commit

public void commit()
            throws javax.resource.ResourceException
Commits the local transaction.

Specified by:
commit in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.spi.CommException - If the wrapped physical connection is lost.
javax.resource.spi.LocalTransactionException - If the local transaction has not begun, or if the commit fails.
javax.resource.ResourceException

rollback

public void rollback()
              throws javax.resource.ResourceException
Rollsback the local transaction.

Specified by:
rollback in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.spi.CommException - If the wrapped physical connection is lost.
javax.resource.spi.LocalTransactionException - If the local transaction has not begun, or if the rollback fails.
javax.resource.ResourceException

Joram ${version}

Copyright ? 2005 Scalagent - All rights reserved