org.enhydra.jdbc.pool
Class StandardXAPoolDataSource

java.lang.Object
  extended by org.enhydra.jdbc.util.JdbcUtil
      extended by org.enhydra.jdbc.core.CoreDataSource
          extended by org.enhydra.jdbc.pool.StandardPoolDataSource
              extended by org.enhydra.jdbc.pool.StandardXAPoolDataSource
All Implemented Interfaces:
java.io.Serializable, java.sql.Wrapper, java.util.EventListener, javax.naming.Referenceable, javax.naming.spi.ObjectFactory, javax.sql.CommonDataSource, javax.sql.ConnectionEventListener, javax.sql.DataSource, PoolHelper

public class StandardXAPoolDataSource
extends StandardPoolDataSource

StandardXAPoolDataSource class allows to make some operations on XAConnection. It implements PoolHelper for the 3 methods :

create : create an XAConnection

create(user,password) : create a PooledConnection with an other user/password

testThisObject : check if the object is still valid

checkThisObject : check if the object is closed

expire : kill the object

See Also:
Serialized Form

Field Summary
 Log glog
           
 javax.transaction.TransactionManager transactionManager
           
 javax.sql.XADataSource xads
           
 
Fields inherited from class org.enhydra.jdbc.pool.StandardPoolDataSource
cpds, dataSourceName, ictx, jdbcTestStmt, onOff, pool
 
Fields inherited from class org.enhydra.jdbc.core.CoreDataSource
logWriter, password, user
 
Fields inherited from class org.enhydra.jdbc.util.JdbcUtil
log
 
Constructor Summary
StandardXAPoolDataSource()
          Constructor
StandardXAPoolDataSource(int initSize)
          Constructor
StandardXAPoolDataSource(StandardXADataSource ds)
          Constructor
StandardXAPoolDataSource(StandardXADataSource ds, int initSize)
          Constructor
 
Method Summary
 void connectionClosed(javax.sql.ConnectionEvent event)
          Invoked when the application calls close() on its representation of the connection
 GenerationObject create(java.lang.String _user, java.lang.String _password)
           
 javax.sql.XADataSource getDataSource()
          Getter for property dataSource.
 java.lang.Object getObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable env)
          Methods inherited from ObjectFactory
 javax.naming.Reference getReference()
          Retrieves the Reference of this object.
 void setDataSource(javax.sql.XADataSource dataSource)
          Setter for property dataSource.
 void setTransactionManager(javax.transaction.TransactionManager tm)
           
 boolean testThisObject(java.lang.Object o)
          This method tests if a connection is valid or not.
 java.lang.String toString()
           
 
Methods inherited from class org.enhydra.jdbc.pool.StandardPoolDataSource
checkThisObject, connectionErrorOccurred, create, expire, getCheckLevelObject, getConnection, getConnection, getDataSourceName, getDeadLockMaxWait, getDeadLockRetryWait, getGeneration, getJdbcTestStmt, getLifeTime, getLockedObjectCount, getLogWriter, getMaxSize, getMinSize, getSleepTime, getUnlockedObjectCount, isGC, setCheckLevelObject, setDataSourceName, setDeadLockMaxWait, setDeadLockRetryWait, setDebug, setGC, setGeneration, setJdbcTestStmt, setLifeTime, setLogWriter, setMaxSize, setMinSize, setSleepTime, setThreadFactory, shutdown, stopPool
 
Methods inherited from class org.enhydra.jdbc.core.CoreDataSource
getDescription, getLoginTimeout, getPassword, getThreadFactory, getUser, isDebug, isVerbose, setDescription, setLoginTimeout, setPassword, setUser, setVerbose
 
Methods inherited from class org.enhydra.jdbc.util.JdbcUtil
setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.sql.CommonDataSource
getLoginTimeout, setLoginTimeout
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Field Detail

xads

public javax.sql.XADataSource xads

transactionManager

public javax.transaction.TransactionManager transactionManager

glog

public Log glog
Constructor Detail

StandardXAPoolDataSource

public StandardXAPoolDataSource()
Constructor


StandardXAPoolDataSource

public StandardXAPoolDataSource(int initSize)
Constructor


StandardXAPoolDataSource

public StandardXAPoolDataSource(StandardXADataSource ds)
Constructor


StandardXAPoolDataSource

public StandardXAPoolDataSource(StandardXADataSource ds,
                                int initSize)
Constructor

Method Detail

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager tm)

connectionClosed

public void connectionClosed(javax.sql.ConnectionEvent event)
Invoked when the application calls close() on its representation of the connection

Specified by:
connectionClosed in interface javax.sql.ConnectionEventListener
Overrides:
connectionClosed in class StandardPoolDataSource

create

public GenerationObject create(java.lang.String _user,
                               java.lang.String _password)
                        throws java.sql.SQLException
Specified by:
create in interface PoolHelper
Overrides:
create in class StandardPoolDataSource
Throws:
java.sql.SQLException

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.NamingException
Retrieves the Reference of this object. Used at binding time by JNDI to build a reference on this object.

Specified by:
getReference in interface javax.naming.Referenceable
Overrides:
getReference in class StandardPoolDataSource
Returns:
The non-null Reference of this object.
Throws:
javax.naming.NamingException - If a naming exception was encountered while retrieving the reference.

getObjectInstance

public java.lang.Object getObjectInstance(java.lang.Object refObj,
                                          javax.naming.Name name,
                                          javax.naming.Context nameCtx,
                                          java.util.Hashtable env)
                                   throws java.lang.Exception
Description copied from class: CoreDataSource
Methods inherited from ObjectFactory

Specified by:
getObjectInstance in interface javax.naming.spi.ObjectFactory
Overrides:
getObjectInstance in class StandardPoolDataSource
Throws:
java.lang.Exception

getDataSource

public javax.sql.XADataSource getDataSource()
Getter for property dataSource.

Returns:
Value of property dataSource.

setDataSource

public void setDataSource(javax.sql.XADataSource dataSource)
Setter for property dataSource.

Parameters:
dataSource - New value of property dataSource.

toString

public java.lang.String toString()
Specified by:
toString in interface PoolHelper
Overrides:
toString in class StandardPoolDataSource

testThisObject

public boolean testThisObject(java.lang.Object o)
This method tests if a connection is valid or not. It overrides the method in StandardPoolDataSource to take into account global transactions: if global transaction is in progress - suspend it so that connection testing happens ouside of transaction. If connection testing fails - it will not affect transaction and next good connection can join the transaction

Specified by:
testThisObject in interface PoolHelper
Overrides:
testThisObject in class StandardPoolDataSource