org.objectweb.jonas.jdbc
Class ManagedConnectionImpl

java.lang.Object
  extended by org.objectweb.jonas.jdbc.ManagedConnectionImpl
All Implemented Interfaces:
javax.resource.spi.LocalTransaction, javax.resource.spi.ManagedConnection

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

Author:
Eric hardesty

Field Summary
protected  java.util.HashSet cels
           
protected  javax.sql.DataSource factory
           
protected  boolean inLocalTransaction
           
protected  java.io.PrintWriter out
           
 org.objectweb.util.monolog.api.Logger trace
           
 
Constructor Summary
ManagedConnectionImpl(ManagedConnectionFactoryImpl _mcf, javax.resource.spi.security.PasswordCredential _pc, java.sql.Connection _con, javax.sql.PooledConnection _pcon, javax.sql.XAConnection _xa, org.objectweb.jonas.jdbc.DriverWrapper wrp)
           
 
Method Summary
 void addConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
          Adds a connection event listener.
 void addSignature(long sig)
           
 void associateConnection(java.lang.Object con)
          Change the association of a connection handle
 void begin()
           
 void cleanup()
          Cleanup the ManagedConnection instance.
 void clearSignature()
           
 void clearSignature(long sig, boolean clear)
           
 void close(ConnectionImpl ch)
           
 void commit()
           
 void destroy()
          Destroys the physical connection.
 boolean getAutoCommit()
           
 java.lang.Object getConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
          Create a connection handle
 javax.resource.spi.LocalTransaction getLocalTransaction()
          Returns an javax.resource.spi.LocalTransaction instance.
 java.io.PrintWriter getLogWriter()
          Gets the log writer for this ManagedConnection instance.
 javax.resource.spi.ManagedConnectionMetaData getMetaData()
          Gets the metadata information for this connection's underlying EIS resource manager instance.
 long getNewSignature(boolean setSig)
          Gets the next signature value
 long getSignature()
          Gets the current signature value
 long getSignature(long sig)
          Gets the signature value passed in if found in the signature hash table
 javax.transaction.xa.XAResource getXAResource()
          Check if the mc is in local transaction
 void removeConnectionEventListener(javax.resource.spi.ConnectionEventListener listener)
          Removes an already registered connection event listener from the ManagedConnection instance
 void rollback()
           
 void setAutoCommit(boolean ac)
           
 void setLogWriter(java.io.PrintWriter _out)
          Sets the log writer for this ManagedConnection instance.
 void setSignature(long sig)
           
 void signalEvent(int code, java.lang.Object ch, java.lang.Exception ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trace

public org.objectweb.util.monolog.api.Logger trace

out

protected java.io.PrintWriter out

factory

protected javax.sql.DataSource factory

cels

protected java.util.HashSet cels

inLocalTransaction

protected boolean inLocalTransaction
Constructor Detail

ManagedConnectionImpl

public ManagedConnectionImpl(ManagedConnectionFactoryImpl _mcf,
                             javax.resource.spi.security.PasswordCredential _pc,
                             java.sql.Connection _con,
                             javax.sql.PooledConnection _pcon,
                             javax.sql.XAConnection _xa,
                             org.objectweb.jonas.jdbc.DriverWrapper wrp)
Method Detail

signalEvent

public void signalEvent(int code,
                        java.lang.Object ch,
                        java.lang.Exception ex)

getAutoCommit

public boolean getAutoCommit()
                      throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

setAutoCommit

public void setAutoCommit(boolean ac)
                   throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

addConnectionEventListener

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

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

associateConnection

public void associateConnection(java.lang.Object con)
                         throws javax.resource.ResourceException
Change the association of a connection handle

Specified by:
associateConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

cleanup

public void cleanup()
             throws javax.resource.ResourceException
Cleanup the ManagedConnection instance.

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

destroy

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

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

getConnection

public java.lang.Object getConnection(javax.security.auth.Subject subject,
                                      javax.resource.spi.ConnectionRequestInfo cxRequestInfo)
                               throws javax.resource.ResourceException
Create a connection handle

Specified by:
getConnection in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException
Returns an javax.resource.spi.LocalTransaction instance.

Specified by:
getLocalTransaction in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getLogWriter

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

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

getMetaData

public javax.resource.spi.ManagedConnectionMetaData getMetaData()
                                                         throws javax.resource.ResourceException
Gets the metadata information for this connection's underlying EIS resource manager instance.

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

getXAResource

public javax.transaction.xa.XAResource getXAResource()
                                              throws javax.resource.ResourceException
Check if the mc is in local transaction

Specified by:
getXAResource in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

removeConnectionEventListener

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

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

setLogWriter

public void setLogWriter(java.io.PrintWriter _out)
Sets the log writer for this ManagedConnection instance.

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

addSignature

public void addSignature(long sig)

clearSignature

public void clearSignature()

clearSignature

public void clearSignature(long sig,
                           boolean clear)

setSignature

public void setSignature(long sig)

getSignature

public long getSignature(long sig)
Gets the signature value passed in if found in the signature hash table

Parameters:
long - sig value to find in signature table
Returns:
long signature value or 0 if not found

getSignature

public long getSignature()
Gets the current signature value

Returns:
long current signature value

getNewSignature

public long getNewSignature(boolean setSig)
Gets the next signature value

Returns:
long next signature value

close

public void close(ConnectionImpl ch)
           throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

begin

public void begin()
           throws javax.resource.ResourceException
Specified by:
begin in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException

commit

public void commit()
            throws javax.resource.ResourceException
Specified by:
commit in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException

rollback

public void rollback()
              throws javax.resource.ResourceException
Specified by:
rollback in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException