org.apache.avalon.excalibur.datasource
Class ResourceLimitingJdbcDataSource

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.apache.avalon.framework.configuration.Configurable, DataSourceComponent, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.thread.ThreadSafe

public class ResourceLimitingJdbcDataSource
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements DataSourceComponent, org.apache.avalon.framework.activity.Disposable

The ResourceLimiting implementation for DataSources in Avalon. This uses the normal java.sql.Connection object and java.sql.DriverManager. The Configuration is like this:

   <jdbc>
     <pool-controller max="10" blocking="true"
       timeout="-1" trim-interval="60000"
       connection-class="my.overrided.ConnectionClass">
       <keep-alive disable="false">select 1</keep-alive>
     </pool-controller>
     <driver>com.database.jdbc.JdbcDriver</driver>
     <dburl>jdbc:driver://host/mydb</dburl>
     <user>username</user>
     <password>password</password>
   </jdbc>
 
With the following roles declaration:
   <role name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
     shorthand="datasources"
     default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
     <hint shorthand="jdbc"
       class="org.apache.avalon.excalibur.datasource.ResourceLimitingJdbcDataSource"/>
   </role>
 

Since:
4.1
Version:
CVS $Revision: 1.3 $ $Date: 2002/01/26 16:58:26 $
Author:
Leif Mortenson

Field Summary
protected  ResourceLimitingJdbcConnectionPool m_pool
           
 
Fields inherited from interface org.apache.avalon.excalibur.datasource.DataSourceComponent
ROLE
 
Constructor Summary
ResourceLimitingJdbcDataSource()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Pass the Configuration to the Configurable class.
 void dispose()
          The dispose operation is called at the end of a components lifecycle.
 java.sql.Connection getConnection()
          Gets the Connection to the database
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_pool

protected ResourceLimitingJdbcConnectionPool m_pool
Constructor Detail

ResourceLimitingJdbcDataSource

public ResourceLimitingJdbcDataSource()
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Gets the Connection to the database
Specified by:
getConnection in interface DataSourceComponent
Throws:
NoValidConnectionException - when there is no valid Connection wrapper available in the classloader.
NoAvailableConnectionException - when there are no more available Connections in the pool.

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Pass the Configuration to the Configurable class. This method must always be called after the constructor and before any other method.
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration - the class configurations.

dispose

public void dispose()
The dispose operation is called at the end of a components lifecycle. This method will be called after Startable.stop() method (if implemented by component). Components use this method to release and destroy any resources that the Component owns.
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable


Copyright 2001 Apache Jakarta Project. All Rights Reserved.