org.apache.ojb.broker.accesslayer
Class ConnectionFactoryAbstractImpl

java.lang.Object
  extended byorg.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
All Implemented Interfaces:
ConnectionFactory
Direct Known Subclasses:
ConnectionFactoryDBCPImpl, ConnectionFactoryNotPooledImpl, ConnectionFactoryPooledImpl

public abstract class ConnectionFactoryAbstractImpl
extends java.lang.Object
implements ConnectionFactory

Abstract base class to simplify implementation of ConnectionFactory's.

Version:
$Id: ConnectionFactoryAbstractImpl.java,v 1.10.2.2 2005/03/16 17:47:19 mkalen Exp $
Author:
Armin Waibel

Constructor Summary
ConnectionFactoryAbstractImpl()
           
 
Method Summary
abstract  java.sql.Connection getConnectionFromPool(JdbcConnectionDescriptor jcd)
          Implement this method.
 java.sql.Connection lookupConnection(JdbcConnectionDescriptor jcd)
          Lookup a connection from the connection factory implementation.
 void releaseAllResources()
          Override this method to do cleanup in your implementation.
 void releaseConnection(JdbcConnectionDescriptor jcd, java.sql.Connection con)
          Release connection - CAUTION: Release every connection after use to avoid abandoned connections.
abstract  void returnConnectionToPool(JdbcConnectionDescriptor jcd, java.sql.Connection con)
          Implement this method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionFactoryAbstractImpl

public ConnectionFactoryAbstractImpl()
Method Detail

getConnectionFromPool

public abstract java.sql.Connection getConnectionFromPool(JdbcConnectionDescriptor jcd)
                                                   throws LookupException
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.

Throws:
LookupException

returnConnectionToPool

public abstract void returnConnectionToPool(JdbcConnectionDescriptor jcd,
                                            java.sql.Connection con)
                                     throws LookupException
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.

Throws:
LookupException

releaseConnection

public void releaseConnection(JdbcConnectionDescriptor jcd,
                              java.sql.Connection con)
Description copied from interface: ConnectionFactory
Release connection - CAUTION: Release every connection after use to avoid abandoned connections. Depending on the used implementation connection will be closed, returned to pool, ...

Specified by:
releaseConnection in interface ConnectionFactory

lookupConnection

public java.sql.Connection lookupConnection(JdbcConnectionDescriptor jcd)
                                     throws LookupException
Description copied from interface: ConnectionFactory
Lookup a connection from the connection factory implementation.

Specified by:
lookupConnection in interface ConnectionFactory
Throws:
LookupException

releaseAllResources

public void releaseAllResources()
Override this method to do cleanup in your implementation. Do a super.releaseAllResources() in your method implementation to free resources used by this class.

Specified by:
releaseAllResources in interface ConnectionFactory


(C) 2002 - 2004 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.3, 2005-04-2