|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PersistenceManagerFactory
The PersistenceManagerFactory
is the interface to use to obtain
PersistenceManager
instances.
All PersistenceManager
instances obtained from the same
PersistenceManagerFactory
will have the same default properties.
PersistenceManagerFactory
instances may be configured and
serialized for later use. They may be stored via JNDI and looked up
and used later. Any properties configured will be saved and restored.
Once the first PersistenceManager
is obtained from the
PersistenceManagerFactory
, the factory can no longer be
configured.
If the ConnectionFactory
property is set
(non-null
) then all other Connection properties including
ConnectionFactoryName
are ignored;
otherwise, if ConnectionFactoryName
is set
(non-null
) then all other Connection properties are ignored.
Similarly, if the ConnectionFactory2
property is set
(non-null
) then ConnectionFactory2Name
is ignored.
Operational state (PersistenceManager
pooling, connection
pooling, operational parameters) must not be serialized.
Method Summary | |
---|---|
void |
addFetchGroups(FetchGroup... groups)
Add the FetchGroup s to the set of active fetch groups. |
void |
addInstanceLifecycleListener(InstanceLifecycleListener listener,
java.lang.Class[] classes)
Add the parameter listener to the list of instance lifecycle event listeners set as the initial listeners for each PersistenceManager created by this PersistenceManagerFactory. |
void |
close()
Close this PersistenceManagerFactory. |
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 |
getConnectionURL()
Get the URL for the data store connection. |
java.lang.String |
getConnectionUserName()
Get the user name for the data store connection. |
boolean |
getCopyOnAttach()
Gets the default copyOnAttach setting for all PersistenceManager instances obtained from this
factory. |
DataStoreCache |
getDataStoreCache()
Return the DataStoreCache that this factory uses for
controlling a second-level cache. |
java.lang.Integer |
getDatastoreReadTimeoutMillis()
Get the default timeout setting for read operations. |
java.lang.Integer |
getDatastoreWriteTimeoutMillis()
Get the default timeout setting for write operations. |
boolean |
getDetachAllOnCommit()
Gets the detachAllOnCommit setting. |
FetchGroup |
getFetchGroup(java.lang.Class cls,
java.lang.String name)
Create an unscoped, modifiable FetchGroup for the Class and
name. |
java.util.Set |
getFetchGroups()
Get a modifiable Set containing a mutable copy of all currently active (in scope) fetch groups. |
boolean |
getIgnoreCache()
Get the default IgnoreCache setting for all PersistenceManager instances obtained from this factory. |
java.lang.String |
getMapping()
Get the Mapping setting for this factory. |
TypeMetadata |
getMetadata(java.lang.String className)
Method to return the metadata object for the specified class/interface, if there is metadata defined for that class/interface. |
boolean |
getMultithreaded()
Get the default Multithreaded setting for all PersistenceManager instances obtained from this factory. |
java.lang.String |
getName()
Gets the name of this PersistenceManagerFactory. |
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. |
boolean |
getOptimistic()
Get the default Optimistic setting for all PersistenceManager instances obtained from this factory. |
PersistenceManager |
getPersistenceManager()
Get an instance of PersistenceManager from this factory. |
PersistenceManager |
getPersistenceManager(java.lang.String userid,
java.lang.String password)
Get an instance of PersistenceManager from this factory. |
PersistenceManager |
getPersistenceManagerProxy()
Get a thread-safe instance of a proxy that dynamically binds on each method call to an instance of PersistenceManager . |
java.lang.String |
getPersistenceUnitName()
Gets the PersistenceUnitName for this PersistenceManagerFactory. |
java.util.Properties |
getProperties()
Return non-configurable properties of this PersistenceManagerFactory . |
boolean |
getReadOnly()
Gets the value for read-only for this PMF. |
boolean |
getRestoreValues()
Get the default value for the RestoreValues property. |
boolean |
getRetainValues()
Get the default RetainValues setting for all PersistenceManager instances obtained from this factory. |
java.lang.String |
getServerTimeZoneID()
Gets the TimeZone ID of the server associated with this PersistenceManagerFactory. |
java.lang.String |
getTransactionIsolationLevel()
Get the value for transaction isolation level for this PMF. |
java.lang.String |
getTransactionType()
Gets the TransactionType for this PersistenceManagerFactory. |
boolean |
isClosed()
A PersistenceManagerFactory instance can be used
until it is closed. |
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) . |
void |
registerMetadata(JDOMetadata metadata)
Method to register metadata with the persistence process managed by this PersistenceManagerFactory . |
void |
removeAllFetchGroups()
Remove all FetchGroup s from the set of active
FetchGroup s. |
void |
removeFetchGroups(FetchGroup... groups)
Remove the FetchGroup s from the set of active
FetchGroup s. |
void |
removeInstanceLifecycleListener(InstanceLifecycleListener listener)
Remove the parameter listener instance from the list of instance lifecycle event listeners set as the initial listeners for each PersistenceManager created by this PersistenceManagerFactory. |
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)
Sets the default copyOnAttach setting for all PersistenceManager instances obtained from this
factory. |
void |
setDatastoreReadTimeoutMillis(java.lang.Integer interval)
Specify a default timeout interval (milliseconds) for any read operations for persistence managers obtained from this persistence manager factory. |
void |
setDatastoreWriteTimeoutMillis(java.lang.Integer interval)
Specify a default timeout interval (milliseconds) for any write operations for persistence managers obtained from this persistence manager factory. |
void |
setDetachAllOnCommit(boolean flag)
Sets the default detachAllOnCommit setting for all PersistenceManager instances obtained from this
factory. |
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 Mapping setting for this factory. |
void |
setMultithreaded(boolean flag)
Set the default Multithreaded setting for all PersistenceManager instances obtained from this factory. |
void |
setName(java.lang.String name)
Sets the name of this PersistenceManagerFactory. |
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)
Sets the PersistenceUnitName for this PersistenceManagerFactory. |
void |
setReadOnly(boolean flag)
Sets the value for whether the datastore is to be considered read-only. |
void |
setRestoreValues(boolean restoreValues)
Set the default value for the RestoreValues property. |
void |
setRetainValues(boolean flag)
Set the default RetainValues setting for all PersistenceManager instances obtained from this factory. |
void |
setServerTimeZoneID(java.lang.String timezoneid)
Sets the TimeZone ID of the server associated with this PersistenceManagerFactory. |
void |
setTransactionIsolationLevel(java.lang.String level)
Set the value for transaction isolation level for this PMF. |
void |
setTransactionType(java.lang.String name)
Sets the TransactionType for this PersistenceManagerFactory. |
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. |
Method Detail |
---|
void close()
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.
boolean isClosed()
PersistenceManagerFactory
instance can be used
until it is closed.
true
if this PersistenceManagerFactory
has been closed.close()
PersistenceManager getPersistenceManager()
PersistenceManager
from this factory.
The instance has default values for options.
After the first use of getPersistenceManager
, no "set"
methods will succeed.
PersistenceManager
instance with default options.PersistenceManager getPersistenceManagerProxy()
PersistenceManager
.
When used with a PersistenceManagerFactory
that uses TransactionType JTA,
the proxy can be used in a server to dynamically bind to an instance
from this factory associated with the thread's current transaction.
In this case, the close method is ignored, as the
PersistenceManager
is automatically closed when the
transaction completes.
When used with a PersistenceManagerFactory
that uses TransactionType RESOURCE_LOCAL, the proxy uses an inheritable
ThreadLocal to bind to an instance of PersistenceManager
associated with the thread. In this case, the close method executed
on the proxy closes the PersistenceManager
and then
clears the ThreadLocal.
Use of this method does not affect the configurability of the
PersistenceManagerFactory
.
PersistenceManager
proxy.PersistenceManager getPersistenceManager(java.lang.String userid, java.lang.String password)
PersistenceManager
from this factory.
The instance has default values for options.
The parameters userid
and password
are used
when obtaining datastore connections from the connection pool.
After the first use of getPersistenceManager
, no "set"
methods will succeed.
userid
- the userid for the connectionpassword
- the password for the connection
PersistenceManager
instance with default options.void setConnectionUserName(java.lang.String userName)
userName
- the user name for the data store connection.java.lang.String getConnectionUserName()
void setConnectionPassword(java.lang.String password)
password
- the password for the data store connection.void setConnectionURL(java.lang.String url)
url
- the URL for the data store connection.java.lang.String getConnectionURL()
void setConnectionDriverName(java.lang.String driverName)
driverName
- the driver name for the data store connection.java.lang.String getConnectionDriverName()
void setConnectionFactoryName(java.lang.String connectionFactoryName)
connectionFactoryName
- the name of the data store connection
factory.java.lang.String getConnectionFactoryName()
void setConnectionFactory(java.lang.Object connectionFactory)
connectionFactory
- the data store connection factory.java.lang.Object getConnectionFactory()
void setConnectionFactory2Name(java.lang.String connectionFactoryName)
connectionFactoryName
- the name of the data store connection
factory.java.lang.String getConnectionFactory2Name()
void setConnectionFactory2(java.lang.Object connectionFactory)
connectionFactory
- the data store connection factory.java.lang.Object getConnectionFactory2()
void setMultithreaded(boolean flag)
PersistenceManager
instances obtained from this factory.
flag
- the default Multithreaded setting.boolean getMultithreaded()
PersistenceManager
instances obtained from this factory.
void setMapping(java.lang.String mapping)
mapping
- the Mapping setting.java.lang.String getMapping()
void setOptimistic(boolean flag)
PersistenceManager
instances obtained from this factory.
flag
- the default Optimistic setting.boolean getOptimistic()
PersistenceManager
instances obtained from this factory.
void setRetainValues(boolean flag)
PersistenceManager
instances obtained from this factory.
flag
- the default RetainValues setting.boolean getRetainValues()
PersistenceManager
instances obtained from this factory.
void setRestoreValues(boolean restoreValues)
true
, at rollback, fields of newly persistent instances
are restored to
their values as of the beginning of the transaction, and the instances
revert to transient. Additionally, fields of modified
instances of primitive types and immutable reference types
are restored to their values as of the beginning of the
transaction.
If false
, at rollback, the values of fields of
newly persistent instances are unchanged and the instances revert to
transient. Additionally, dirty instances transition to hollow.
If an implementation does not support this option, a
JDOUnsupportedOptionException
is thrown.
restoreValues
- the value of the restoreValues propertyboolean getRestoreValues()
void setNontransactionalRead(boolean flag)
PersistenceManager
instances obtained from this factory.
flag
- the default NontransactionalRead setting.boolean getNontransactionalRead()
PersistenceManager
instances obtained from this factory.
void setNontransactionalWrite(boolean flag)
PersistenceManager
instances obtained from this factory.
flag
- the default NontransactionalWrite setting.boolean getNontransactionalWrite()
PersistenceManager
instances obtained from this factory.
void setIgnoreCache(boolean flag)
PersistenceManager
instances obtained from this factory.
flag
- the default IgnoreCache setting.boolean getIgnoreCache()
PersistenceManager
instances obtained from this factory.
boolean getDetachAllOnCommit()
setDetachAllOnCommit(boolean)
void setDetachAllOnCommit(boolean flag)
PersistenceManager
instances obtained from this
factory.
flag
- the default DetachAllOnCommit settinggetDetachAllOnCommit()
boolean getCopyOnAttach()
PersistenceManager
instances obtained from this
factory.
setCopyOnAttach(boolean)
void setCopyOnAttach(boolean flag)
PersistenceManager
instances obtained from this
factory.
CopyOnAttach set to true
specifies that during
makePersistent, copies are made of detached parameter instances.
With this flag set to false
, detached parameter
instances are attached directly and change their state from
detached-clean to persistent-clean or from detached-dirty to
persistent-dirty.
getCopyOnAttach()
void setName(java.lang.String name)
name
- the name of this PMFjava.lang.String getName()
void setPersistenceUnitName(java.lang.String name)
name
- the PersistenceUnitNamegetPersistenceUnitName()
java.lang.String getPersistenceUnitName()
setPersistenceUnitName(String)
void setServerTimeZoneID(java.lang.String timezoneid)
timezoneid
- the TimeZone ID of the server
JDOUserException
- if the parameter does not match
an ID from TimeZone.getAvailableIDs()getServerTimeZoneID()
,
TimeZone.getTimeZone(String)
,
TimeZone.getAvailableIDs()
,
PersistenceManager.getServerDate()
java.lang.String getServerTimeZoneID()
setServerTimeZoneID(String)
void setTransactionType(java.lang.String name)
name
- the TransactionType
JDOUserException
- if the parameter is not a permitted valuegetTransactionType()
,
Constants.JTA
,
Constants.RESOURCE_LOCAL
java.lang.String getTransactionType()
setTransactionType(String)
boolean getReadOnly()
setReadOnly(boolean)
void setReadOnly(boolean flag)
ReadOnly set to false
specifies that no updates
can be performed to the datastore, and if updates are attempted
a JDOReadOnlyException is thrown.
getReadOnly()
java.lang.String getTransactionIsolationLevel()
setTransactionIsolationLevel(String)
void setTransactionIsolationLevel(java.lang.String level)
level
- the transaction isolation levelgetTransactionIsolationLevel()
,
Constants.TX_READ_UNCOMMITTED
,
Constants.TX_READ_COMMITTED
,
Constants.TX_REPEATABLE_READ
,
Constants.TX_SNAPSHOT
,
Constants.TX_SERIALIZABLE
void setDatastoreReadTimeoutMillis(java.lang.Integer interval)
interval
- the timeout interval (milliseconds)java.lang.Integer getDatastoreReadTimeoutMillis()
setDatastoreReadTimeoutMillis(Integer)
void setDatastoreWriteTimeoutMillis(java.lang.Integer interval)
interval
- the timeout interval (milliseconds)java.lang.Integer getDatastoreWriteTimeoutMillis()
setDatastoreWriteTimeoutMillis(Integer)
java.util.Properties getProperties()
PersistenceManagerFactory
.
Properties with keys VendorName
and
VersionNumber
are required. Other keys are optional.
PersistenceManagerFactory
.java.util.Collection<java.lang.String> supportedOptions()
Each supported JDO feature is represented by a
String
with one of the following values:
javax.jdo.option.TransientTransactional
javax.jdo.option.NontransactionalRead
javax.jdo.option.NontransactionalWrite
javax.jdo.option.RetainValues
javax.jdo.option.Optimistic
javax.jdo.option.ApplicationIdentity
javax.jdo.option.DatastoreIdentity
javax.jdo.option.NonDurableIdentity
javax.jdo.option.ArrayList
javax.jdo.option.HashMap
javax.jdo.option.Hashtable
javax.jdo.option.LinkedList
javax.jdo.option.TreeMap
javax.jdo.option.TreeSet
javax.jdo.option.Vector
javax.jdo.option.Map
javax.jdo.option.List
javax.jdo.option.Array
javax.jdo.option.NullCollection
javax.jdo.option.ChangeApplicationIdentity
javax.jdo.option.BinaryCompatibility
javax.jdo.option.GetDataStoreConnection
javax.jdo.option.UnconstrainedQueryVariables
javax.jdo.option.TransactionIsolationLevel.read-uncommitted
javax.jdo.option.TransactionIsolationLevel.read-committed
javax.jdo.option.TransactionIsolationLevel.repeatable-read
javax.jdo.option.TransactionIsolationLevel.snapshot
javax.jdo.option.TransactionIsolationLevel.serializable
javax.jdo.option.QueryCancel
javax.jdo.option.DatastoreTimeout
javax.jdo.query.SQL
javax.jdo.query.JDOQL
The standard JDO query language is represented by a
String
:
javax.jdo.query.JDOQL
Collection
of String
s representing
the supported options.DataStoreCache getDataStoreCache()
DataStoreCache
that this factory uses for
controlling a second-level cache. If this factory does not use
a second-level cache, the returned instance does nothing. This
method never returns null
.
void addInstanceLifecycleListener(InstanceLifecycleListener listener, java.lang.Class[] classes)
addInstanceLifecycleListener
and
removeInstanceLifecycleListener
methods are considered to be configuration methods and
can only be called when the PersistenceManagerFactory
is configurable (before the first time getPersistenceManager()
is called).
The classes
parameter identifies all
of the classes of interest. If the classes
parameter is specified as null
, events for all
persistent classes and interfaces will be sent to the listener.
The listener will be called for each event for which it
implements the corresponding InstanceLifecycleListener
interface.
listener
- the lifecycle listenerclasses
- the classes of interest to the listenervoid removeInstanceLifecycleListener(InstanceLifecycleListener listener)
addInstanceLifecycleListener
and
removeInstanceLifecycleListener
methods are considered to be configuration methods and
can only be called when the PersistenceManagerFactory
is configurable (before the first time getPersistenceManager()
is called).
listener
- the listener instance to be removedvoid addFetchGroups(FetchGroup... groups)
FetchGroup
s to the set of active fetch groups.
FetchGroup
s are made unmodifiable before being added.
FetchGroup
s that match existing FetchGroup
s
replace the corresponding FetchGroup
s.
The replaced FetchGroup
s become unscoped.
Match is based on identical class and equal name.
The methods addFetchGroups(javax.jdo.FetchGroup...)
, removeFetchGroups(javax.jdo.FetchGroup...)
,
getFetchGroups()
, and removeAllFetchGroups()
are internally serialized.
groups
- an array of FetchGroups
java.lang.SecurityException
- if the caller is not authorized for
JDOPermission
("manageMetadata")void removeFetchGroups(FetchGroup... groups)
FetchGroup
s from the set of active
FetchGroup
s. Existing FetchGroup
s that match
parameter FetchGroup
s are removed. Parameter
FetchGroup
s that do not match any existing
FetchGroup
are ignored.
Removed FetchGroup
s become unscoped.
Match is based on identical class and equal name.
The methods addFetchGroups(javax.jdo.FetchGroup...)
, removeFetchGroups(javax.jdo.FetchGroup...)
,
getFetchGroups()
, and removeAllFetchGroups()
are internally serialized.
groups
- an array of FetchGroups
java.lang.SecurityException
- if the caller is not authorized for
JDOPermission
("manageMetadata")void removeAllFetchGroups()
FetchGroup
s from the set of active
FetchGroup
s.
All removed FetchGroup
s become unscoped.
The methods addFetchGroups(javax.jdo.FetchGroup...)
, removeFetchGroups(javax.jdo.FetchGroup...)
,
getFetchGroups()
, and removeAllFetchGroups()
are internally serialized.
java.lang.SecurityException
- if the caller is not authorized for
JDOPermission
("manageMetadata")FetchGroup getFetchGroup(java.lang.Class cls, java.lang.String name)
FetchGroup
for the Class and
name. If a corresponding FetchGroup
already exists in
PersistenceManagerFactory
scope, copy its definition
to a new FetchGroup
.
If the FetchGroup
does not already exist, create it
with no members. The FetchGroup
does not become
in scope until it is added to the current set via
addFetchGroups(javax.jdo.FetchGroup...)
.
cls
- the class or interface for the FetchGroupname
- the name of the fetch group
JDOUserException
- if the class is not a persistence-capable
class or interfacejava.util.Set getFetchGroups()
addFetchGroups(javax.jdo.FetchGroup...)
, removeFetchGroups(javax.jdo.FetchGroup...)
,
getFetchGroups()
, and removeAllFetchGroups()
are internally serialized.
java.lang.SecurityException
- if the caller is not authorized for
JDOPermission
("getMetadata")void registerMetadata(JDOMetadata metadata)
PersistenceManagerFactory
.
Metadata can be created using the method newMetadata()
.
If there is already metadata registered for a class contained in this metadata
object then a JDOUserException will be thrown.
metadata
- The Metadata to register.JDOMetadata newMetadata()
registerMetadata(javax.jdo.metadata.JDOMetadata)
.
TypeMetadata getMetadata(java.lang.String className)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |