Class ContainerPoolFactory

  extended by org.apache.cayenne.conn.ContainerPoolFactory
All Implemented Interfaces:

public class ContainerPoolFactory
extends Object
implements ObjectFactory

Basic JNDI object factory that creates an instance of PoolManager that has been configured based on the RefAddr values of the specified Reference.

Here is a sample Tomcat 4.x configuration that sets this class as a default factory for javax.sql.DataSource objects:

<ResourceParams name="jdbc/mydb">







After ContainerPoolFactory was configured to be used within the container (see above for Tomcat example), you can reference your "jdbc/mydb" DataSource in web application deployment descriptor like that (per Servlet Specification):


Constructor Summary
Method Summary
 Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment)
          Creates and returns a new PoolManager instance.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ContainerPoolFactory()
Method Detail


public Object getObjectInstance(Object obj,
                                Name name,
                                Context nameCtx,
                                Hashtable environment)
                         throws Exception

Creates and returns a new PoolManager instance. If no instance can be created, returns null instead.

Specified by:
getObjectInstance in interface ObjectFactory
obj - The possibly null object containing location or reference information that can be used in creating an object
name - The name of this object relative to nameCtx
nameCtx - The context relative to which the name parameter is specified, or null if name is relative to the default initial context
environment - The possibly null environment that is used in creating this object
Exception - if an exception occurs creating the instance

Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.