org.apache.cocoon.ojb.components
Class ConnectionFactoryImpl

java.lang.Object
  extended by org.apache.cocoon.ojb.components.ConnectionFactoryImpl
All Implemented Interfaces:
Disposable, Component, Serviceable, ThreadSafe, org.apache.ojb.broker.accesslayer.ConnectionFactory

public class ConnectionFactoryImpl
extends Object
implements Component, ThreadSafe, Serviceable, Disposable, org.apache.ojb.broker.accesslayer.ConnectionFactory

OJB ConnectionFactory implemenation to bridge into the Avalon DataSource connection pooling component defined in the Cocoon configuration.

This class has two faces to it:

Avalon Component
Instance of the class created and managed by Avalon container. When instance is initialized, it looks up datasource components service selector.
OJB Managed Class
Instances of the class are created and managed by OJB, as defined in the OJB repository.xml file. Each OJB managed instance of the class will have access to the datasource components service selector initialized by Avalon managed instance of the class.
It is important that Avalon component is initialized before any access to OJB API is made.

Version:
$Id: ConnectionFactoryImpl.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
giacomo at apache.org, Vadim Gritsenko

Constructor Summary
ConnectionFactoryImpl()
          Default constructor
ConnectionFactoryImpl(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor conDesc)
          OJB 1.1 constructor
 
Method Summary
 void dispose()
           
 int getActiveConnections()
           
 int getIdleConnections()
           
 Connection lookupConnection()
           
 Connection lookupConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor conDesc)
           
 void releaseAllResources()
           
 void releaseConnection(Connection connection)
           
 void releaseConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor conDesc, Connection connection)
           
 void service(ServiceManager manager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionFactoryImpl

public ConnectionFactoryImpl()
Default constructor


ConnectionFactoryImpl

public ConnectionFactoryImpl(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor conDesc)
OJB 1.1 constructor

Method Detail

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException

dispose

public void dispose()
Specified by:
dispose in interface Disposable

lookupConnection

public Connection lookupConnection()
                            throws org.apache.ojb.broker.accesslayer.LookupException
Throws:
org.apache.ojb.broker.accesslayer.LookupException

releaseConnection

public void releaseConnection(Connection connection)

getActiveConnections

public int getActiveConnections()

getIdleConnections

public int getIdleConnections()

lookupConnection

public Connection lookupConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor conDesc)
                            throws org.apache.ojb.broker.accesslayer.LookupException
Specified by:
lookupConnection in interface org.apache.ojb.broker.accesslayer.ConnectionFactory
Throws:
org.apache.ojb.broker.accesslayer.LookupException

releaseConnection

public void releaseConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor conDesc,
                              Connection connection)
Specified by:
releaseConnection in interface org.apache.ojb.broker.accesslayer.ConnectionFactory

releaseAllResources

public void releaseAllResources()
Specified by:
releaseAllResources in interface org.apache.ojb.broker.accesslayer.ConnectionFactory


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