org.datanucleus.jdo
Class JDOPersistenceManagerFactory

java.lang.Object
  extended by org.datanucleus.PersistenceConfiguration
      extended by org.datanucleus.ObjectManagerFactoryImpl
          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 ObjectManagerFactoryImpl
implements javax.jdo.PersistenceManagerFactory, javax.naming.spi.ObjectFactory, javax.naming.Referenceable

Implementation of a JDO PersistenceManagerFactory, used to obtain PersistenceManager instances. The factory is configurable up to a point when it is frozen. Thereafter nothing can be changed.

See Also:
Serialized Form

Field Summary
protected  java.util.List<LifecycleListenerForClass> lifecycleListeners
          Lifecycle Listeners.
protected static Localiser LOCALISER_JDO
          Localisation utility for output messages from jdo.
 
Fields inherited from class org.datanucleus.ObjectManagerFactoryImpl
cache, omfContext
 
Fields inherited from class org.datanucleus.PersistenceConfiguration
LOCALISER
 
Constructor Summary
JDOPersistenceManagerFactory()
          Constructs a new JDOPersistenceManagerFactory.
JDOPersistenceManagerFactory(java.util.Map props)
          Constructs a new JDOPersistenceManagerFactory.
 
Method Summary
 void addFetchGroups(javax.jdo.FetchGroup... groups)
           
 void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener, java.lang.Class[] classes)
          Method to add lifecycle listeners for particular classes.
 void addSequenceForFactoryClass(java.lang.String factoryClassName, javax.jdo.datastore.Sequence sequence)
          Method to register a sequence for a particular factory class.
protected  void assertConfigurable()
          Asserts that a change to a configuration property is allowed.
protected  void assertIsOpen()
          Asserts that the PMF is open.
 void close()
          Close this PersistenceManagerFactory.
protected static JDOPersistenceManagerFactory createPersistenceManagerFactory(java.util.Map props)
          Convenience method to create the PMF, check whether we should hand out a singleton, and if all ok then freeze it for use.
 boolean equals(java.lang.Object obj)
          Equality operator.
protected  void freezeConfiguration()
          Freezes the current configuration.
 java.lang.String getCatalog()
          Accessor for the catalog to use for this persistence factory.
 java.lang.String getConnectionDriverName()
          Get the driver name for the data store connection.
 java.lang.Object getConnectionFactory()
          Get the data store connection factory.
 java.lang.Object getConnectionFactory2()
          Get the second data store connection factory.
 java.lang.String getConnectionFactory2Name()
          Get the name for the second data store connection factory.
 java.lang.String getConnectionFactoryName()
          Get the name for the data store connection factory.
 java.lang.String getConnectionPassword()
          Get the password for the data store connection.
 java.lang.String getConnectionURL()
          Get the URL for the data store connection.
 java.lang.String getConnectionUserName()
          Get the user name for the data store connection.
 boolean getCopyOnAttach()
          Accessor for the CopyOnAttach setting.
 javax.jdo.datastore.DataStoreCache getDataStoreCache()
          Accessor for the DataStore (level 2) Cache
 java.lang.Integer getDatastoreReadTimeoutMillis()
          Accessor for the datastore read timeout interval.
 java.lang.Integer getDatastoreWriteTimeoutMillis()
          Accessor for the datastore write timeout interval.
 boolean getDetachAllOnCommit()
          Accessor for the DetachAllOnCommit setting.
 javax.jdo.FetchGroup getFetchGroup(java.lang.Class cls, java.lang.String name)
           
 java.util.Set<JDOFetchGroup> getFetchGroups()
           
 boolean getIgnoreCache()
          Get the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.
 java.util.List<LifecycleListenerForClass> getLifecycleListenerSpecifications()
           
 java.lang.String getMapping()
          Get the name for any mapping, used in retrieving metadata files for ORM/Query data.
 javax.jdo.metadata.TypeMetadata getMetadata(java.lang.String className)
          Method to return the (class) metadata object for the specified class, if there is metadata defined for that class.
 boolean getMultithreaded()
          Get the default Multithreaded setting for all PersistenceManager instances obtained from this factory.
 java.lang.String getName()
          Accessor for the name of the persistence factory (if any).
 boolean getNontransactionalRead()
          Get the default NontransactionalRead setting for all PersistenceManager instances obtained from this factory.
 boolean getNontransactionalWrite()
          Get the default NontransactionalWrite setting for all PersistenceManager instances obtained from this factory.
 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.
 boolean getOptimistic()
          Get the default Optimistic setting for all PersistenceManager instances obtained from this factory.
 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 PersistenceManagerFactory with options set according to the given Properties.
