org.postgresql.ds.common
Class PGObjectFactory

java.lang.Object
  extended by org.postgresql.ds.common.PGObjectFactory
All Implemented Interfaces:
javax.naming.spi.ObjectFactory
Direct Known Subclasses:
PGXADataSourceFactory

public class PGObjectFactory
extends java.lang.Object
implements javax.naming.spi.ObjectFactory

Returns a DataSource-ish thing based on a JNDI reference. In the case of a SimpleDataSource or ConnectionPool, a new instance is created each time, as there is no connection state to maintain. In the case of a PoolingDataSource, the same DataSource will be returned for every invocation within the same VM/ClassLoader, so that the state of the connections in the pool will be consistent.

Author:
Aaron Mulder (ammulder@chariotsolutions.com)

Constructor Summary
PGObjectFactory()
           
 
Method Summary
 java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)
          Dereferences a PostgreSQL DataSource.
protected  java.lang.String getProperty(javax.naming.Reference ref, java.lang.String s)
           
protected  java.lang.Object loadBaseDataSource(BaseDataSource ds, javax.naming.Reference ref)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PGObjectFactory

public PGObjectFactory()
Method Detail

getObjectInstance

public java.lang.Object getObjectInstance(java.lang.Object obj,
                                          javax.naming.Name name,
                                          javax.naming.Context nameCtx,
                                          java.util.Hashtable environment)
                                   throws java.lang.Exception
Dereferences a PostgreSQL DataSource. Other types of references are ignored.

Specified by:
getObjectInstance in interface javax.naming.spi.ObjectFactory
Throws:
java.lang.Exception

loadBaseDataSource

protected java.lang.Object loadBaseDataSource(BaseDataSource ds,
                                              javax.naming.Reference ref)

getProperty

protected java.lang.String getProperty(javax.naming.Reference ref,
                                       java.lang.String s)