Class JDOPersistenceManagerFactory
- All Implemented Interfaces:
Serializable
,AutoCloseable
,javax.jdo.PersistenceManagerFactory
,Referenceable
,ObjectFactory
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Flag for whether the first PM has been created, so is considered "active".private boolean
Whether the PersistenceManagerFactory is closedprivate boolean
Flag for whether this object is still configurable.private javax.jdo.datastore.DataStoreCache
Level 2 Cache.private Set
<JDOFetchGroup> JDO Fetch Groups.protected Map
<javax.jdo.listener.InstanceLifecycleListener, LifecycleListenerForClass> Lifecycle Listeners.protected org.datanucleus.PersistenceNucleusContext
The context that this factory uses.private static final String[]
The JDO optional features that DataNucleus supports.private Set
<JDOPersistenceManager> The cache of PM's in use.private static ConcurrentHashMap
<String, JDOPersistenceManagerFactory> Cache of PMF keyed by the name.private ThreadLocal
<javax.jdo.PersistenceManager> Thread-specific state information (instances ofinvalid reference
OperationInfo
private static final String
private static final String
private static final String
private static final String
private JDOQueryCache
Query Results Cache.Map of user-defined sequences keyed by the factory class name.private static final long
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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
Modifier and TypeMethodDescriptionvoid
addFetchGroups
(javax.jdo.FetchGroup... groups) void
addInstanceLifecycleListener
(javax.jdo.listener.InstanceLifecycleListener listener, Class[] classes) Method to add lifecycle listeners for particular classes.void
addSequenceForFactoryClass
(String factoryClassName, javax.jdo.datastore.Sequence sequence) Method to register a sequence for a particular factory class.protected void
Asserts that a change to a configuration property is allowed.protected void
Asserts that the PMF is open.static void
checkJDOPermission
(javax.jdo.spi.JDOPermission jdoPermission) (package private) void
Convenience method to clear the thread-local delegate PM that we refer to.void
close()
Close this PersistenceManagerFactory.protected static JDOPersistenceManagerFactory
Convenience method to create the PMF, check whether we should hand out a singleton, and if all ok then freeze it for use.boolean
Equality operator.protected void
finalize()
protected void
Freezes the current configuration.Accessor for the catalog to use for this persistence factory.protected org.datanucleus.Configuration
Get the driver name for the data store connection.Get the data store connection factory.Get the second data store connection factory.Get the name for the second data store connection factory.Get the name for the data store connection factory.Get the password for the data store connection.Get the URL for the data store connection.Get the user name for the data store connection.boolean
Accessor for the CopyOnAttach setting.javax.jdo.datastore.DataStoreCache
Accessor for the DataStore (level 2) CacheAccessor for the datastore read timeout interval.Accessor for the datastore write timeout interval.boolean
Accessor for the DetachAllOnCommit setting.javax.jdo.FetchGroup
getFetchGroup
(Class cls, String name) Set
<javax.jdo.FetchGroup> boolean
Get the default IgnoreCache setting for all PersistenceManager instances obtained from this factory.private Set
<JDOFetchGroup> getJDOFetchGroups
(boolean createIfNull) Accessor for the classes that are managed (have metadata loaded).Get the name for any mapping, used in retrieving metadata files for ORM/Query data.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.boolean
Get the default Multithreaded setting for all PersistenceManager instances obtained from this factory.getName()
Accessor for the name of the persistence factory (if any).boolean
Get the default NontransactionalRead setting for all PersistenceManager instances obtained from this factory.boolean
Get the default NontransactionalWrite setting for all PersistenceManager instances obtained from this factory.boolean
Get the default auto-commit setting for non-tx writes for all PersistenceManager instances obtained from this factory.org.datanucleus.PersistenceNucleusContext
getObjectInstance
(Object obj, Name name, Context ctx, Hashtable env) Create a PMF using the (JNDI) location or reference information specified.boolean
Get the default Optimistic setting for all PersistenceManager instances obtained from this factory.javax.jdo.PersistenceManager
Get an instance of PersistenceManager from this factory.javax.jdo.PersistenceManager
getPersistenceManager
(String userName, String password) Get an instance of PersistenceManager from this factory.static javax.jdo.PersistenceManagerFactory
getPersistenceManagerFactory
(Map overridingProps) Return a new PersistenceManagerFactory with options set according to the given Properties.static javax.jdo.PersistenceManagerFactory
getPersistenceManagerFactory
(Map overrides, Map props) Return a new PersistenceManagerFactory with options set according to the given properties and given overrides.static javax.jdo.PersistenceManagerFactory
getPersistenceManagerFactory
(Properties overridingProps) Return a new PersistenceManagerFactory with options set according to the given Properties.javax.jdo.PersistenceManager
Accessor for the PersistenceManager proxy objectAccessor for the persistence properties.Accessor for the name of the persistence unitAccessor for the filename of the persistence.xml file.(package private) javax.jdo.PersistenceManager
Convenience accessor for the thread-local delegate PM for this thread.Accessor for the primary class loaderReturn non-configurable properties of this PersistenceManagerFactory.Accessor for the query results cache.org.datanucleus.store.query.cache.QueryDatastoreCompilationCache
Accessor for the query datastore compilation cache.org.datanucleus.store.query.cache.QueryCompilationCache
Accessor for the query generic compilation cache.boolean
Get the default readOnly setting for all PersistenceManager instances obtained from this factory.Retrieves the (JNDI) reference of this PMF object.boolean
Get the default RestoreValues setting for all PersistenceManager instances obtained from this factory.boolean
Get the default RetainValues setting for all PersistenceManager instances obtained from this factory.Accessor for the schema to use for this persistence factory.javax.jdo.datastore.Sequence
getSequenceForFactoryClass
(String factoryClassName) Accessor for the sequence for a factory class.Accessor for the timezone "id" of the datastore server (if any).Accessor for the transaction isolation level default.Accessor for the transaction type to use with this persistence factory.int
hashCode()
protected void
initialiseMetaData
(org.datanucleus.metadata.PersistenceUnitMetaData pumd) boolean
isClosed()
Utility to return whether the factory is closed or not.protected boolean
Accessor for whether this is still configurable (can set more properties etc).javax.jdo.metadata.JDOMetadata
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 JDOPersistenceManager
newPM
(JDOPersistenceManagerFactory jdoPmf, String userName, String password) protected void
Convenience method to extract lifecycle listeners that are specified by way of persistence properties.private void
private Object
Control deserialisation of the PMF where we have a singleton (in pmfByName).void
registerMetadata
(javax.jdo.metadata.JDOMetadata metadata) Method to register the supplied metadata with the persistence process managed by thisPersistenceManagerFactory
.void
Remove a PersistenceManager from the cache.void
void
removeFetchGroups
(javax.jdo.FetchGroup... groups) void
removeInstanceLifecycleListener
(javax.jdo.listener.InstanceLifecycleListener listener) Method to remove a lifecycle listener.void
setCatalog
(String catalog) Mutator for the catalog to use for this persistence factory.void
setConnectionDriverName
(String driverName) Set the driver name for the data store connection.void
setConnectionFactory
(Object connectionFactory) Set the data store connection factory.void
setConnectionFactory2
(Object connectionFactory) Set the second data store connection factory.void
setConnectionFactory2Name
(String connectionFactoryName) Set the name for the second data store connection factory.void
setConnectionFactoryName
(String connectionFactoryName) Set the name for the data store connection factory.void
setConnectionPassword
(String password) Set the password for the data store connection.void
setConnectionURL
(String url) Set the URL for the data store connection.void
setConnectionUserName
(String userName) Set the user name for the data store connection.void
setCopyOnAttach
(boolean flag) Mutator for the CopyOnAttach setting.void
setDatastoreReadTimeoutMillis
(Integer timeout) Mutator for the timeout to use for datastore reads.void
setDatastoreWriteTimeoutMillis
(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.protected void
Method to set that this is no longer configurable.void
setMapping
(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
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
setNontransactionalWriteAutoCommit
(boolean flag) Set the default for whether to auto-commit non-tx writes 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
setPersistenceProperties
(Map<String, Object> props) Set the properties for this configuration.void
setPersistenceUnitName
(String name) Mutator for the name of the persistence unit.void
Mutator for the filename of the persistence.xml file.void
setPrimaryClassLoader
(ClassLoader loader) Mutator to set the primary class loader.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
Mutator for the schema to use for this persistence factory.void
Mutator for the timezone id of the datastore server.void
Set the default isolation level for transactions.void
setTransactionType
(String type) Mutator for the transaction type to use for this persistence factory.The application can determine from the results of this method which optional features, and which query languages are supported by the JDO implementation.void
unmanageClass
(String className) Method to remove the specified class from the classes that are being managed.private void
Check on serialisation of the PMF.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
PROPERTY_SINGLETON_PMF_BY_NAME
- See Also:
-
PROPERTY_JDO_PMF_FACTORY_CLASS
- See Also:
-
PROPERTY_JDO_TRANSACTION_TYPE
- See Also:
-
PROPERTY_JDO_TYPE_CONVERTER_PREFIX
- See Also:
-
pmfByName
Cache of PMF keyed by the name. Only used when having single-PMF property enabled. -
nucleusContext
protected transient org.datanucleus.PersistenceNucleusContext nucleusContextThe context that this factory uses. TODO Ought to be serializable, or able to recreate. -
pmCache
The cache of PM's in use. -
lifecycleListeners
protected transient Map<javax.jdo.listener.InstanceLifecycleListener,LifecycleListenerForClass> lifecycleListenersLifecycle Listeners. -
sequenceByFactoryClass
Map of user-defined sequences keyed by the factory class name. -
datastoreCache
private transient javax.jdo.datastore.DataStoreCache datastoreCacheLevel 2 Cache. -
queryCache
Query Results Cache. -
jdoFetchGroups
JDO Fetch Groups. -
closed
private boolean closedWhether the PersistenceManagerFactory is closed -
configurable
private boolean configurableFlag for whether this object is still configurable. -
active
private boolean activeFlag for whether the first PM has been created, so is considered "active". -
pmProxyThreadLocal
Thread-specific state information (instances ofinvalid reference
OperationInfo
-
OPTION_ARRAY
The JDO optional features that DataNucleus supports. See JDO spec section 11.6 for the full list of possibilities. -
deserialisationProps
-
-
Constructor Details
-
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
Constructs a new JDOPersistenceManagerFactory for the specified persistence properties.- Parameters:
props
- Persistence properties
-
-
Method Details
-
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:
-
getPersistenceManagerFactory
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:
-
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
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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacejavax.jdo.PersistenceManagerFactory
- See Also:
-
isClosed
public boolean isClosed()Utility to return whether the factory is closed or not.- Specified by:
isClosed
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- Whether it is closed.
-
processLifecycleListenersFromProperties
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:
getPersistenceManager
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- a PersistenceManager instance with default options.
-
getPersistenceManager
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:
getPersistenceManager
in 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
Equality operator. -
hashCode
public int hashCode() -
getObjectInstance
Create a PMF using the (JNDI) location or reference information specified.- Specified by:
getObjectInstance
in 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
Retrieves the (JNDI) reference of this PMF object.- Specified by:
getReference
in interfaceReferenceable
- Returns:
- The reference
-
getPersistenceManagerProxy
public javax.jdo.PersistenceManager getPersistenceManagerProxy()Accessor for the PersistenceManager proxy object- Specified by:
getPersistenceManagerProxy
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- The PMF proxy
-
getPMProxyDelegate
javax.jdo.PersistenceManager getPMProxyDelegate()Convenience accessor for the thread-local delegate PM for this thread. If no thread-local is set then creates a new PM.- Returns:
- The real PM to delegate to for this thread
-
clearPMProxyDelegate
void clearPMProxyDelegate()Convenience method to clear the thread-local delegate PM that we refer to. This is invoked when the proxy PM has close() invoked. -
getProperties
Return non-configurable properties of this PersistenceManagerFactory. Properties with keys VendorName and VersionNumber are required. Other keys are optional.- Specified by:
getProperties
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the non-configurable properties of this PersistenceManagerFactory.
-
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:
supportedOptions
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- A Collection of String representing the supported options.
-
releasePersistenceManager
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
-
getDataStoreCache
public javax.jdo.datastore.DataStoreCache getDataStoreCache()Accessor for the DataStore (level 2) Cache- Specified by:
getDataStoreCache
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- The datastore cache
-
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
Set the user name for the data store connection.- Specified by:
setConnectionUserName
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
userName
- the user name for the data store connection.
-
setConnectionPassword
Set the password for the data store connection.- Specified by:
setConnectionPassword
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
password
- the password for the data store connection.
-
setConnectionURL
Set the URL for the data store connection.- Specified by:
setConnectionURL
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
url
- the URL for the data store connection.
-
setConnectionDriverName
Set the driver name for the data store connection.- Specified by:
setConnectionDriverName
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
driverName
- the driver name for the data store connection.
-
setConnectionFactoryName
Set the name for the data store connection factory.- Specified by:
setConnectionFactoryName
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
connectionFactoryName
- name of the data store connection factory.
-
setConnectionFactory
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 interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
connectionFactory
- the data store connection factory.
-
setConnectionFactory2Name
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 interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
connectionFactoryName
- name of the data store connection factory.
-
setConnectionFactory2
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 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:
setMultithreaded
in 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:
setOptimistic
in 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:
setRetainValues
in 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:
setRestoreValues
in 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:
setNontransactionalRead
in 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:
setNontransactionalWrite
in 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:
setIgnoreCache
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
flag
- the default IgnoreCache setting.
-
setDetachAllOnCommit
public void setDetachAllOnCommit(boolean flag) Mutator for the DetachAllOnCommit setting.- Specified by:
setDetachAllOnCommit
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
flag
- the default DetachAllOnCommit setting.
-
setCopyOnAttach
public void setCopyOnAttach(boolean flag) Mutator for the CopyOnAttach setting.- Specified by:
setCopyOnAttach
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
flag
- the default CopyOnAttach setting.
-
setMapping
Set the name for any mapping, used in searching for ORM/Query metadata files.- Specified by:
setMapping
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
mapping
- the mapping name
-
setCatalog
Mutator for the catalog to use for this persistence factory.- Parameters:
catalog
- Name of the catalog
-
setSchema
Mutator for the schema to use for this persistence factory.- Parameters:
schema
- Name of the schema
-
setDatastoreReadTimeoutMillis
Mutator for the timeout to use for datastore reads.- Specified by:
setDatastoreReadTimeoutMillis
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
timeout
- Datastore read interval (millisecs)
-
setDatastoreWriteTimeoutMillis
Mutator for the timeout to use for datastore writes.- Specified by:
setDatastoreWriteTimeoutMillis
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
timeout
- Datastore write interval (millisecs)
-
setTransactionType
Mutator for the transaction type to use for this persistence factory.- Specified by:
setTransactionType
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
type
- Transaction type
-
setPersistenceUnitName
Mutator for the name of the persistence unit.- Specified by:
setPersistenceUnitName
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
name
- Name of the persistence unit
-
setPersistenceXmlFilename
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
Mutator for the name of the persistence factory.- Specified by:
setName
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
name
- Name of the persistence factory (if any)
-
setServerTimeZoneID
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 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:
setReadOnly
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
flag
- the default readOnly setting.
-
setTransactionIsolationLevel
Set the default isolation level for transactions.- Specified by:
setTransactionIsolationLevel
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
level
- Level
-
getConnectionUserName
Get the user name for the data store connection.- Specified by:
getConnectionUserName
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the user name for the data store connection.
-
getConnectionPassword
Get the password for the data store connection.- Returns:
- the password for the data store connection.
-
getConnectionURL
Get the URL for the data store connection.- Specified by:
getConnectionURL
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the URL for the data store connection.
-
getConnectionDriverName
Get the driver name for the data store connection.- Specified by:
getConnectionDriverName
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the driver name for the data store connection.
-
getConnectionFactoryName
Get the name for the data store connection factory.- Specified by:
getConnectionFactoryName
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the name of the data store connection factory.
-
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 interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the name of the data store connection factory.
-
getConnectionFactory
Get the data store connection factory.- Specified by:
getConnectionFactory
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the data store connection factory.
-
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 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:
getMultithreaded
in 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:
getOptimistic
in 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:
getRetainValues
in 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:
getRestoreValues
in 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:
getNontransactionalRead
in 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:
getNontransactionalWrite
in 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:
getIgnoreCache
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the IgnoreCache setting.
-
getDetachAllOnCommit
public boolean getDetachAllOnCommit()Accessor for the DetachAllOnCommit setting.- Specified by:
getDetachAllOnCommit
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the DetachAllOnCommit setting.
-
getCopyOnAttach
public boolean getCopyOnAttach()Accessor for the CopyOnAttach setting.- Specified by:
getCopyOnAttach
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the CopyOnAttach setting.
-
getMapping
Get the name for any mapping, used in retrieving metadata files for ORM/Query data.- Specified by:
getMapping
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the name for the mapping.
-
getCatalog
Accessor for the catalog to use for this persistence factory.- Returns:
- the name of the catalog
-
getSchema
Accessor for the schema to use for this persistence factory.- Returns:
- the name of the schema
-
getName
Accessor for the name of the persistence factory (if any).- Specified by:
getName
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the name of the persistence factory
-
getPersistenceUnitName
Accessor for the name of the persistence unit- Specified by:
getPersistenceUnitName
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the name of the persistence unit
-
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
Accessor for the datastore read timeout interval.- Specified by:
getDatastoreReadTimeoutMillis
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- datastore read timeout
-
getDatastoreWriteTimeoutMillis
Accessor for the datastore write timeout interval.- Specified by:
getDatastoreWriteTimeoutMillis
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- datastore write timeout
-
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 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:
getReadOnly
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- the default readOnly setting.
-
getTransactionType
Accessor for the transaction type to use with this persistence factory.- Specified by:
getTransactionType
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- transaction type
-
getTransactionIsolationLevel
Accessor for the transaction isolation level default.- Specified by:
getTransactionIsolationLevel
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- Transaction isolation level
-
setPrimaryClassLoader
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
Accessor for the primary class loader- Returns:
- primary class loader
-
setPersistenceProperties
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
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:
addInstanceLifecycleListener
in 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:
removeInstanceLifecycleListener
in 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
Accessor for the sequence for a factory class.- Parameters:
factoryClassName
- The name of the factory class- Returns:
- The sequence
-
getFetchGroups
- Specified by:
getFetchGroups
in interfacejavax.jdo.PersistenceManagerFactory
-
getFetchGroup
- Specified by:
getFetchGroup
in interfacejavax.jdo.PersistenceManagerFactory
-
addFetchGroups
public void addFetchGroups(javax.jdo.FetchGroup... groups) - Specified by:
addFetchGroups
in interfacejavax.jdo.PersistenceManagerFactory
-
removeFetchGroups
public void removeFetchGroups(javax.jdo.FetchGroup... groups) - Specified by:
removeFetchGroups
in interfacejavax.jdo.PersistenceManagerFactory
-
removeAllFetchGroups
public void removeAllFetchGroups()- Specified by:
removeAllFetchGroups
in interfacejavax.jdo.PersistenceManagerFactory
-
getJDOFetchGroups
-
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:
newMetadata
in 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:
registerMetadata
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
metadata
- The Metadata to register.
-
getMetadata
Method to return the (class) metadata object for the specified class, if there is metadata defined for that class.- Specified by:
getMetadata
in interfacejavax.jdo.PersistenceManagerFactory
- Parameters:
className
- Name of the class that we want metadata for- Returns:
- The metadata
-
getManagedClasses
Accessor for the classes that are managed (have metadata loaded).- Specified by:
getManagedClasses
in interfacejavax.jdo.PersistenceManagerFactory
- Returns:
- Collection of classes
-
unmanageClass
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) -
writeObject
Check on serialisation of the PMF.- Parameters:
oos
- The output stream to serialise to- Throws:
IOException
- Exception thrown if error
-
readObject
- Throws:
IOException
ClassNotFoundException
-
readResolve
Control deserialisation of the PMF where we have a singleton (in pmfByName).- Returns:
- The PMF
- Throws:
InvalidObjectException
- if an error occurs
-