static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map overrides, java.util.Map props)
          Return a new PersistenceManagerFactory with options set according to the given properties and given overrides.
static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Properties overridingProps)
          Return a new PersistenceManagerFactory with options set according to the given Properties.
 javax.jdo.PersistenceManager getPersistenceManagerProxy()
          Accessor for the PersistenceManager proxy object
 java.lang.String getPersistenceUnitName()
          Accessor for the name of the persistence unit
 java.lang.String getPersistenceXmlFilename()
          Accessor for the filename of the persistence.xml file.
 java.util.Properties getProperties()
          Return non-configurable properties of this PersistenceManagerFactory.
 JDOQueryCache getQueryCache()
          Accessor for the query results cache.
 boolean getReadOnly()
          Get the default readOnly setting for all PersistenceManager instances obtained from this factory.
 javax.naming.Reference getReference()
          Retrieves the (JNDI) reference of this PMF object.
 boolean getRestoreValues()
          Get the default RestoreValues setting for all PersistenceManager instances obtained from this factory.
 boolean getRetainValues()
          Get the default RetainValues setting for all PersistenceManager instances obtained from this factory.
 java.lang.String getSchema()
          Accessor for the schema to use for this persistence factory.
 javax.jdo.datastore.Sequence getSequenceForFactoryClass(java.lang.String factoryClassName)
          Accessor for the sequence for a factory class.
 java.lang.String getServerTimeZoneID()
          Accessor for the timezone "id" of the datastore server (if any).
 java.lang.String getTransactionIsolationLevel()
          Accessor for the transaction isolation level default.
 java.lang.String getTransactionType()
          Accessor for the transaction type to use with this persistence factory.
protected  void initialiseProperties(java.util.Map props)
          Convenience method to set the API and properties that a PMF will use.
 boolean isClosed()
          Utility to return whether the factory is closed or not.
 javax.jdo.metadata.JDOMetadata newMetadata()
          Method to return a new metadata object that can be subsequently modified and registered with the persistence process using the method registerMetadata(javax.jdo.metadata.JDOMetadata).
