org.apache.commons.dbcp.managed
Class BasicManagedDataSource

java.lang.Object
  extended by org.apache.commons.dbcp.BasicDataSource
      extended by org.apache.commons.dbcp.managed.BasicManagedDataSource
All Implemented Interfaces:
java.sql.Wrapper, javax.sql.CommonDataSource, javax.sql.DataSource

public class BasicManagedDataSource
extends BasicDataSource

BasicManagedDataSource is an extension of BasicDataSource which creates ManagedConnections. This data source can create either full two-phase-commit XA connections or one-phase-commit local connections. Both types of connections are committed or rolled back as part of the global transaction (a.k.a. XA transaction or JTA Transaction), but only XA connections can be recovered in the case of a system crash.

BasicManagedDataSource adds the TransactionManager and XADataSource properties. The TransactionManager property is required and is used to elist connections in global transactions. The XADataSource is optional and if set is the class name of the XADataSource class for a two-phase-commit JDBC driver. If the XADataSource property is set, the driverClassName is ignored and a DataSourceXAConnectionFactory is created. Otherwise, a standard DriverConnectionFactory is created and wrapped with a LocalXAConnectionFactory.

Version:
$Revision$
See Also:
BasicDataSource, ManagedConnection

Constructor Summary
BasicManagedDataSource()
           
 
Method Summary
 TransactionManager getTransactionManager()
          Gets the required transaction manager property.
 java.lang.String getXADataSource()
          Gets the optional XADataSource class name.
 javax.sql.XADataSource getXaDataSourceInstance()
          Gets the XADataSource instance used by the XAConnectionFactory.
 void setTransactionManager(TransactionManager transactionManager)
          Sets the required transaction manager property.
 void setXADataSource(java.lang.String xaDataSource)
          Sets the optional XADataSource class name.
 void setXaDataSourceInstance(javax.sql.XADataSource xaDataSourceInstance)
          Sets the XADataSource instance used by the XAConnectionFactory.
 
Methods inherited from class org.apache.commons.dbcp.BasicDataSource
addConnectionProperty, close, getConnection, getConnection, getConnectionInitSqls, getDefaultAutoCommit, getDefaultCatalog, getDefaultReadOnly, getDefaultTransactionIsolation, getDriverClassLoader, getDriverClassName, getInitialSize, getLogAbandoned, getLoginTimeout, getLogWriter, getMaxActive, getMaxIdle, getMaxOpenPreparedStatements, getMaxWait, getMinEvictableIdleTimeMillis, getMinIdle, getNumActive, getNumIdle, getNumTestsPerEvictionRun, getPassword, getRemoveAbandoned, getRemoveAbandonedTimeout, getTestOnBorrow, getTestOnReturn, getTestWhileIdle, getTimeBetweenEvictionRunsMillis, getUrl, getUsername, getValidationQuery, getValidationQueryTimeout, isAccessToUnderlyingConnectionAllowed, isClosed, isPoolPreparedStatements, isWrapperFor, removeConnectionProperty, setAccessToUnderlyingConnectionAllowed, setConnectionInitSqls, setConnectionProperties, setDefaultAutoCommit, setDefaultCatalog, setDefaultReadOnly, setDefaultTransactionIsolation, setDriverClassLoader, setDriverClassName, setInitialSize, setLogAbandoned, setLoginTimeout, setLogWriter, setMaxActive, setMaxIdle, setMaxOpenPreparedStatements, setMaxWait, setMinEvictableIdleTimeMillis, setMinIdle, setNumTestsPerEvictionRun, setPassword, setPoolPreparedStatements, setRemoveAbandoned, setRemoveAbandonedTimeout, setTestOnBorrow, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillis, setUrl, setUsername, setValidationQuery, setValidationQueryTimeout, unwrap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicManagedDataSource

public BasicManagedDataSource()
Method Detail

getTransactionManager

public TransactionManager getTransactionManager()
Gets the required transaction manager property.

Returns:
the transaction manager used to enlist connections

getXADataSource

public java.lang.String getXADataSource()
Gets the optional XADataSource class name.

Returns:
the optional XADataSource class name

getXaDataSourceInstance

public javax.sql.XADataSource getXaDataSourceInstance()
Gets the XADataSource instance used by the XAConnectionFactory.

Returns:
the XADataSource

setTransactionManager

public void setTransactionManager(TransactionManager transactionManager)
Sets the required transaction manager property.

Parameters:
transactionManager - the transaction manager used to enlist connections

setXADataSource

public void setXADataSource(java.lang.String xaDataSource)
Sets the optional XADataSource class name.

Parameters:
xaDataSource - the optional XADataSource class name

setXaDataSourceInstance

public void setXaDataSourceInstance(javax.sql.XADataSource xaDataSourceInstance)

Sets the XADataSource instance used by the XAConnectionFactory.

Note: this method currently has no effect once the pool has been initialized. The pool is initialized the first time one of the following methods is invoked: getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.

Parameters:
xaDataSourceInstance - XADataSource instance


Copyright © 2001-2004 Apache Software Foundation. Documenation generated July 22 2013.