org.datanucleus.jdo
Class JDOPersistenceManagerFactory

java.lang.Object
  extended by org.datanucleus.PersistenceConfiguration
      extended by org.datanucleus.ObjectManagerFactoryImpl
          extended by org.datanucleus.jdo.AbstractPersistenceManagerFactory
              extended by org.datanucleus.jdo.JDOPersistenceManagerFactory
All Implemented Interfaces:
java.io.Serializable, javax.jdo.PersistenceManagerFactory, javax.naming.Referenceable, javax.naming.spi.ObjectFactory

public class JDOPersistenceManagerFactory
extends AbstractPersistenceManagerFactory
implements javax.jdo.PersistenceManagerFactory, javax.naming.spi.ObjectFactory, javax.naming.Referenceable

Implementation of a JDO PersistenceManagerFactory, used to obtain PersistenceManager instances.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.datanucleus.jdo.AbstractPersistenceManagerFactory
lifecycleListeners, LOCALISER_JDO
 
Fields inherited from class org.datanucleus.ObjectManagerFactoryImpl
cache, omfContext
 
Fields inherited from class org.datanucleus.PersistenceConfiguration
configurable, LOCALISER
 
Constructor Summary
JDOPersistenceManagerFactory()
          Constructs a new PersistenceManagerFactoryImpl.
JDOPersistenceManagerFactory(java.util.Map props)
          Constructs a new PersistenceManagerFactoryImpl.
 
Method Summary
static JDOPersistenceManagerFactory createInstance(java.util.Map props)
          Convenience method to create a new PMF of this type.
 boolean equals(java.lang.Object obj)
          Equality operator.
protected  void freezeConfiguration()
          Freezes the current configuration.
 java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context ctx, java.util.Hashtable env)
          Create a PMF using the (JNDI) location or reference information specified.
 javax.jdo.PersistenceManager getPersistenceManager()
          Get an instance of PersistenceManager from this factory.
 javax.jdo.PersistenceManager getPersistenceManager(java.lang.String userName, java.lang.String password)
          Get an instance of PersistenceManager from this factory.
static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map overridingProps)
          Return a new PersistenceManagerFactoryImpl with options set according to the given Properties.
static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map overrides, java.util.Map props)
          Return a new PersistenceManagerFactoryImpl with options set according to the given properties and given overrides.
static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Properties overridingProps)
          Return a new PersistenceManagerFactoryImpl with options set according to the given Properties.
 javax.jdo.PersistenceManager getPersistenceManagerProxy()
          Accessor for the PersistenceManager proxy object
 javax.naming.Reference getReference()
          Retrieves the (JNDI) reference of this PMF object.
protected  void initialiseProperties(java.util.Map props)
          Convenience method to set the API and properties that a PMF will use.
 
Methods inherited from class org.datanucleus.jdo.AbstractPersistenceManagerFactory
addFetchGroups, addInstanceLifecycleListener, addSequenceForFactoryClass, assertConfigurable, assertIsOpen, close, getCatalog, getConnectionDriverName, getConnectionFactory, getConnectionFactory2, getConnectionFactory2Name, getConnectionFactoryName, getConnectionPassword, getConnectionURL, getConnectionUserName, getCopyOnAttach, getDataStoreCache, getDetachAllOnCommit, getFetchGroup, getFetchGroups, getIgnoreCache, getLifecycleListenerSpecifications, getMapping, getMultithreaded, getName, getNontransactionalRead, getNontransactionalWrite, getOptimistic, getPersistenceUnitName, getPersistenceXmlFilename, getPmCache, getProperties, getReadOnly, getRestoreValues, getRetainValues, getSchema, getSequenceForFactoryClass, getServerTimeZoneID, getTransactionIsolationLevel, getTransactionType, releasePersistenceManager, removeAllFetchGroups, removeFetchGroups, removeInstanceLifecycleListener, setCatalog, setConnectionDriverName, setConnectionFactory, setConnectionFactory2, setConnectionFactory2Name, setConnectionFactoryName, setConnectionPassword, setConnectionURL, setConnectionUserName, setCopyOnAttach, setDetachAllOnCommit, setIgnoreCache, setMapping, setMultithreaded, setName, setNontransactionalRead, setNontransactionalWrite, setOptimistic, setPersistenceUnitName, setPersistenceXmlFilename, setReadOnly, setRestoreValues, setRetainValues, setSchema, setServerTimeZoneID, setTransactionIsolationLevel, setTransactionType, supportedOptions
 
Methods inherited from class org.datanucleus.ObjectManagerFactoryImpl
addInternalFetchGroup, createInternalFetchGroup, getFetchGroupManager, getFetchGroupsWithName, getInternalFetchGroup, getLevel2Cache, getOMFContext, getPersistenceConfiguration, getStoreManager, getVendorName, getVersionNumber, initialiseLevel2Cache, initialiseOMFContext, initialiseStoreManager, isClosed, logConfiguration, removeInternalFetchGroup
 