protected  JDOPersistenceManager newPM(JDOPersistenceManagerFactory jdoPmf, java.lang.String userName, java.lang.String password)
          Construct a JDOPersistenceManager.
 void registerMetadata(javax.jdo.metadata.JDOMetadata metadata)
          Method to register the supplied metadata with the persistence process managed by this PersistenceManagerFactory.
 void releasePersistenceManager(JDOPersistenceManager om)
          Remove a PersistenceManager from the cache Only the PersistenceManager is allowed to call this method
 void removeAllFetchGroups()
           
 void removeFetchGroups(javax.jdo.FetchGroup... groups)
           
 void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
          Method to remove a lifecycle listener.
 void setCatalog(java.lang.String catalog)
          Mutator for the catalog to use for this persistence factory.
 void setConnectionDriverName(java.lang.String driverName)
          Set the driver name for the data store connection.
 void setConnectionFactory(java.lang.Object connectionFactory)
          Set the data store connection factory.
 void setConnectionFactory2(java.lang.Object connectionFactory)
          Set the second data store connection factory.
 void setConnectionFactory2Name(java.lang.String connectionFactoryName)
          Set the name for the second data store connection factory.
 void setConnectionFactoryName(java.lang.String connectionFactoryName)
          Set the name for the data store connection factory.
 void setConnectionPassword(java.lang.String password)
          Set the password for the data store connection.
 void setConnectionURL(java.lang.String url)
          Set the URL for the data store connection.
 void setConnectionUserName(java.lang.String userName)
          Set the user name for the data store connection.
 void setCopyOnAttach(boolean flag)
          Mutator for the CopyOnAttach setting.
 void setDatastoreReadTimeoutMillis(java.lang.Integer timeout)
          Mutator for the timeout to use for datastore reads.
 void setDatastoreWriteTimeoutMillis(java.lang.Integer timeout)
          Mutator for the timeout to use for datastore writes.
 void setDetachAllOnCommit(boolean flag)
          Mutator for the DetachAllOnCommit setting.
 void setIgnoreCache(boolean flag)
          Set the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.
 void setMapping(java.lang.String mapping)
          Set the name for any mapping, used in searching for ORM/Query metadata files.
 void setMultithreaded(boolean flag)
          Set the default Multithreaded setting for all PersistenceManager instances obtained from this factory.
 void setName(java.lang.String name)
          Mutator for the name of the persistence factory.
 void setNontransactionalRead(boolean flag)
          Set the default NontransactionalRead setting for all PersistenceManager instances obtained from this factory.
 void setNontransactionalWrite(boolean flag)
          Set the default NontransactionalWrite setting for all PersistenceManager instances obtained from this factory.
 void setOptimistic(boolean flag)
          Set the default Optimistic setting for all PersistenceManager instances obtained from this factory.
 void setPersistenceUnitName(java.lang.String name)
          Mutator for the name of the persistence unit.
 void setPersistenceXmlFilename(java.lang.String name)
          Mutator for the filename of the persistence.xml file.
 void setReadOnly(boolean flag)
          Set the readOnly setting for all PersistenceManager instances obtained from this factory.
 void setRestoreValues(boolean flag)
          Set the default RestoreValues setting for all PersistenceManager instances obtained from this factory.
 void setRetainValues(boolean flag)
          Set the default RetainValues setting for all PersistenceManager instances obtained from this factory.
 void setSchema(java.lang.String schema)
          Mutator for the schema to use for this persistence factory.
 void setServerTimeZoneID(java.lang.String id)
          Mutator for the timezone id of the datastore server.
 void setTransactionIsolationLevel(java.lang.String level)
          Set the default isolation level for transactions.
 void setTransactionType(java.lang.String type)
          Mutator for the transaction type to use for this persistence factory.
 java.util.Collection<java.lang.String> supportedOptions()
          The application can determine from the results of this method which optional features, and which query languages are supported by the JDO implementation.
 
Methods inherited from class org.datanucleus.ObjectManagerFactoryImpl
addInternalFetchGroup, createInternalFetchGroup, getFetchGroupManager, getFetchGroupsWithName, getInternalFetchGroup, getLevel2Cache, getOMFContext, getPersistenceConfiguration, getStoreManager, getVendorName, getVersionNumber, hasLevel2Cache, initialiseLevel2Cache, initialiseOMFContext, initialiseStoreManager, logConfiguration, removeInternalFetchGroup
 
Methods inherited from class org.datanucleus.PersistenceConfiguration
getBooleanObjectProperty, getBooleanProperty, getBooleanProperty, getCalendarForDateTimezone, getIntProperty, getLongProperty, getPersistenceProperties, getPrimaryClassLoader, getProperty, getStringProperty, getSupportedProperties, hasProperty, isConfigurable, setDefaultProperties, setIsNotConfigurable, setPersistenceProperties, setPrimaryClassLoader, setPropertiesUsingFile, setProperty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER_JDO

protected static final Localiser LOCALISER_JDO
Localisation utility for output messages from jdo.


lifecycleListeners

protected java.util.List<LifecycleListenerForClass> lifecycleListeners
Lifecycle Listeners.

Constructor Detail

JDOPersistenceManagerFactory

public JDOPersistenceManagerFactory()
Constructs a new JDOPersistenceManagerFactory.


JDOPersistenceManagerFactory

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

Parameters:
props - Persistent properties
Method Detail

getPersistenceManagerFactory

public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Properties overridingProps)
Return a new PersistenceManagerFactory 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 PersistenceManagerFactory 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 PersistenceManagerFactory with options set according to the given Properties.

Parameters:
overridingProps - The Map of properties to initialize the PersistenceManagerFactory with.
Returns:
A PersistenceManagerFactory 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 PersistenceManagerFactory 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 PersistenceManagerFactory with options set according to the given Properties

createPersistenceManagerFactory

