com.ca.jcs.jndi
Class JNDIConnectionFactory

java.lang.Object
  extended by org.apache.commons.pool.BasePoolableObjectFactory
      extended by com.ca.jcs.jndi.JNDIConnectionFactory
All Implemented Interfaces:
PoolableObjectFactory
Direct Known Subclasses:
JNDIKerberosConnectionFactory

public class JNDIConnectionFactory
extends BasePoolableObjectFactory

Generic factory which can assist in management of a pool of JNDI connections (InitialDirContexts) based provided configuration jndiEnv.


Field Summary
protected  Properties jndiEnv
           
 
Constructor Summary
JNDIConnectionFactory(Properties jndiEnv)
          Remember settings which will be used to allocate future connections, where at least these fields must be included for connections to be established: Context.PROVIDER_URL Context.INITIAL_CONTEXT_FACTORY Context.SECURITY_AUTHENTICATION Context.SECURITY_PRINCIPAL Context.SECURITY_CREDENTIALS
 
Method Summary
 void destroyObject(Object object)
          Disconnect all services for an instance in the pool, as it is being removed from it.
 Object makeObject()
           
 
Methods inherited from class org.apache.commons.pool.BasePoolableObjectFactory
activateObject, passivateObject, validateObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jndiEnv

protected final Properties jndiEnv
Constructor Detail

JNDIConnectionFactory

public JNDIConnectionFactory(Properties jndiEnv)
Remember settings which will be used to allocate future connections, where at least these fields must be included for connections to be established:
  1. Context.PROVIDER_URL
  2. Context.INITIAL_CONTEXT_FACTORY
  3. Context.SECURITY_AUTHENTICATION
  4. Context.SECURITY_PRINCIPAL
  5. Context.SECURITY_CREDENTIALS

Parameters:
jndiEnv - Environment to be used in establishing future connections.
Method Detail

makeObject

public Object makeObject()
                  throws Exception
Specified by:
makeObject in interface PoolableObjectFactory
Specified by:
makeObject in class BasePoolableObjectFactory
Returns:
Created secure or normal JNDI connection instance (InitialContext) that can be used by the pool.
Throws:
Exception

destroyObject

public void destroyObject(Object object)
                   throws Exception
Disconnect all services for an instance in the pool, as it is being removed from it.

Specified by:
destroyObject in interface PoolableObjectFactory
Overrides:
destroyObject in class BasePoolableObjectFactory
Parameters:
object - the instance to be destroyed
Throws:
Exception


Created 2011-07-14 13:27 EST