org.apache.avalon.excalibur.datasource
Class AbstractJdbcConnection

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLogEnabled
        |
        +--org.apache.avalon.excalibur.datasource.AbstractJdbcConnection
All Implemented Interfaces:
java.sql.Connection, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.LogEnabled, Poolable, Recyclable
Direct Known Subclasses:
JdbcConnection

public abstract class AbstractJdbcConnection
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements java.sql.Connection, Recyclable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable

The Connection object used in conjunction with the JdbcDataSource object. TODO: Implement a configurable closed end Pool, where the Connection acts like JDBC PooledConnections work. That means we can limit the total number of Connection objects that are created.

Since:
4.1
Version:
CVS $Revision: 1.11 $ $Date: 2002/01/26 16:57:42 $
Author:
Berin Loritsch

Field Summary
protected  java.sql.Connection m_connection
           
protected  long m_lastUsed
           
protected  Pool m_pool
           
protected  java.sql.SQLException m_testException
           
protected  java.sql.PreparedStatement m_testStatement
           
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
AbstractJdbcConnection(java.sql.Connection connection, boolean oradb)
          Deprecated. Use the version with keepAlive specified
AbstractJdbcConnection(java.sql.Connection connection, java.lang.String keepAlive)
           
 
Method Summary
 void close()
           
 void dispose()
           
 void enableLogging(org.apache.avalon.framework.logger.Logger log)
           
 void initialize()
           
 boolean isClosed()
           
 void recycle()
          This method should be implemented to remove all costly resources in object.
protected  void setPool(Pool pool)
           
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Connection
clearWarnings, commit, createStatement, createStatement, getAutoCommit, getCatalog, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isReadOnly, nativeSQL, prepareCall, prepareCall, prepareStatement, prepareStatement, rollback, setAutoCommit, setCatalog, setReadOnly, setTransactionIsolation, setTypeMap
 

Field Detail

m_connection

protected java.sql.Connection m_connection

m_pool

protected Pool m_pool

m_testStatement

protected java.sql.PreparedStatement m_testStatement

m_testException

protected java.sql.SQLException m_testException

m_lastUsed

protected long m_lastUsed
Constructor Detail

AbstractJdbcConnection

public AbstractJdbcConnection(java.sql.Connection connection,
                              boolean oradb)
Deprecated. Use the version with keepAlive specified


AbstractJdbcConnection

public AbstractJdbcConnection(java.sql.Connection connection,
                              java.lang.String keepAlive)
Parameters:
connection - a driver specific JDBC connection to be wrapped.
keepAlive - a query which will be used to check the statis of the connection after it has been idle. A null value will cause the keep alive feature to be disabled.
Method Detail

initialize

public void initialize()
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger log)
Overrides:
enableLogging in class org.apache.avalon.framework.logger.AbstractLogEnabled

setPool

protected void setPool(Pool pool)

recycle

public void recycle()
Description copied from interface: Recyclable
This method should be implemented to remove all costly resources in object. These resources can be object references, database connections, threads, etc. What is categorised as "costly" resources is determined on a case by case analysis.
Specified by:
recycle in interface Recyclable

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Specified by:
isClosed in interface java.sql.Connection

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface java.sql.Connection

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.