Top Description Fields Constructors Methods
org.apache.derby.jdbc

public Class ReferenceableDataSource

extends BasicEmbeddedDataSource40
implements ObjectFactory
Class Inheritance
All Implemented Interfaces
javax.naming.spi.ObjectFactory
Known Direct Subclasses
org.apache.derby.jdbc.EmbeddedDataSource
Imports
java.lang.reflect.Method, java.util.Enumeration, javax.naming.RefAddr, .Reference, javax.naming.spi.ObjectFactory

The data source factory for Derby embedded driver data sources.

This factory reconstructs a Derby data source object when it is retrieved from JNDI. References are needed since many naming services don't have the ability to store Java objects in their serialized form. When a data source object is bound in this type of naming service the javax.naming.Reference for that object is actually stored by the JNDI implementation, not the data source object itself.

A JNDI administrator is responsible for making sure that both the object factory and data source implementation classes provided by a JDBC driver vendor are accessible to the JNDI service provider at runtime.

An object factory implements the javax.naming.spi.ObjectFactory interface. This interface contains a single method, getObjectInstance which is called by a JNDI service provider to reconstruct an object when that object is retrieved from JNDI. A JDBC driver vendor should provide an object factory as part of their JDBC product.

See Also
org.apache.derby.jdbc.EmbeddedDataSource, org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource, org.apache.derby.jdbc.EmbeddedXADataSource

Field Summary

Modifier and TypeField and Description
private static final Class<?>[]
private static final Class<?>[]
private static final long
private static final Class<?>[]
private static final Class<?>[]
Inherited from org.apache.derby.jdbc.BasicEmbeddedDataSource40:
attributesAsPasswordconnectionAttributescreateDatabasedatabaseNamedataSourceNamedescriptiondriverjdbcurlloginTimeoutshutdownDatabase

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

Object created, or null if no attempt to create the object is made.
getObjectInstance
(Object
the possibly null object containing location or reference information that can be used in creating an object
refObj
,
Name
the name of this object relative to nameContext, or null if no name is specified
name
,
Context
context relative to which the name parameter is specified, or null if name is relative to the default initial context.
nameContext
,
Hashtable<?, ?>
possibly null environment that is used in creating the object.
environment
)

Implements javax.naming.spi.ObjectFactory.getObjectInstance.

Reconstructs a Derby embedded-driver data source object from a JNDI data source reference.
private static void
Inherited from org.apache.derby.jdbc.BasicEmbeddedDataSource40:
equalsfindDrivergetAttributesAsPasswordgetConnectiongetConnectiongetConnectiongetConnectionAttributesgetCreateDatabasegetDatabaseNamegetDataSourceNamegetDescriptiongetLoginTimeoutgetLogWritergetParentLoggergetPasswordgetShutdownDatabasegetUserhashCodeisWrapperForsetAttributesAsPasswordsetConnectionAttributessetCreateDatabasesetDatabaseNamesetDataSourceNamesetDescriptionsetLoginTimeoutsetLogWritersetPasswordsetShutdownDatabasesetupResourceAdaptersetUserunwrapupdate

Field Detail

BOOLEAN_ARGback to summary
private static final Class<?>[] BOOLEAN_ARG
INT_ARGback to summary
private static final Class<?>[] INT_ARG
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.apache.derby.jdbc.BasicEmbeddedDataSource40.serialVersionUID.

SHORT_ARGback to summary
private static final Class<?>[] SHORT_ARG
STRING_ARGback to summary
private static final Class<?>[] STRING_ARG

Constructor Detail

ReferenceableDataSourceback to summary
public ReferenceableDataSource()

Method Detail

getObjectInstanceback to summary
public Object getObjectInstance(Object refObj, Name name, Context nameContext, Hashtable<?, ?> environment) throws Exception

Implements javax.naming.spi.ObjectFactory.getObjectInstance.

Reconstructs a Derby embedded-driver data source object from a JNDI data source reference.

The getObjectInstance method is passed a reference that corresponds to the object being retrieved as its first parameter. The other parameters are optional in the case of JDBC data source objects. The object factory should use the information contained in the reference to reconstruct the data source. If for some reason, a data source object cannot be reconstructed from the reference, a value of null may be returned. This allows other object factories that may be registered in JNDI to be tried. If an exception is thrown then no other object factories are tried.

Parameters
refObj:Object

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

name:Name

the name of this object relative to nameContext, or null if no name is specified

nameContext:Context

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

environment:Hashtable<?, ?>

possibly null environment that is used in creating the object.

Returns:Object

Object created, or null if no attempt to create the object is made.

Annotations
@Override
Exceptions
Exception:
if recreating the object fails
setBeanPropertiesback to summary
private static void setBeanProperties(Object ds, Reference ref) throws Exception