org.apache.avalon.excalibur.datasource
Class J2eeDataSource

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

public class J2eeDataSource
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements DataSourceComponent, org.apache.avalon.framework.logger.Loggable

The J2EE implementation for DataSources in Cocoon. This uses the javax.sql.DataSource object and assumes that the J2EE container pools the datasources properly.

Since:
4.0
Version:
CVS $Revision: 1.5 $ $Date: 2001/12/11 09:53:28 $
Author:
Berin Loritsch

Field Summary
static java.lang.String JDBC_NAME
           
protected  javax.sql.DataSource m_dataSource
           
 
Fields inherited from interface org.apache.avalon.excalibur.datasource.DataSourceComponent
ROLE
 
Constructor Summary
J2eeDataSource()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configure and set up DB connection.
 java.sql.Connection getConnection()
          Get the database connection
 void setLogger(org.apache.log.Logger logger)
           
 
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

JDBC_NAME

public static final java.lang.String JDBC_NAME

m_dataSource

protected javax.sql.DataSource m_dataSource
Constructor Detail

J2eeDataSource

public J2eeDataSource()
Method Detail

setLogger

public void setLogger(org.apache.log.Logger logger)
Specified by:
setLogger in interface org.apache.avalon.framework.logger.Loggable

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configure and set up DB connection. Here we set the connection information needed to create the Connection objects. It must be called only once.
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
conf - The Configuration object needed to describe the connection.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException -  

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Get the database connection
Specified by:
getConnection in interface DataSourceComponent
Following copied from interface: org.apache.avalon.excalibur.datasource.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.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.