protected static JDOPersistenceManagerFactory createPersistenceManagerFactory(java.util.Map props)
Convenience method to create the PMF, check whether we should hand out a singleton, and if all ok then freeze it for use.

Parameters:
props - The properties
Returns:
The PMF to use

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.

Throws:
javax.jdo.JDOException - 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.

newPM

protected JDOPersistenceManager newPM(JDOPersistenceManagerFactory jdoPmf,
                                      java.lang.String userName,
                                      java.lang.String password)
Construct a JDOPersistenceManager. Override if you want to construct a subclass instead.


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

getProperties

public java.util.Properties getProperties()
Return non-configurable properties of this PersistenceManagerFactory. Properties with keys VendorName and VersionNumber are required. Other keys are optional.

Specified by:
getProperties in interface javax.jdo.PersistenceManagerFactory
Returns:
the non-configurable properties of this PersistenceManagerFactory.

supportedOptions

public java.util.Collection<java.lang.String> supportedOptions()
The application can determine from the results of this method which optional features, and which query languages are supported by the JDO implementation. Se esection 11.6 of the JDO 2 specification.

Specified by:
supportedOptions in interface javax.jdo.PersistenceManagerFactory
Returns:
A Collection of String representing the supported options.

releasePersistenceManager

public void releasePersistenceManager(JDOPersistenceManager om)
Remove a PersistenceManager from the cache Only the PersistenceManager is allowed to call this method

Parameters:
om - the PersistenceManager to be removed from cache

assertIsOpen

protected void assertIsOpen()
Asserts that the PMF is open.

Throws:
javax.jdo.JDOUserException - if it is already closed

isClosed

public boolean isClosed()
Utility to return whether the factory is closed or not.

Specified by:
isClosed in interface javax.jdo.PersistenceManagerFactory
Returns:
Whether it is closed.

close

public void close()
Close this PersistenceManagerFactory. Check for JDOPermission("closePersistenceManagerFactory") and if not authorized, throw SecurityException.

If the authorization check succeeds, check to see that all PersistenceManager instances obtained from this PersistenceManagerFactory have no active transactions. If any PersistenceManager instances have an active transaction, throw a JDOUserException, with one nested JDOUserException for each PersistenceManager with an active Transaction.

If there are no active transactions, then close all PersistenceManager instances obtained from this PersistenceManagerFactory, mark this PersistenceManagerFactory as closed, disallow getPersistenceManager methods, and allow all other get methods. If a set method or getPersistenceManager method is called after close, then JDOUserException is thrown.

Specified by:
close in interface javax.jdo.PersistenceManagerFactory
Overrides:
close in class ObjectManagerFactoryImpl
See Also:
PersistenceManagerFactory.close()

getDataStoreCache

public javax.jdo.datastore.DataStoreCache getDataStoreCache()
Accessor for the DataStore (level 2) Cache

Specified by:
getDataStoreCache in interface javax.jdo.PersistenceManagerFactory
Returns:
The datastore cache

getQueryCache

public JDOQueryCache getQueryCache()
Accessor for the query results cache.

Returns:
Query results cache

setConnectionUserName

public void setConnectionUserName(java.lang.String userName)
Set the user name for the data store connection.

Specified by:
setConnectionUserName in interface javax.jdo.PersistenceManagerFactory
Parameters:
userName - the user name for the data store connection.

setConnectionPassword

public void setConnectionPassword(java.lang.String password)
Set the password for the data store connection.

Specified by:
setConnectionPassword in interface javax.jdo.PersistenceManagerFactory
Parameters:
password - the password for the data store connection.

setConnectionURL

public void setConnectionURL(java.lang.String url)
Set the URL for the data store connection.

Specified by:
setConnectionURL in interface javax.jdo.PersistenceManagerFactory
Parameters:
url - the URL for the data store connection.

setConnectionDriverName

public void setConnectionDriverName(java.lang.String driverName)
Set the driver name for the data store connection.

Specified by:
setConnectionDriverName in interface javax.jdo.PersistenceManagerFactory
Parameters:
driverName - the driver name for the data store connection.

setConnectionFactoryName

public void setConnectionFactoryName(java.lang.String connectionFactoryName)
Set the name for the data store connection factory.