Methods inherited from class org.datanucleus.PersistenceConfiguration
getBooleanObjectProperty, getBooleanProperty, getCalendarForDateTimezone, getIntProperty, getLongProperty, getOptions, getPrimaryClassLoader, getProperty, getStringProperty, getSupportedOptions, hasProperty, isJcaMode, setDefaultProperties, setJCAMode, setOptions, setPrimaryClassLoader, setPropertiesFile, setProperty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jdo.PersistenceManagerFactory
addFetchGroups, addInstanceLifecycleListener, close, getConnectionDriverName, getConnectionFactory, getConnectionFactory2, getConnectionFactory2Name, getConnectionFactoryName, getConnectionURL, getConnectionUserName, getCopyOnAttach, getDataStoreCache, getDetachAllOnCommit, getFetchGroup, getFetchGroups, getIgnoreCache, getMapping, getMultithreaded, getName, getNontransactionalRead, getNontransactionalWrite, getOptimistic, getPersistenceUnitName, getProperties, getReadOnly, getRestoreValues, getRetainValues, getServerTimeZoneID, getTransactionIsolationLevel, getTransactionType, isClosed, removeAllFetchGroups, removeFetchGroups, removeInstanceLifecycleListener, setConnectionDriverName, setConnectionFactory, setConnectionFactory2, setConnectionFactory2Name, setConnectionFactoryName, setConnectionPassword, setConnectionURL, setConnectionUserName, setCopyOnAttach, setDetachAllOnCommit, setIgnoreCache, setMapping, setMultithreaded, setName, setNontransactionalRead, setNontransactionalWrite, setOptimistic, setPersistenceUnitName, setReadOnly, setRestoreValues, setRetainValues, setServerTimeZoneID, setTransactionIsolationLevel, setTransactionType, supportedOptions
 

Constructor Detail

JDOPersistenceManagerFactory

public JDOPersistenceManagerFactory()
Constructs a new PersistenceManagerFactoryImpl.


JDOPersistenceManagerFactory

public JDOPersistenceManagerFactory(java.util.Map props)
Constructs a new PersistenceManagerFactoryImpl.

Parameters:
props - Persistent properties
Method Detail

getPersistenceManagerFactory

public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Properties overridingProps)
Return a new PersistenceManagerFactoryImpl with options set according to the given Properties. This method exists for JDO1 compliance whereas in JDO2 the method takes a Map.

Parameters:
overridingProps - The Properties to initialize the PersistenceManagerFactory with.
Returns:
A PersistenceManagerFactoryImpl with options set according to the given Properties.
See Also:
JDOHelper.getPersistenceManagerFactory(java.util.Map)

getPersistenceManagerFactory

public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map overridingProps)
Return a new PersistenceManagerFactoryImpl with options set according to the given Properties.

Parameters:
overridingProps - The Map of properties to initialize the PersistenceManagerFactory with.
Returns:
A PersistenceManagerFactoryImpl with options set according to the given Properties.
See Also:
JDOHelper.getPersistenceManagerFactory(java.util.Map)

getPersistenceManagerFactory

public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map overrides,
                                                                               java.util.Map props)
Return a new PersistenceManagerFactoryImpl with options set according to the given properties and given overrides.

Parameters:
overrides - Map of properties to override the supplied props (if any)
props - Map of properties to initialise the PMF with
Returns:
A PersistenceManagerFactoryImpl with options set according to the given Properties

createInstance

public static JDOPersistenceManagerFactory createInstance(java.util.Map props)
Convenience method to create a new PMF of this type. TODO When we remove org.datanucleus.PersistenceManagerFactoryImpl remove this too.

Returns:
The PMF

initialiseProperties

protected void initialiseProperties(java.util.Map props)
Convenience method to set the API and properties that a PMF will use. Process followed here is as follows :-

Parameters:
props - The properties to use for this PMF

freezeConfiguration

protected void freezeConfiguration()
Freezes the current configuration.

Overrides:
freezeConfiguration in class AbstractPersistenceManagerFactory
Throws:
NucleusException - if the configuration was invalid or inconsistent in some way

getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager()
Get an instance of PersistenceManager from this factory. The instance has default values for options.

After the first use of getPersistenceManager, no "set" methods will succeed.

Specified by:
getPersistenceManager in interface javax.jdo.PersistenceManagerFactory
Returns:
a PersistenceManager instance with default options.

getPersistenceManager

public javax.jdo.PersistenceManager getPersistenceManager(java.lang.String userName,
                                                          java.lang.String password)
Get an instance of PersistenceManager from this factory. The instance has default values for options. The parameters userid/password are used when obtaining datastore connections from the connection pool.

After the first use of getPersistenceManager, no "set" methods will succeed.

Specified by:
getPersistenceManager in interface javax.jdo.PersistenceManagerFactory
Parameters:
userName - the user name for the connection
password - the password for the connection
Returns:
PersistenceManager instance with default options.

equals

public boolean equals(java.lang.Object obj)
Equality operator.

Overrides:
equals in class PersistenceConfiguration
Parameters:
obj - Object to compare against
Returns:
Whether the objects are the same.

getObjectInstance

public java.lang.Object getObjectInstance(java.lang.Object obj,
                                          javax.naming.Name name,
                                          javax.naming.Context ctx,
                                          java.util.Hashtable env)
                                   throws java.lang.Exception
Create a PMF using the (JNDI) location or reference information specified.

Specified by:
getObjectInstance in interface javax.naming.spi.ObjectFactory
Parameters:
obj - The object
name - Name of the object relative to the context
ctx - The context
env - properties used for creating the object
Returns:
The PMF instance
Throws:
java.lang.Exception - If an error occurs generating the referenced object

getReference

public javax.naming.Reference getReference()
Retrieves the (JNDI) reference of this PMF object.

Specified by:
getReference in interface javax.naming.Referenceable
Returns:
The reference

getPersistenceManagerProxy

public javax.jdo.PersistenceManager getPersistenceManagerProxy()
Accessor for the PersistenceManager proxy object

Specified by:
getPersistenceManagerProxy in interface javax.jdo.PersistenceManagerFactory
Returns:
The PMF proxy


Copyright © 2009. All Rights Reserved.