org.apache.ojb.broker.accesslayer
Class ConnectionFactoryDBCPImpl

java.lang.Object
  extended byorg.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
      extended byorg.apache.ojb.broker.accesslayer.ConnectionFactoryDBCPImpl
All Implemented Interfaces:
ConnectionFactory

public class ConnectionFactoryDBCPImpl
extends ConnectionFactoryAbstractImpl

ConnectionFactory implementation using jakarta-DBCP to pool driver based connections. (based on a proposal of Dirk Verbeek - Thanks).

Version:
$Id: ConnectionFactoryDBCPImpl.java,v 1.6 2003/12/12 13:29:02 arminw Exp $
Author:
Armin Waibel

Constructor Summary
ConnectionFactoryDBCPImpl()
           
 
Method Summary
protected  org.apache.commons.dbcp.ConnectionFactory createConnectionFactory(JdbcConnectionDescriptor jcd)
           
protected  org.apache.commons.pool.ObjectPool createObjectPool(org.apache.commons.pool.impl.GenericObjectPool.Config config)
           
protected  org.apache.commons.dbcp.PoolingDataSource createPoolingDataSource(org.apache.commons.pool.ObjectPool pool)
           
protected  org.apache.commons.pool.KeyedObjectPoolFactory createStatementPoolFactory(java.lang.Object obj)
           
 java.sql.Connection getConnectionFromPool(JdbcConnectionDescriptor jcd)
          Implement this method.
 void returnConnectionToPool(JdbcConnectionDescriptor jcd, java.sql.Connection con)
          Implement this method.
protected  javax.sql.DataSource setupPool(JdbcConnectionDescriptor jcd)
          Override this method to setup your own pool
 
Methods inherited from class org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
getDbURL, initializeJdbcConnection, lookupConnection, newConnectionFromDataSource, newConnectionFromDriverManager, releaseAllResources, releaseConnection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionFactoryDBCPImpl

public ConnectionFactoryDBCPImpl()
Method Detail

getConnectionFromPool

public java.sql.Connection getConnectionFromPool(JdbcConnectionDescriptor jcd)
                                          throws LookupException
Description copied from class: ConnectionFactoryAbstractImpl
Implement this method. This method was called to obtain a jdbc-connection from the pool.
Note: This method was not called, if jdbc-connection-descriptor use datasources - OJB only pool connections from DriverManager.

Specified by:
getConnectionFromPool in class ConnectionFactoryAbstractImpl
Throws:
LookupException

returnConnectionToPool

public void returnConnectionToPool(JdbcConnectionDescriptor jcd,
                                   java.sql.Connection con)
                            throws LookupException
Description copied from class: ConnectionFactoryAbstractImpl
Implement this method. Was called to return a connection to pool.
Note: This method was not called, if the jdbc-connection-descriptor uses datasources - OJB only pool connections from DriverManager.

Specified by:
returnConnectionToPool in class ConnectionFactoryAbstractImpl
Throws:
LookupException

setupPool

protected javax.sql.DataSource setupPool(JdbcConnectionDescriptor jcd)
                                  throws java.lang.Exception
Override this method to setup your own pool

Throws:
java.lang.Exception

createObjectPool

protected org.apache.commons.pool.ObjectPool createObjectPool(org.apache.commons.pool.impl.GenericObjectPool.Config config)

createConnectionFactory

protected org.apache.commons.dbcp.ConnectionFactory createConnectionFactory(JdbcConnectionDescriptor jcd)

createStatementPoolFactory

protected org.apache.commons.pool.KeyedObjectPoolFactory createStatementPoolFactory(java.lang.Object obj)

createPoolingDataSource

protected org.apache.commons.dbcp.PoolingDataSource createPoolingDataSource(org.apache.commons.pool.ObjectPool pool)


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14