Specified by:
setConnectionFactoryName in interface javax.jdo.PersistenceManagerFactory
Parameters:
connectionFactoryName - name of the data store connection factory.

setConnectionFactory

public void setConnectionFactory(java.lang.Object connectionFactory)
Set the data store connection factory. JDO implementations will support specific connection factories. The connection factory interfaces are not part of the JDO specification.

Specified by:
setConnectionFactory in interface javax.jdo.PersistenceManagerFactory
Parameters:
connectionFactory - the data store connection factory.

setConnectionFactory2Name

public void setConnectionFactory2Name(java.lang.String connectionFactoryName)
Set the name for the second data store connection factory. This is needed for managed environments to get nontransactional connections for optimistic transactions.

Specified by:
setConnectionFactory2Name in interface javax.jdo.PersistenceManagerFactory
Parameters:
connectionFactoryName - name of the data store connection factory.

setConnectionFactory2

public void setConnectionFactory2(java.lang.Object connectionFactory)
Set the second data store connection factory. This is needed for managed environments to get nontransactional connections for optimistic transactions. JDO implementations will support specific connection factories. The connection factory interfaces are not part of the JDO specification.

Specified by:
setConnectionFactory2 in interface javax.jdo.PersistenceManagerFactory
Parameters:
connectionFactory - the data store connection factory.

setMultithreaded

public void setMultithreaded(boolean flag)
Set the default Multithreaded setting for all PersistenceManager instances obtained from this factory.

Specified by:
setMultithreaded in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default Multithreaded setting.

setOptimistic

public void setOptimistic(boolean flag)
Set the default Optimistic setting for all PersistenceManager instances obtained from this factory.

Specified by:
setOptimistic in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default Optimistic setting.

setRetainValues

public void setRetainValues(boolean flag)
Set the default RetainValues setting for all PersistenceManager instances obtained from this factory.

Specified by:
setRetainValues in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default RetainValues setting.

setRestoreValues

public void setRestoreValues(boolean flag)
Set the default RestoreValues setting for all PersistenceManager instances obtained from this factory.

Specified by:
setRestoreValues in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default RestoreValues setting.

setNontransactionalRead

public void setNontransactionalRead(boolean flag)
Set the default NontransactionalRead setting for all PersistenceManager instances obtained from this factory.

Specified by:
setNontransactionalRead in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default NontransactionalRead setting.

setNontransactionalWrite

public void setNontransactionalWrite(boolean flag)
Set the default NontransactionalWrite setting for all PersistenceManager instances obtained from this factory.

Specified by:
setNontransactionalWrite in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default NontransactionalWrite setting.

setIgnoreCache

public void setIgnoreCache(boolean flag)
Set the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.

Specified by:
setIgnoreCache in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default IgnoreCache setting.

setDetachAllOnCommit

public void setDetachAllOnCommit(boolean flag)
Mutator for the DetachAllOnCommit setting.

Specified by:
setDetachAllOnCommit in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default DetachAllOnCommit setting.

setCopyOnAttach

public void setCopyOnAttach(boolean flag)
Mutator for the CopyOnAttach setting.

Specified by:
setCopyOnAttach in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default CopyOnAttach setting.

setMapping

public void setMapping(java.lang.String mapping)
Set the name for any mapping, used in searching for ORM/Query metadata files.

Specified by:
setMapping in interface javax.jdo.PersistenceManagerFactory
Parameters:
mapping - the mapping name

setCatalog

public void setCatalog(java.lang.String catalog)
Mutator for the catalog to use for this persistence factory.

Parameters:
catalog - Name of the catalog

setSchema

public void setSchema(java.lang.String schema)
Mutator for the schema to use for this persistence factory.

Parameters:
schema - Name of the schema

setDatastoreReadTimeoutMillis

public void setDatastoreReadTimeoutMillis(java.lang.Integer timeout)
Mutator for the timeout to use for datastore reads.

Specified by:
setDatastoreReadTimeoutMillis in interface javax.jdo.PersistenceManagerFactory
Parameters:
timeout - Datastore read interval (millisecs)

setDatastoreWriteTimeoutMillis

public void setDatastoreWriteTimeoutMillis(java.lang.Integer timeout)
Mutator for the timeout to use for datastore writes.

