Top Description Constructors Methods
org.postgresql.ds.common

public Class PGObjectFactory

extends Object
implements ObjectFactory
Class Inheritance
All Implemented Interfaces
javax.naming.spi.ObjectFactory
Known Direct Subclasses
org.postgresql.xa.PGXADataSourceFactory
Imports
org.postgresql.ds.PGConnectionPoolDataSource, .PGPoolingDataSource, .PGSimpleDataSource, org.postgresql.util.internal.Nullness, org.checkerframework.checker.nullness.qual.Nullable, java.util.Hashtable, javax.naming.Context, .Name, .RefAddr, .Reference, 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 ([email protected])

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public @Nullable Object
getObjectInstance(Object
The possibly null object containing location or reference information that can be used in creating an object.
obj
,
Name
The name of this object relative to nameCtx, or null if no name is specified.
name
,
Context
The context relative to which the name parameter is specified, or null if name is relative to the default initial context.
nameCtx
,
Hashtable<?, ?>
The possibly null environment that is used in creating the object.
environment
)

Implements javax.naming.spi.ObjectFactory.getObjectInstance.

Dereferences a PostgreSQL DataSource.

protected @Nullable String
protected Object
private Object
private Object
private Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PGObjectFactoryback to summary
public PGObjectFactory()

Method Detail

getObjectInstanceback to summary
public @Nullable Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception

Implements javax.naming.spi.ObjectFactory.getObjectInstance.

Dereferences a PostgreSQL DataSource. Other types of references are ignored.

Parameters
obj:Object

Doc from javax.naming.spi.ObjectFactory.getObjectInstance.

The possibly null object containing location or reference information that can be used in creating an object.

name:Name

Doc from javax.naming.spi.ObjectFactory.getObjectInstance.

The name of this object relative to nameCtx, or null if no name is specified.

nameCtx:Context

Doc from javax.naming.spi.ObjectFactory.getObjectInstance.

The context relative to which the name parameter is specified, or null if name is relative to the default initial context.

environment:Hashtable<?, ?>

Doc from javax.naming.spi.ObjectFactory.getObjectInstance.

The possibly null environment that is used in creating the object.

Returns:@Nullable Object

Doc from javax.naming.spi.ObjectFactory.getObjectInstance.

The object created; null if an object cannot be created.

Annotations
@Override
Exceptions
Exception:

Doc from javax.naming.spi.ObjectFactory.getObjectInstance.

if this object factory encountered an exception while attempting to create an object, and no other object factories are to be tried.

getPropertyback to summary
protected @Nullable String getProperty(Reference ref, String s)
loadBaseDataSourceback to summary
protected Object loadBaseDataSource(BaseDataSource ds, Reference ref)
loadConnectionPoolback to summary
private Object loadConnectionPool(Reference ref)
loadPoolingDataSourceback to summary
private Object loadPoolingDataSource(Reference ref)
loadSimpleDataSourceback to summary
private Object loadSimpleDataSource(Reference ref)