org.apache.jetspeed.components.datasource
Class DBCPDatasourceComponent

java.lang.Object
  extended by org.apache.jetspeed.components.datasource.DBCPDatasourceComponent
All Implemented Interfaces:
DatasourceComponent
Direct Known Subclasses:
BoundDBCPDatasourceComponent

public class DBCPDatasourceComponent
extends java.lang.Object
implements DatasourceComponent

DBCPDatasourceComponent

Version:
$ $
Author:
Scott T. Weaver

Field Summary
protected  org.apache.commons.dbcp.PoolingDataSource dataSource
           
 
Constructor Summary
DBCPDatasourceComponent(java.lang.String user, java.lang.String password, java.lang.String driverName, java.lang.String connectURI, int maxActive, int maxWait, byte whenExhausted, boolean autoCommit)
          Creates a simple commons DBCP connection pool using the following parameters.
 
Method Summary
 javax.sql.DataSource getDatasource()
           getDatasource
 void start()
           start
 void stop()
           stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSource

protected org.apache.commons.dbcp.PoolingDataSource dataSource
Constructor Detail

DBCPDatasourceComponent

public DBCPDatasourceComponent(java.lang.String user,
                               java.lang.String password,
                               java.lang.String driverName,
                               java.lang.String connectURI,
                               int maxActive,
                               int maxWait,
                               byte whenExhausted,
                               boolean autoCommit)
Creates a simple commons DBCP connection pool using the following parameters.

If you need to bind the datasource of this component to JNDI please @see org.apache.jetspeed.components.jndi.JNDIComponent

Parameters:
user - User name that will be used to connect to the DB
password - Password that will be used to connect to the DB
driverName - Fully qualified driver to be used by the connection pool
connectURI - Fully qualified URI to the DB.
maxActive - Maximum active connection
maxWait - if whenExhausted is set to GenericObjectPool.WHEN_EXHAUSTED_BLOCK the length of time to block while waiting for a connection to become available.
whenExhausted - GenericObjectPool.WHEN_EXHAUSTED_BLOCK, GenericObjectPool.WHEN_EXHAUSTED_GROW or GenericObjectPool.WHEN_EXHAUSTED_FAIL. @see org.apache.commons.pooling.GenericObjectPool for more information on these settings
autoCommit - Whether or not this datasource will autocommit
Throws:
java.lang.ClassNotFoundException - If the driverName could not be located within any classloaders.
Method Detail

getDatasource

public javax.sql.DataSource getDatasource()

getDatasource

returns the datasource created by this component

Specified by:
getDatasource in interface DatasourceComponent
Returns:

start

public void start()

start

See Also:
org.picocontainer.Startable#start()

stop

public void stop()

stop

See Also:
org.picocontainer.Startable#stop()


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.