Specified by:
setDatastoreWriteTimeoutMillis in interface javax.jdo.PersistenceManagerFactory
Parameters:
timeout - Datastore write interval (millisecs)

setTransactionType

public void setTransactionType(java.lang.String type)
Mutator for the transaction type to use for this persistence factory.

Specified by:
setTransactionType in interface javax.jdo.PersistenceManagerFactory
Parameters:
type - Transaction type

setPersistenceUnitName

public void setPersistenceUnitName(java.lang.String name)
Mutator for the name of the persistence unit.

Specified by:
setPersistenceUnitName in interface javax.jdo.PersistenceManagerFactory
Parameters:
name - Name of the persistence unit

setPersistenceXmlFilename

public void setPersistenceXmlFilename(java.lang.String name)
Mutator for the filename of the persistence.xml file. This is for the case where an application has placed the persistence.xml somewhere else maybe outside the CLASSPATH.

Parameters:
name - Filename of the persistence unit

setName

public void setName(java.lang.String name)
Mutator for the name of the persistence factory.

Specified by:
setName in interface javax.jdo.PersistenceManagerFactory
Parameters:
name - Name of the persistence factory (if any)

setServerTimeZoneID

public void setServerTimeZoneID(java.lang.String id)
Mutator for the timezone id of the datastore server. If not set assumes that it is running in the same timezone as this JVM.

Specified by:
setServerTimeZoneID in interface javax.jdo.PersistenceManagerFactory
Parameters:
id - Timezone Id to use

setReadOnly

public void setReadOnly(boolean flag)
Set the readOnly setting for all PersistenceManager instances obtained from this factory.

Specified by:
setReadOnly in interface javax.jdo.PersistenceManagerFactory
Parameters:
flag - the default readOnly setting.

setTransactionIsolationLevel

public void setTransactionIsolationLevel(java.lang.String level)
Set the default isolation level for transactions.

Specified by:
setTransactionIsolationLevel in interface javax.jdo.PersistenceManagerFactory
Parameters:
level - Level

getConnectionUserName

public java.lang.String getConnectionUserName()
Get the user name for the data store connection.

Specified by:
getConnectionUserName in interface javax.jdo.PersistenceManagerFactory
Returns:
the user name for the data store connection.

getConnectionPassword

public java.lang.String getConnectionPassword()
Get the password for the data store connection.

Returns:
the password for the data store connection.

getConnectionURL

public java.lang.String getConnectionURL()
Get the URL for the data store connection.

Specified by:
getConnectionURL in interface javax.jdo.PersistenceManagerFactory
Returns:
the URL for the data store connection.

getConnectionDriverName

public java.lang.String getConnectionDriverName()
Get the driver name for the data store connection.

Specified by:
getConnectionDriverName in interface javax.jdo.PersistenceManagerFactory
Returns:
the driver name for the data store connection.

getConnectionFactoryName

public java.lang.String getConnectionFactoryName()
Get the name for the data store connection factory.

Specified by:
getConnectionFactoryName in interface javax.jdo.PersistenceManagerFactory
Returns:
the name of the data store connection factory.

getConnectionFactory2Name

public java.lang.String getConnectionFactory2Name()
Get the name for the second data store connection factory. This is needed for managed environments to get nontransactional connections for optimistic transactions.

Specified by:
getConnectionFactory2Name in interface javax.jdo.PersistenceManagerFactory
Returns:
the name of the data store connection factory.

getConnectionFactory

public java.lang.Object getConnectionFactory()
Get the data store connection factory.

Specified by:
getConnectionFactory in interface javax.jdo.PersistenceManagerFactory
Returns:
the data store connection factory.

getConnectionFactory2

public java.lang.Object getConnectionFactory2()
Get the second data store connection factory. This is needed for managed environments to get nontransactional connections for optimistic transactions.

Specified by:
getConnectionFactory2 in interface javax.jdo.PersistenceManagerFactory
Returns:
the data store connection factory.

getMultithreaded

public boolean getMultithreaded()
Get the default Multithreaded setting for all PersistenceManager instances obtained from this factory.

Specified by:
getMultithreaded in interface javax.jdo.PersistenceManagerFactory
Returns:
the default Multithreaded setting.

getOptimistic

