Class JDOPersistenceManagerFactory
- java.lang.Object
-
- org.datanucleus.api.jdo.JDOPersistenceManagerFactory
-
- All Implemented Interfaces:
Serializable,AutoCloseable,javax.jdo.PersistenceManagerFactory,Referenceable,ObjectFactory
public class JDOPersistenceManagerFactory extends Object implements javax.jdo.PersistenceManagerFactory, ObjectFactory, Referenceable, AutoCloseable
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.Serialisation When a PMF is serialised its persistence properties are serialised with it, but dynamic state (fetch groups, listeners, L2 cache, etc) are not serialised with it.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<javax.jdo.listener.InstanceLifecycleListener,LifecycleListenerForClass>lifecycleListenersLifecycle Listeners.protected org.datanucleus.PersistenceNucleusContextnucleusContextThe context that this factory uses.
-
Constructor Summary
Constructors Constructor Description JDOPersistenceManagerFactory()Constructs a new JDOPersistenceManagerFactory.JDOPersistenceManagerFactory(Map props)Constructs a new JDOPersistenceManagerFactory for the specified persistence properties.JDOPersistenceManagerFactory(org.datanucleus.metadata.PersistenceUnitMetaData pumd, Map overrideProps)Constructor for a PMF for the specified persistence-unit with optional overriding properties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFetchGroups(javax.jdo.FetchGroup... groups)voidaddInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener, Class[] classes)Method to add lifecycle listeners for particular classes.voidaddSequenceForFactoryClass(String factoryClassName, javax.jdo.datastore.Sequence sequence)Method to register a sequence for a particular factory class.protected voidassertConfigurable()Asserts that a change to a configuration property is allowed.protected voidassertIsOpen()Asserts that the PMF is open.static voidcheckJDOPermission(javax.jdo.spi.JDOPermission jdoPermission)voidclose()Close this PersistenceManagerFactory.protected static JDOPersistenceManagerFactorycreatePersistenceManagerFactory(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.booleanequals(Object obj)Equality operator.protected voidfinalize()protected voidfreezeConfiguration()Freezes the current configuration.StringgetCatalog()Accessor for the catalog to use for this persistence factory.protected org.datanucleus.ConfigurationgetConfiguration()StringgetConnectionDriverName()Get the driver name for the data store connection.ObjectgetConnectionFactory()Get the data store connection factory.ObjectgetConnectionFactory2()Get the second data store connection factory.StringgetConnectionFactory2Name()Get the name for the second data store connection factory.StringgetConnectionFactoryName()Get the name for the data store connection factory.StringgetConnectionPassword()Get the password for the data store connection.StringgetConnectionURL()Get the URL for the data store connection.StringgetConnectionUserName()Get the user name for the data store connection.booleangetCopyOnAttach()Accessor for the CopyOnAttach setting.javax.jdo.datastore.DataStoreCachegetDataStoreCache()Accessor for the DataStore (level 2) CacheIntegergetDatastoreReadTimeoutMillis()Accessor for the datastore read timeout interval.IntegergetDatastoreWriteTimeoutMillis()Accessor for the datastore write timeout interval.booleangetDetachAllOnCommit()Accessor for the DetachAllOnCommit setting.javax.jdo.FetchGroupgetFetchGroup(Class cls, String name)Set<javax.jdo.FetchGroup>getFetchGroups()booleangetIgnoreCache()Get the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.Collection<Class>getManagedClasses()Accessor for the classes that are managed (have metadata loaded).StringgetMapping()Get the name for any mapping, used in retrieving metadata files for ORM/Query data.javax.jdo.metadata.TypeMetadatagetMetadata(String className)Method to return the (class) metadata object for the specified class, if there is metadata defined for that class.booleangetMultithreaded()Get the default Multithreaded setting for all PersistenceManager instances obtained from this factory.StringgetName()Accessor for the name of the persistence factory (if any).booleangetNontransactionalRead()Get the default NontransactionalRead setting for all PersistenceManager instances obtained from this factory.booleangetNontransactionalWrite()Get the default NontransactionalWrite setting for all PersistenceManager instances obtained from this factory.booleangetNontransactionalWriteAutoCommit()Get the default auto-commit setting for non-tx writes for all PersistenceManager instances obtained from this factory.org.datanucleus.PersistenceNucleusContextgetNucleusContext()ObjectgetObjectInstance(Object obj, Name name, Context ctx, Hashtable env)Create a PMF using the (JNDI) location or reference information specified.booleangetOptimistic()Get the default Optimistic setting for all PersistenceManager instances obtained from this factory.javax.jdo.PersistenceManagergetPersistenceManager()Get an instance of PersistenceManager from this factory.javax.jdo.PersistenceManagergetPersistenceManager(String userName, String password)Get an instance of PersistenceManager from this factory.static javax.jdo.PersistenceManagerFactorygetPersistenceManagerFactory(Map overridingProps)Return a new PersistenceManagerFactory with options set according to the given Properties.static javax.jdo.PersistenceManagerFactorygetPersistenceManagerFactory(Map overrides, Map props)Return a new PersistenceManagerFactory with options set according to the given properties and given overrides.static javax.jdo.PersistenceManagerFactorygetPersistenceManagerFactory(Properties overridingProps)Return a new PersistenceManagerFactory with options set according to the given Properties.javax.jdo.PersistenceManagergetPersistenceManagerProxy()Accessor for the PersistenceManager proxy objectMap<String,Object>getPersistenceProperties()Accessor for the persistence properties.StringgetPersistenceUnitName()Accessor for the name of the persistence unitStringgetPersistenceXmlFilename()Accessor for the filename of the persistence.xml file.ClassLoadergetPrimaryClassLoader()Accessor for the primary class loaderPropertiesgetProperties()Return non-configurable properties of this PersistenceManagerFactory.JDOQueryCachegetQueryCache()Accessor for the query results cache.org.datanucleus.store.query.cache.QueryDatastoreCompilationCachegetQueryDatastoreCompilationCache()Accessor for the query datastore compilation cache.org.datanucleus.store.query.cache.QueryCompilationCachegetQueryGenericCompilationCache()Accessor for the query generic compilation cache.booleangetReadOnly()Get the default readOnly setting for all PersistenceManager instances obtained from this factory.ReferencegetReference()Retrieves the (JNDI) reference of this PMF object.booleangetRestoreValues()Get the default RestoreValues setting for all PersistenceManager instances obtained from this factory.booleangetRetainValues()Get the default RetainValues setting for all PersistenceManager instances obtained from this factory.StringgetSchema()Accessor for the schema to use for this persistence factory.javax.jdo.datastore.SequencegetSequenceForFactoryClass(String factoryClassName)Accessor for the sequence for a factory class.StringgetServerTimeZoneID()Accessor for the timezone "id" of the datastore server (if any).StringgetTransactionIsolationLevel()Accessor for the transaction isolation level default.StringgetTransactionType()Accessor for the transaction type to use with this persistence factory.inthashCode()protected voidinitialiseMetaData(org.datanucleus.metadata.PersistenceUnitMetaData pumd)booleanisClosed()Utility to return whether the factory is closed or not.protected booleanisConfigurable()Accessor for whether this is still configurable (can set more properties etc).javax.jdo.metadata.JDOMetadatanewMetadata()Method to return a new metadata object that can be subsequently modified and registered with the persistence process using the methodregisterMetadata(javax.jdo.metadata.JDOMetadata).protected JDOPersistenceManagernewPM(JDOPersistenceManagerFactory jdoPmf, String userName, String password)protected voidprocessLifecycleListenersFromProperties(Map props)Convenience method to extract lifecycle listeners that are specified by way of persistence properties.voidregisterMetadata(javax.jdo.metadata.JDOMetadata metadata)Method to register the supplied metadata with the persistence process managed by thisPersistenceManagerFactory.voidreleasePersistenceManager(JDOPersistenceManager pm)Remove a PersistenceManager from the cache.voidremoveAllFetchGroups()voidremoveFetchGroups(javax.jdo.FetchGroup... groups)voidremoveInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)Method to remove a lifecycle listener.voidsetCatalog(String catalog)Mutator for the catalog to use for this persistence factory.voidsetConnectionDriverName(String driverName)Set the driver name for the data store connection.voidsetConnectionFactory(Object connectionFactory)Set the data store connection factory.voidsetConnectionFactory2(Object connectionFactory)Set the second data store connection factory.voidsetConnectionFactory2Name(String connectionFactoryName)Set the name for the second data store connection factory.voidsetConnectionFactoryName(String connectionFactoryName)Set the name for the data store connection factory.voidsetConnectionPassword(String password)Set the password for the data store connection.voidsetConnectionURL(String url)Set the URL for the data store connection.voidsetConnectionUserName(String userName)Set the user name for the data store connection.voidsetCopyOnAttach(boolean flag)Mutator for the CopyOnAttach setting.voidsetDatastoreReadTimeoutMillis(Integer timeout)Mutator for the timeout to use for datastore reads.voidsetDatastoreWriteTimeoutMillis(Integer timeout)Mutator for the timeout to use for datastore writes.voidsetDetachAllOnCommit(boolean flag)Mutator for the DetachAllOnCommit setting.voidsetIgnoreCache(boolean flag)Set the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.protected voidsetIsNotConfigurable()Method to set that this is no longer configurable.voidsetMapping(String mapping)Set the name for any mapping, used in searching for ORM/Query metadata files.voidsetMultithreaded(boolean flag)Set the default Multithreaded setting for all PersistenceManager instances obtained from this factory.voidsetName(String name)Mutator for the name of the persistence factory.voidsetNontransactionalRead(boolean flag)Set the default NontransactionalRead setting for all PersistenceManager instances obtained from this factory.voidsetNontransactionalWrite(boolean flag)Set the default NontransactionalWrite setting for all PersistenceManager instances obtained from this factory.voidsetNontransactionalWriteAutoCommit(boolean flag)Set the default for whether to auto-commit non-tx writes for all PersistenceManager instances obtained from this factory.voidsetOptimistic(boolean flag)Set the default Optimistic setting for all PersistenceManager instances obtained from this factory.voidsetPersistenceProperties(Map<String,Object> props)Set the properties for this configuration.voidsetPersistenceUnitName(String name)Mutator for the name of the persistence unit.voidsetPersistenceXmlFilename(String name)Mutator for the filename of the persistence.xml file.voidsetPrimaryClassLoader(ClassLoader loader)Mutator to set the primary class loader.voidsetReadOnly(boolean flag)Set the readOnly setting for all PersistenceManager* instances obtained from this factory.voidsetRestoreValues(boolean flag)Set the default RestoreValues setting for all PersistenceManager instances obtained from this factory.voidsetRetainValues(boolean flag)Set the default RetainValues setting for all PersistenceManager instances obtained from this factory.voidsetSchema(String schema)Mutator for the schema to use for this persistence factory.voidsetServerTimeZoneID(String id)Mutator for the timezone id of the datastore server.voidsetTransactionIsolationLevel(String level)Set the default isolation level for transactions.voidsetTransactionType(String type)Mutator for the transaction type to use for this persistence factory.Collection<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.voidunmanageClass(String className)Method to remove the specified class from the classes that are being managed.
-
-
-
Field Detail
-
nucleusContext
protected transient org.datanucleus.PersistenceNucleusContext nucleusContext
The context that this factory uses. TODO Ought to be serializable, or able to recreate.
-
lifecycleListeners
protected transient Map<javax.jdo.listener.InstanceLifecycleListener,LifecycleListenerForClass> lifecycleListeners
Lifecycle Listeners.
-
-
Constructor Detail
-
JDOPersistenceManagerFactory
public JDOPersistenceManagerFactory()
Constructs a new JDOPersistenceManagerFactory.
-
JDOPersistenceManagerFactory
public JDOPersistenceManagerFactory(org.datanucleus.metadata.PersistenceUnitMetaData pumd, Map overrideProps)Constructor for a PMF for the specified persistence-unit with optional overriding properties.- Parameters:
pumd- The persistence unitoverrideProps- Properties overriding/supplementing those in the persistence-unit
-
JDOPersistenceManagerFactory
public JDOPersistenceManagerFactory(Map props)
Constructs a new JDOPersistenceManagerFactory for the specified persistence properties.- Parameters:
props- Persistence properties
-
-
Method Detail
-
getPersistenceManagerFactory
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(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(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(Map overrides, 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(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
-
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:
closein interfaceAutoCloseable- Specified by:
closein interfacejavax.jdo.PersistenceManagerFactory- See Also:
PersistenceManagerFactory.close()
-
isClosed
public boolean isClosed()
Utility to return whether the factory is closed or not.- Specified by:
isClosedin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- Whether it is closed.
-
processLifecycleListenersFromProperties
protected void processLifecycleListenersFromProperties(Map props)
Convenience method to extract lifecycle listeners that are specified by way of persistence properties.- Parameters:
props- Persistence props.
-
initialiseMetaData
protected void initialiseMetaData(org.datanucleus.metadata.PersistenceUnitMetaData pumd)
-
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:
getPersistenceManagerin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- a PersistenceManager instance with default options.
-
getPersistenceManager
public javax.jdo.PersistenceManager getPersistenceManager(String userName, String password)
Get an instance of PersistenceManager from this factory. The instance has default values for options. The parameters user-id/password are used when obtaining datastore connections from the connection pool.After the first use of getPersistenceManager, no "set" methods will succeed.
- Specified by:
getPersistenceManagerin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
userName- the user name for the connectionpassword- the password for the connection- Returns:
- PersistenceManager instance with default options.
-
newPM
protected JDOPersistenceManager newPM(JDOPersistenceManagerFactory jdoPmf, String userName, String password)
-
getNucleusContext
public org.datanucleus.PersistenceNucleusContext getNucleusContext()
-
getConfiguration
protected org.datanucleus.Configuration getConfiguration()
-
equals
public boolean equals(Object obj)
Equality operator.
-
getObjectInstance
public Object getObjectInstance(Object obj, Name name, Context ctx, Hashtable env) throws Exception
Create a PMF using the (JNDI) location or reference information specified.- Specified by:
getObjectInstancein interfaceObjectFactory- Parameters:
obj- The objectname- Name of the object relative to the contextctx- The contextenv- properties used for creating the object- Returns:
- The PMF instance
- Throws:
Exception- If an error occurs generating the referenced object
-
getReference
public Reference getReference()
Retrieves the (JNDI) reference of this PMF object.- Specified by:
getReferencein interfaceReferenceable- Returns:
- The reference
-
getPersistenceManagerProxy
public javax.jdo.PersistenceManager getPersistenceManagerProxy()
Accessor for the PersistenceManager proxy object- Specified by:
getPersistenceManagerProxyin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- The PMF proxy
-
getProperties
public Properties getProperties()
Return non-configurable properties of this PersistenceManagerFactory. Properties with keys VendorName and VersionNumber are required. Other keys are optional.- Specified by:
getPropertiesin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the non-configurable properties of this PersistenceManagerFactory.
-
supportedOptions
public Collection<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. See section 11.6 of the JDO specification.- Specified by:
supportedOptionsin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- A Collection of String representing the supported options.
-
releasePersistenceManager
public void releasePersistenceManager(JDOPersistenceManager pm)
Remove a PersistenceManager from the cache. Only the PersistenceManager is allowed to call this method- Parameters:
pm- 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
-
finalize
protected void finalize() throws Throwable
-
getDataStoreCache
public javax.jdo.datastore.DataStoreCache getDataStoreCache()
Accessor for the DataStore (level 2) Cache- Specified by:
getDataStoreCachein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- The datastore cache
-
getQueryCache
public JDOQueryCache getQueryCache()
Accessor for the query results cache.- Returns:
- Query results cache
-
getQueryGenericCompilationCache
public org.datanucleus.store.query.cache.QueryCompilationCache getQueryGenericCompilationCache()
Accessor for the query generic compilation cache.- Returns:
- Query generic compilation cache
-
getQueryDatastoreCompilationCache
public org.datanucleus.store.query.cache.QueryDatastoreCompilationCache getQueryDatastoreCompilationCache()
Accessor for the query datastore compilation cache.- Returns:
- Query datastore compilation cache
-
setConnectionUserName
public void setConnectionUserName(String userName)
Set the user name for the data store connection.- Specified by:
setConnectionUserNamein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
userName- the user name for the data store connection.
-
setConnectionPassword
public void setConnectionPassword(String password)
Set the password for the data store connection.- Specified by:
setConnectionPasswordin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
password- the password for the data store connection.
-
setConnectionURL
public void setConnectionURL(String url)
Set the URL for the data store connection.- Specified by:
setConnectionURLin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
url- the URL for the data store connection.
-
setConnectionDriverName
public void setConnectionDriverName(String driverName)
Set the driver name for the data store connection.- Specified by:
setConnectionDriverNamein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
driverName- the driver name for the data store connection.
-
setConnectionFactoryName
public void setConnectionFactoryName(String connectionFactoryName)
Set the name for the data store connection factory.- Specified by:
setConnectionFactoryNamein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
connectionFactoryName- name of the data store connection factory.
-
setConnectionFactory
public void setConnectionFactory(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:
setConnectionFactoryin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
connectionFactory- the data store connection factory.
-
setConnectionFactory2Name
public void setConnectionFactory2Name(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:
setConnectionFactory2Namein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
connectionFactoryName- name of the data store connection factory.
-
setConnectionFactory2
public void setConnectionFactory2(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:
setConnectionFactory2in interfacejavax.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:
setMultithreadedin interfacejavax.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:
setOptimisticin interfacejavax.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:
setRetainValuesin interfacejavax.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:
setRestoreValuesin interfacejavax.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:
setNontransactionalReadin interfacejavax.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:
setNontransactionalWritein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
flag- the default NontransactionalWrite setting.
-
setNontransactionalWriteAutoCommit
public void setNontransactionalWriteAutoCommit(boolean flag)
Set the default for whether to auto-commit non-tx writes for all PersistenceManager instances obtained from this factory.- Parameters:
flag- whether to auto-commit non-tx writes
-
setIgnoreCache
public void setIgnoreCache(boolean flag)
Set the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.- Specified by:
setIgnoreCachein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
flag- the default IgnoreCache setting.
-
setDetachAllOnCommit
public void setDetachAllOnCommit(boolean flag)
Mutator for the DetachAllOnCommit setting.- Specified by:
setDetachAllOnCommitin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
flag- the default DetachAllOnCommit setting.
-
setCopyOnAttach
public void setCopyOnAttach(boolean flag)
Mutator for the CopyOnAttach setting.- Specified by:
setCopyOnAttachin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
flag- the default CopyOnAttach setting.
-
setMapping
public void setMapping(String mapping)
Set the name for any mapping, used in searching for ORM/Query metadata files.- Specified by:
setMappingin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
mapping- the mapping name
-
setCatalog
public void setCatalog(String catalog)
Mutator for the catalog to use for this persistence factory.- Parameters:
catalog- Name of the catalog
-
setSchema
public void setSchema(String schema)
Mutator for the schema to use for this persistence factory.- Parameters:
schema- Name of the schema
-
setDatastoreReadTimeoutMillis
public void setDatastoreReadTimeoutMillis(Integer timeout)
Mutator for the timeout to use for datastore reads.- Specified by:
setDatastoreReadTimeoutMillisin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
timeout- Datastore read interval (millisecs)
-
setDatastoreWriteTimeoutMillis
public void setDatastoreWriteTimeoutMillis(Integer timeout)
Mutator for the timeout to use for datastore writes.- Specified by:
setDatastoreWriteTimeoutMillisin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
timeout- Datastore write interval (millisecs)
-
setTransactionType
public void setTransactionType(String type)
Mutator for the transaction type to use for this persistence factory.- Specified by:
setTransactionTypein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
type- Transaction type
-
setPersistenceUnitName
public void setPersistenceUnitName(String name)
Mutator for the name of the persistence unit.- Specified by:
setPersistenceUnitNamein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
name- Name of the persistence unit
-
setPersistenceXmlFilename
public void setPersistenceXmlFilename(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(String name)
Mutator for the name of the persistence factory.- Specified by:
setNamein interfacejavax.jdo.PersistenceManagerFactory- Parameters:
name- Name of the persistence factory (if any)
-
setServerTimeZoneID
public void setServerTimeZoneID(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:
setServerTimeZoneIDin interfacejavax.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:
setReadOnlyin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
flag- the default readOnly setting.
-
setTransactionIsolationLevel
public void setTransactionIsolationLevel(String level)
Set the default isolation level for transactions.- Specified by:
setTransactionIsolationLevelin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
level- Level
-
getConnectionUserName
public String getConnectionUserName()
Get the user name for the data store connection.- Specified by:
getConnectionUserNamein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the user name for the data store connection.
-
getConnectionPassword
public String getConnectionPassword()
Get the password for the data store connection.- Returns:
- the password for the data store connection.
-
getConnectionURL
public String getConnectionURL()
Get the URL for the data store connection.- Specified by:
getConnectionURLin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the URL for the data store connection.
-
getConnectionDriverName
public String getConnectionDriverName()
Get the driver name for the data store connection.- Specified by:
getConnectionDriverNamein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the driver name for the data store connection.
-
getConnectionFactoryName
public String getConnectionFactoryName()
Get the name for the data store connection factory.- Specified by:
getConnectionFactoryNamein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the name of the data store connection factory.
-
getConnectionFactory2Name
public 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:
getConnectionFactory2Namein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the name of the data store connection factory.
-
getConnectionFactory
public Object getConnectionFactory()
Get the data store connection factory.- Specified by:
getConnectionFactoryin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the data store connection factory.
-
getConnectionFactory2
public Object getConnectionFactory2()
Get the second data store connection factory. This is needed for managed environments to get nontransactional connections for optimistic transactions.- Specified by:
getConnectionFactory2in interfacejavax.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:
getMultithreadedin interfacejavax.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:
getOptimisticin interfacejavax.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:
getRetainValuesin interfacejavax.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:
getRestoreValuesin interfacejavax.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:
getNontransactionalReadin interfacejavax.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:
getNontransactionalWritein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the default NontransactionalWrite setting.
-
getNontransactionalWriteAutoCommit
public boolean getNontransactionalWriteAutoCommit()
Get the default auto-commit setting for non-tx writes for all PersistenceManager instances obtained from this factory.- Returns:
- the default auto-commit non-tx write setting.
-
getIgnoreCache
public boolean getIgnoreCache()
Get the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.- Specified by:
getIgnoreCachein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the IgnoreCache setting.
-
getDetachAllOnCommit
public boolean getDetachAllOnCommit()
Accessor for the DetachAllOnCommit setting.- Specified by:
getDetachAllOnCommitin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the DetachAllOnCommit setting.
-
getCopyOnAttach
public boolean getCopyOnAttach()
Accessor for the CopyOnAttach setting.- Specified by:
getCopyOnAttachin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the CopyOnAttach setting.
-
getMapping
public String getMapping()
Get the name for any mapping, used in retrieving metadata files for ORM/Query data.- Specified by:
getMappingin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the name for the mapping.
-
getCatalog
public String getCatalog()
Accessor for the catalog to use for this persistence factory.- Returns:
- the name of the catalog
-
getSchema
public String getSchema()
Accessor for the schema to use for this persistence factory.- Returns:
- the name of the schema
-
getName
public String getName()
Accessor for the name of the persistence factory (if any).- Specified by:
getNamein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the name of the persistence factory
-
getPersistenceUnitName
public String getPersistenceUnitName()
Accessor for the name of the persistence unit- Specified by:
getPersistenceUnitNamein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the name of the persistence unit
-
getPersistenceXmlFilename
public 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 Integer getDatastoreReadTimeoutMillis()
Accessor for the datastore read timeout interval.- Specified by:
getDatastoreReadTimeoutMillisin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- datastore read timeout
-
getDatastoreWriteTimeoutMillis
public Integer getDatastoreWriteTimeoutMillis()
Accessor for the datastore write timeout interval.- Specified by:
getDatastoreWriteTimeoutMillisin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- datastore write timeout
-
getServerTimeZoneID
public 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:
getServerTimeZoneIDin interfacejavax.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:
getReadOnlyin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- the default readOnly setting.
-
getTransactionType
public String getTransactionType()
Accessor for the transaction type to use with this persistence factory.- Specified by:
getTransactionTypein interfacejavax.jdo.PersistenceManagerFactory- Returns:
- transaction type
-
getTransactionIsolationLevel
public String getTransactionIsolationLevel()
Accessor for the transaction isolation level default.- Specified by:
getTransactionIsolationLevelin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- Transaction isolation level
-
setPrimaryClassLoader
public void setPrimaryClassLoader(ClassLoader loader)
Mutator to set the primary class loader. Setter provided since the input is an object and so cannot go through property input- Parameters:
loader- Loader
-
getPrimaryClassLoader
public ClassLoader getPrimaryClassLoader()
Accessor for the primary class loader- Returns:
- primary class loader
-
setPersistenceProperties
public void setPersistenceProperties(Map<String,Object> props)
Set the properties for this configuration. Note : this has this name so it has a getter/setter pair for use by things like Spring.- Parameters:
props- The persistence properties
-
getPersistenceProperties
public Map<String,Object> getPersistenceProperties()
Accessor for the persistence properties. Note : this has this name so it has a getter/setter pair for use by things like Spring.- Returns:
- The persistence properties
-
assertConfigurable
protected void assertConfigurable()
Asserts that a change to a configuration property is allowed.- Throws:
javax.jdo.JDOUserException- if not configurable
-
isConfigurable
protected boolean isConfigurable()
Accessor for whether this is still configurable (can set more properties etc).- Returns:
- Whether it is configurable
-
setIsNotConfigurable
protected void setIsNotConfigurable()
Method to set that this is no longer configurable. Can no longer become configurable.
-
addInstanceLifecycleListener
public void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener, Class[] classes)Method to add lifecycle listeners for particular classes. Adds the listener to all PMs already created.- Specified by:
addInstanceLifecycleListenerin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
listener- The listenerclasses- 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:
removeInstanceLifecycleListenerin interfacejavax.jdo.PersistenceManagerFactory- Parameters:
listener- The Listener
-
addSequenceForFactoryClass
public void addSequenceForFactoryClass(String factoryClassName, javax.jdo.datastore.Sequence sequence)
Method to register a sequence for a particular factory class.- Parameters:
factoryClassName- Name of the factory classsequence- The sequence
-
getSequenceForFactoryClass
public javax.jdo.datastore.Sequence getSequenceForFactoryClass(String factoryClassName)
Accessor for the sequence for a factory class.- Parameters:
factoryClassName- The name of the factory class- Returns:
- The sequence
-
getFetchGroups
public Set<javax.jdo.FetchGroup> getFetchGroups()
- Specified by:
getFetchGroupsin interfacejavax.jdo.PersistenceManagerFactory
-
getFetchGroup
public javax.jdo.FetchGroup getFetchGroup(Class cls, String name)
- Specified by:
getFetchGroupin interfacejavax.jdo.PersistenceManagerFactory
-
addFetchGroups
public void addFetchGroups(javax.jdo.FetchGroup... groups)
- Specified by:
addFetchGroupsin interfacejavax.jdo.PersistenceManagerFactory
-
removeFetchGroups
public void removeFetchGroups(javax.jdo.FetchGroup... groups)
- Specified by:
removeFetchGroupsin interfacejavax.jdo.PersistenceManagerFactory
-
removeAllFetchGroups
public void removeAllFetchGroups()
- Specified by:
removeAllFetchGroupsin interfacejavax.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 methodregisterMetadata(javax.jdo.metadata.JDOMetadata).- Specified by:
newMetadatain interfacejavax.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 thisPersistenceManagerFactory. Metadata can be created using the methodnewMetadata().- Specified by:
registerMetadatain interfacejavax.jdo.PersistenceManagerFactory- Parameters:
metadata- The Metadata to register.
-
getMetadata
public javax.jdo.metadata.TypeMetadata getMetadata(String className)
Method to return the (class) metadata object for the specified class, if there is metadata defined for that class.- Specified by:
getMetadatain interfacejavax.jdo.PersistenceManagerFactory- Parameters:
className- Name of the class that we want metadata for- Returns:
- The metadata
-
getManagedClasses
public Collection<Class> getManagedClasses()
Accessor for the classes that are managed (have metadata loaded).- Specified by:
getManagedClassesin interfacejavax.jdo.PersistenceManagerFactory- Returns:
- Collection of classes
-
unmanageClass
public void unmanageClass(String className)
Method to remove the specified class from the classes that are being managed. In practical terms this means remove all knowledge of the class from the metadata service, and also from the StoreManager service. It doesn't mean to remove the datastore representation (i.e table) of this class.- Parameters:
className- Name of the class
-
checkJDOPermission
public static void checkJDOPermission(javax.jdo.spi.JDOPermission jdoPermission)
-
-