org.objectweb.jonas.jdbc
Class ManagedConnectionImpl

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

public class ManagedConnectionImpl
extends Object
implements ManagedConnection, LocalTransaction

Author:
Eric hardesty

Field Summary
protected  HashSet cels
           
protected  DataSource factory
           
protected  boolean inLocalTransaction
           
protected  PrintWriter out
           
 org.objectweb.util.monolog.api.Logger trace
           
 
Constructor Summary
ManagedConnectionImpl(ManagedConnectionFactoryImpl _mcf, PasswordCredential _pc, Connection _con, PooledConnection _pcon, XAConnection _xa, org.objectweb.jonas.jdbc.DriverWrapper wrp)
           
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener listener)
          Adds a connection event listener.
 void addSignature(long sig)
           
 void associateConnection(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()
           
 Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
          Create a connection handle
 LocalTransaction getLocalTransaction()
          Returns an javax.resource.spi.LocalTransaction instance.
 PrintWriter getLogWriter()
          Gets the log writer for this ManagedConnection instance.
 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
 XAResource getXAResource()
          Check if the mc is in local transaction
 void removeConnectionEventListener(ConnectionEventListener listener)
          Removes an already registered connection event listener from the ManagedConnection instance
 void rollback()
           
 void setAutoCommit(boolean ac)
           
 void setLogWriter(PrintWriter _out)
          Sets the log writer for this ManagedConnection instance.
 void setSignature(long sig)
           
 void signalEvent(int code, Object ch, 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 PrintWriter out

factory

protected DataSource factory

cels

protected HashSet cels

inLocalTransaction

protected boolean inLocalTransaction
Constructor Detail

ManagedConnectionImpl

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

signalEvent

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

getAutoCommit

public boolean getAutoCommit()
                      throws ResourceException
Throws:
ResourceException

setAutoCommit

public void setAutoCommit(boolean ac)
                   throws ResourceException
Throws:
ResourceException

addConnectionEventListener

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

Specified by:
addConnectionEventListener in interface ManagedConnection

associateConnection

public void associateConnection(Object con)
                         throws ResourceException
Change the association of a connection handle

Specified by:
associateConnection in interface ManagedConnection
Throws:
ResourceException

cleanup

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

Specified by:
cleanup in interface ManagedConnection
Throws:
ResourceException

destroy

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

Specified by:
destroy in interface ManagedConnection
Throws:
ResourceException

getConnection

public Object getConnection(Subject subject,
                            ConnectionRequestInfo cxRequestInfo)
                     throws ResourceException
Create a connection handle

Specified by:
getConnection in interface ManagedConnection
Throws:
ResourceException

getLocalTransaction

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

Specified by:
getLocalTransaction in interface ManagedConnection
Throws:
ResourceException

getLogWriter

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

Specified by:
getLogWriter in interface ManagedConnection

getMetaData

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

Specified by:
getMetaData in interface ManagedConnection
Throws:
ResourceException

getXAResource

public XAResource getXAResource()
                         throws ResourceException
Check if the mc is in local transaction

Specified by:
getXAResource in interface ManagedConnection
Throws:
ResourceException

removeConnectionEventListener

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

Specified by:
removeConnectionEventListener in interface ManagedConnection

setLogWriter

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

Specified by:
setLogWriter in interface 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 ResourceException
Throws:
ResourceException

begin

public void begin()
           throws ResourceException
Specified by:
begin in interface LocalTransaction
Throws:
ResourceException

commit

public void commit()
            throws ResourceException
Specified by:
commit in interface LocalTransaction
Throws:
ResourceException

rollback

public void rollback()
              throws ResourceException
Specified by:
rollback in interface LocalTransaction
Throws:
ResourceException


Copyright © 2007 OW2 Consortium. All Rights Reserved.