public boolean getOptimistic()
Get the default Optimistic setting for all PersistenceManager instances obtained from this factory.

Specified by:
getOptimistic in interface javax.jdo.PersistenceManagerFactory
Returns:
the default Optimistic setting.

getRetainValues

public boolean getRetainValues()
Get the default RetainValues setting for all PersistenceManager instances obtained from this factory.

Specified by:
getRetainValues in interface javax.jdo.PersistenceManagerFactory
Returns:
the default RetainValues setting.

getRestoreValues

public boolean getRestoreValues()
Get the default RestoreValues setting for all PersistenceManager instances obtained from this factory.

Specified by:
getRestoreValues in interface javax.jdo.PersistenceManagerFactory
Returns:
the default RestoreValues setting.

getNontransactionalRead

public boolean getNontransactionalRead()
Get the default NontransactionalRead setting for all PersistenceManager instances obtained from this factory.

Specified by:
getNontransactionalRead in interface javax.jdo.PersistenceManagerFactory
Returns:
the default NontransactionalRead setting.

getNontransactionalWrite

public boolean getNontransactionalWrite()
Get the default NontransactionalWrite setting for all PersistenceManager instances obtained from this factory.

Specified by:
getNontransactionalWrite in interface javax.jdo.PersistenceManagerFactory
Returns:
the default NontransactionalWrite setting.

getIgnoreCache

public boolean getIgnoreCache()
Get the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.

Specified by:
getIgnoreCache in interface javax.jdo.PersistenceManagerFactory
Returns:
the IgnoreCache setting.

getDetachAllOnCommit

public boolean getDetachAllOnCommit()
Accessor for the DetachAllOnCommit setting.

Specified by:
getDetachAllOnCommit in interface javax.jdo.PersistenceManagerFactory
Returns:
the DetachAllOnCommit setting.

getCopyOnAttach

public boolean getCopyOnAttach()
Accessor for the CopyOnAttach setting.

Specified by:
getCopyOnAttach in interface javax.jdo.PersistenceManagerFactory
Returns:
the CopyOnAttach setting.

getMapping

public java.lang.String getMapping()
Get the name for any mapping, used in retrieving metadata files for ORM/Query data.

Specified by:
getMapping in interface javax.jdo.PersistenceManagerFactory
Returns:
the name for the mapping.

getCatalog

public java.lang.String getCatalog()
Accessor for the catalog to use for this persistence factory.

Returns:
the name of the catalog

getSchema

public java.lang.String getSchema()
Accessor for the schema to use for this persistence factory.

Returns:
the name of the schema

getName

public java.lang.String getName()
Accessor for the name of the persistence factory (if any).

Specified by:
getName in interface javax.jdo.PersistenceManagerFactory
Returns:
the name of the persistence factory

getPersistenceUnitName

public java.lang.String getPersistenceUnitName()
Accessor for the name of the persistence unit

Specified by:
getPersistenceUnitName in interface javax.jdo.PersistenceManagerFactory
Returns:
the name of the persistence unit

getPersistenceXmlFilename

public java.lang.String getPersistenceXmlFilename()
Accessor for the filename of the persistence.xml file. This is for the case where an application has placed the persistence.xml somewhere else maybe outside the CLASSPATH.

Returns:
the filename of the persistence unit

getDatastoreReadTimeoutMillis

public java.lang.Integer getDatastoreReadTimeoutMillis()
Accessor for the datastore read timeout interval.

Specified by:
getDatastoreReadTimeoutMillis in interface javax.jdo.PersistenceManagerFactory
Returns:
datastore read timeout

getDatastoreWriteTimeoutMillis

public java.lang.Integer getDatastoreWriteTimeoutMillis()
Accessor for the datastore write timeout interval.

Specified by:
getDatastoreWriteTimeoutMillis in interface javax.jdo.PersistenceManagerFactory
Returns:
datastore write timeout

getServerTimeZoneID

public java.lang.String getServerTimeZoneID()
Accessor for the timezone "id" of the datastore server (if any). If not set assumes the same as the JVM we are running in.

Specified by:
getServerTimeZoneID in interface javax.jdo.PersistenceManagerFactory
Returns:
Server timezone id

getReadOnly

public boolean getReadOnly()
Get the default readOnly setting for all PersistenceManager instances obtained from this factory.

Specified by:
getReadOnly in interface javax.jdo.PersistenceManagerFactory
Returns:
the default readOnly setting.

getTransactionType

public java.lang.String getTransactionType()
Accessor for the transaction type to use with this persistence factory.

Specified by:
getTransactionType in interface javax.jdo.PersistenceManagerFactory
Returns:
transaction type

getTransactionIsolationLevel

public java.lang.String getTransactionIsolationLevel()
Accessor for the transaction isolation level default.

Specified by:
getTransactionIsolationLevel in interface javax.jdo.PersistenceManagerFactory
Returns:
Transaction isolation level

assertConfigurable

protected void assertConfigurable()
Asserts that a change to a configuration property is allowed.

Overrides:
assertConfigurable in class PersistenceConfiguration
Throws:
javax.jdo.JDOUserException - if not configurable

getLifecycleListenerSpecifications

public java.util.List<LifecycleListenerForClass> getLifecycleListenerSpecifications()
Returns:
Returns either null or a List with instances of LifecycleListenerSpecification.

addInstanceLifecycleListener

public void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener,
                                         java.lang.Class[] classes)
Method to add lifecycle listeners for particular classes. Adds the listener to all PMs already created.

Specified by:
addInstanceLifecycleListener in interface javax.jdo.PersistenceManagerFactory
Parameters:
listener - The listener
classes - The classes that the listener relates to

removeInstanceLifecycleListener

public void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
Method to remove a lifecycle listener. Removes the listener from all PM's as well.

Specified by:
removeInstanceLifecycleListener in interface javax.jdo.PersistenceManagerFactory
Parameters:
listener - The Listener

addSequenceForFactoryClass

public void addSequenceForFactoryClass(java.lang.String factoryClassName,
                                       javax.jdo.datastore.Sequence sequence)
Method to register a sequence for a particular factory class.

Parameters:
factoryClassName - Name of the factory class
sequence - The sequence

getSequenceForFactoryClass

public javax.jdo.datastore.Sequence getSequenceForFactoryClass(java.lang.String factoryClassName)
Accessor for the sequence for a factory class.

Parameters:
factoryClassName - The name of the factory class
Returns:
The sequence

getFetchGroups

public java.util.Set<JDOFetchGroup> getFetchGroups()
Specified by:
getFetchGroups in interface javax.jdo.PersistenceManagerFactory

getFetchGroup

public javax.jdo.FetchGroup getFetchGroup(java.lang.Class cls,
                                          java.lang.String name)
Specified by:
getFetchGroup in interface javax.jdo.PersistenceManagerFactory

addFetchGroups

public void addFetchGroups(javax.jdo.FetchGroup... groups)
Specified by:
addFetchGroups in interface javax.jdo.PersistenceManagerFactory

removeFetchGroups

public void removeFetchGroups(javax.jdo.FetchGroup... groups)
Specified by:
removeFetchGroups in interface javax.jdo.PersistenceManagerFactory

removeAllFetchGroups

public void removeAllFetchGroups()
Specified by:
removeAllFetchGroups in interface javax.jdo.PersistenceManagerFactory

newMetadata

public javax.jdo.metadata.JDOMetadata newMetadata()
Method to return a new metadata object that can be subsequently modified and registered with the persistence process using the method registerMetadata(javax.jdo.metadata.JDOMetadata).

Specified by:
newMetadata in interface javax.jdo.PersistenceManagerFactory
Returns:
Metadata object to start from

registerMetadata

public void registerMetadata(javax.jdo.metadata.JDOMetadata metadata)
Method to register the supplied metadata with the persistence process managed by this PersistenceManagerFactory. Metadata can be created using the method newMetadata().

Specified by:
registerMetadata in interface javax.jdo.PersistenceManagerFactory
Parameters:
metadata - The Metadata to register.

getMetadata

public javax.jdo.metadata.TypeMetadata getMetadata(java.lang.String className)
Method to return the (class) metadata object for the specified class, if there is metadata defined for that class.

Specified by:
getMetadata in interface javax.jdo.PersistenceManagerFactory
Returns:
The metadata


Copyright © 2010. All Rights Reserved.