|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.pm.PersistenceManagerImpl
This is the StoreManager independent implemetation of the org.apache.jdo.pm.PersistenceManagerInternal interface. Delegates most of the method execution to the corresponding instance of the CacheManagerImpl.
Field Summary | |
protected static org.apache.jdo.util.I18NHelper |
msg
I18N message handler |
Constructor Summary | |
PersistenceManagerImpl(PersistenceManagerFactoryInternal pmf,
java.lang.String username,
java.lang.String password)
Constructs new instance of PersistenceManagerImpl for this PersistenceManagerFactoryInternal and particular combination of username and password. |
Method Summary | |
void |
addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener,
java.lang.Class[] classes)
Adds the listener instance to the list of lifecycle event listeners. |
protected void |
afterCompletion(int status)
Called by Transaction commit() or rollback() cleans up transactional cache |
void |
assertIsOpen()
assert this PM instance is open |
void |
assertReadAllowed()
Assert the NontransactionalRead flag is true or a transaction is active. |
java.lang.Object |
attachCopy(java.lang.Object pc,
boolean makeTransactional)
Import the specified object into the PersistenceManager . |
java.util.Collection |
attachCopyAll(java.util.Collection pcs,
boolean makeTransactional)
Import the specified objects into the PersistenceManager . |
java.lang.Object[] |
attachCopyAll(java.lang.Object[] pcs,
boolean makeTransactional)
Import the specified objects into the PersistenceManager . |
void |
checkConsistency()
Validates the PersistenceManager cache with the
datastore. |
void |
close()
Close this persistence manager |
javax.jdo.Transaction |
currentTransaction()
Returns transaction associated with this persistence manager |
void |
deletePersistent(java.lang.Object pc)
Delete the persistent instance from the data store. |
void |
deletePersistentAll(java.util.Collection pcs)
Delete a Collection of instances from the data store. |
void |
deletePersistentAll(java.lang.Object[] pcs)
Delete an array of instances from the data store. |
void |
deregister(java.lang.Object oid)
Removes the object from the cache. |
protected void |
deregisterJTA()
Disassociate this PersistenceManager with the current JTA transaction. |
void |
deregisterTransient(StateManagerInternal sm)
Removes transient object from the transient cache. |
java.lang.Object |
detachCopy(java.lang.Object pc)
Detach the specified object from the PersistenceManager . |
java.util.Collection |
detachCopyAll(java.util.Collection pcs)
Detach the specified objects from the PersistenceManager . |
java.lang.Object[] |
detachCopyAll(java.lang.Object[] pcs)
Detach the specified objects from the PersistenceManager . |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
void |
evict(java.lang.Object pc)
Mark an instance as no longer needed in the cache. |
void |
evictAll()
Mark all persistent-nontransactional instances as no longer needed in the cache. |
void |
evictAll(java.util.Collection pcs)
Mark a Collection of instances as no longer needed in the cache. |
void |
evictAll(java.lang.Object[] pcs)
Mark an array of instances as no longer needed in the cache. |
StateManagerInternal |
findStateManager(javax.jdo.spi.PersistenceCapable pc)
A helper method to find the StateManager associated with this PC instance |
void |
flush()
Flushes all dirty, new, and deleted instances to the data store. |
protected void |
flushInstances()
Called by Transaction commit() Loops through transactional cache and calls PersistentStore.updatePersistent() on each instance |
protected void |
forceClose()
Close this persistence manager even if there are open wrappers or an uncomplete transaction. |
java.lang.ClassLoader |
getContextClassLoaderPrivileged()
Calls getContextClassLoader for the current Thread in a doPrivileged block. |
javax.jdo.PersistenceManager |
getCurrentWrapper()
Returns current wrapper |
javax.jdo.datastore.JDOConnection |
getDataStoreConnection()
If this method is called while a datastore transaction is active, the object returned will be enlisted in the current transaction. |
javax.jdo.Extent |
getExtent(java.lang.Class persistenceCapableClass)
Equivalent to getExtent (persistenceCapableClass,
true) . |
javax.jdo.Extent |
getExtent(java.lang.Class persistenceCapableClass,
boolean subclasses)
The PersistenceManager may manage a collection of instances in the data store based on the class of the instances. |
javax.jdo.FetchPlan |
getFetchPlan()
Returns the FetchPlan used by this
PersistenceManager . |
boolean |
getIgnoreCache()
Get the value of the ignoreCache flag. |
java.util.Collection |
getInsertedInstances()
Returns a Collection of instances that has been made persistent or become persistent through persistence-by-reachability algorithm in this transaction. |
java.lang.Object |
getInternalObjectId(java.lang.Object pc)
Gets the internal object id for this instance. |
boolean |
getMultithreaded()
Get the current Multithreaded flag for this PersistenceManager. |
java.lang.Object |
getObjectById(java.lang.Class cls,
java.lang.Object key)
Looks up the instance of the given type with the given key. |
java.lang.Object |
getObjectById(java.lang.Object oid)
Looks up the instance corresponding to the specified oid. |
java.lang.Object |
getObjectById(java.lang.Object oid,
boolean validate)
This method locates a persistent instance in the cache of instances managed by this PersistenceManager. |
java.lang.Object |
getObjectId(java.lang.Object pc)
The ObjectId returned by this method represents the JDO identity of the instance. |
java.lang.Class |
getObjectIdClass(java.lang.Class cls)
Return the Class that implements the JDO Identity for the specified PersistenceCapable Class. |
java.util.Collection |
getObjectsById(java.util.Collection oids)
Return the objects with the given oids. |
java.util.Collection |
getObjectsById(java.util.Collection oids,
boolean validate)
Return the objects with the given oids. |
java.lang.Object[] |
getObjectsById(java.lang.Object[] oids)
Return the objects with the given oids. |
java.lang.Object[] |
getObjectsById(java.lang.Object[] oids,
boolean validate)
Return the objects with the given oids. |
javax.jdo.PersistenceManagerFactory |
getPersistenceManagerFactory()
This method returns the PersistenceManagerFactory used to create this PersistenceManager. |
java.util.Properties |
getProperties()
The JDO vendor might store certain non-operational properties and make those properties available to applications (for troubleshooting). |
javax.jdo.datastore.Sequence |
getSequence(java.lang.String name)
Returns the sequence identified by name . |
StateManagerInternal |
getStateManager(java.lang.Object oid,
java.lang.Class pcClass)
Provides a StateManagerInternal for the given Object Id. |
StoreManager |
getStoreManager()
Provides a StoreManager that is ready to accept operations on it. |
java.lang.Object |
getTransactionalObjectId(java.lang.Object pc)
|
java.lang.Object |
getUserObject()
The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance. |
java.lang.Object |
getUserObject(java.lang.Object key)
Get the value for the specified key from the map of user objects. |
int |
hashCode()
Returns a hash code value for this PersistenceManager. |
void |
hereIsStateManager(StateManagerInternal sm,
javax.jdo.spi.PersistenceCapable pc)
A helper method called from the StateManager inside getPersistenceManager() to identify StateManager associated with this PC instance |
boolean |
insideCommit()
Returns true if the call initiated as a result of the commit process, versus flush for query in a datastore transaction. |
boolean |
isClosed()
Return whether this PersistenceManager is closed. |
boolean |
isSupportedSCOType(java.lang.Class type)
Called by StateManager to verify field type. |
java.lang.Class |
loadClass(java.lang.String name,
java.lang.ClassLoader given)
Provides a Class of the given name. |
java.lang.Class |
loadPCClassForObjectIdClass(java.lang.Class objectIdClass)
Provides the Class object of the persistence-capable class that defines the specified class as its ObjectId class. |
void |
makeNontransactional(java.lang.Object pc)
Make an instance non-transactional after commit. |
void |
makeNontransactionalAll(java.util.Collection pcs)
Make a Collection of instances non-transactional after commit. |
void |
makeNontransactionalAll(java.lang.Object[] pcs)
Make an array of instances non-transactional after commit. |
void |
makePersistent(java.lang.Object pc)
Make the transient instance persistent in this PersistenceManager. |
void |
makePersistentAll(java.util.Collection pcs)
Make an collection of instances persistent. |
void |
makePersistentAll(java.lang.Object[] pcs)
Make an array of instances persistent. |
void |
makeTransactional(java.lang.Object pc)
Make an instance subject to transactional boundaries. |
void |
makeTransactionalAll(java.util.Collection pcs)
Make a Collection of instances subject to transactional boundaries. |
void |
makeTransactionalAll(java.lang.Object[] pcs)
Make an array of instances subject to transactional boundaries. |
void |
makeTransient(java.lang.Object pc)
Make an instance transient, removing it from management by this PersistenceManager. |
void |
makeTransientAll(java.util.Collection pcs)
Make a Collection of instances transient, removing them from management by this PersistenceManager. |
void |
makeTransientAll(java.lang.Object[] pcs)
Make an array of instances transient, removing them from management by this PersistenceManager. |
void |
markAsFlushed(StateManagerInternal sm)
Called by StateManagerInternal#markAsFlushed() to adjust transactional cache(s) if necessary after successful flush to the data store. |
java.util.Collection |
newCollectionInstanceInternal(java.lang.Class type,
java.lang.Class elementType,
boolean allowNulls,
java.lang.Integer initialSize,
java.lang.Float loadFactor,
java.util.Collection initialContents,
java.util.Comparator comparator)
Called by internally by the runtime to create a new tracked instance. |
java.lang.Object |
newInstance(java.lang.Class pcClass)
Creates an instance of a persistence-capable interface or abstract class. |
java.util.Map |
newMapInstanceInternal(java.lang.Class type,
java.lang.Class keyType,
java.lang.Class valueType,
boolean allowNulls,
java.lang.Integer initialSize,
java.lang.Float loadFactor,
java.util.Map initialContents,
java.util.Comparator comparator)
Called by internally by the runtime to create a new tracked instance. |
abstract javax.jdo.Query |
newNamedQuery(java.lang.Class cls,
java.lang.String queryName)
Create a new Query with the given candidate class
from a named query. |
java.lang.Object |
newObjectIdInstance(java.lang.Class pcClass,
java.lang.Object key)
This method returns an object id instance corresponding to the pcClass and key arguments. |
abstract javax.jdo.Query |
newQuery()
Create a new Query with no elements. |
abstract javax.jdo.Query |
newQuery(java.lang.Class cls)
Create a new Query specifying the Class of the results. |
abstract javax.jdo.Query |
newQuery(java.lang.Class cls,
java.util.Collection cln)
Create a new Query with the Class of the results and candidate Collection. |
abstract javax.jdo.Query |
newQuery(java.lang.Class cls,
java.util.Collection cln,
java.lang.String filter)
Create a new Query with the Class of the results, candidate Collection, and Filter. |
abstract javax.jdo.Query |
newQuery(java.lang.Class cls,
java.lang.String filter)
Create a new Query with the Class of the results and Filter. |
abstract javax.jdo.Query |
newQuery(javax.jdo.Extent cln)
Create a new Query with the candidate Extent; the class is taken from the Extent. |
abstract javax.jdo.Query |
newQuery(javax.jdo.Extent cln,
java.lang.String filter)
Create a new Query with the candidate Extent and Filter. |
abstract javax.jdo.Query |
newQuery(java.lang.Object compiled)
Create a new Query using elements from another Query. |
abstract javax.jdo.Query |
newQuery(java.lang.String query)
Create a Construct a new query instance using the specified String as the single-string representation of the query. |
abstract javax.jdo.Query |
newQuery(java.lang.String language,
java.lang.Object query)
Create a new Query using the specified language. |
java.lang.Object |
newSCOInstanceInternal(java.lang.Class type)
Called by internally by the runtime to create a new tracked instance. |
protected void |
notifyOptimistic(boolean optimistic)
For Transaction to notify PersistenceManager that optimistic flag is changed |
protected void |
notifyStatusChange(boolean isActive)
For Transaction to notify PersistenceManager that status is changed |
protected void |
popCurrentWrapper(PersistenceManagerWrapper prev)
Replace current wrapper with the previous |
protected void |
pushCurrentWrapper(PersistenceManagerWrapper pmw)
Remember the current wrapper |
java.lang.Object |
putUserObject(java.lang.Object key,
java.lang.Object val)
Put the specified key-value pair into the map of user objects. |
void |
refresh(java.lang.Object pc)
Refresh the state of the instance from the data store. |
void |
refreshAll()
Refresh the state of all applicable instances from the data store. |
void |
refreshAll(java.util.Collection pcs)
Refresh the state of a Collection of instances from the data store. |
void |
refreshAll(javax.jdo.JDOException jdoe)
Refreshes all instances in the exception that failed verification. |
void |
refreshAll(java.lang.Object[] pcs)
Refresh the state of an array of instances from the data store. |
void |
register(StateManagerInternal sm,
java.lang.Object oid,
boolean transactional,
boolean throwDuplicateException)
Adds persistent object to the cache. |
void |
registerTransient(StateManagerInternal sm)
Adds transient object to the transient cache. |
void |
removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
Removes the listener instance from the list of lifecycle event listeners. |
java.lang.Object |
removeUserObject(java.lang.Object key)
Remove the specified key and its value from the map of user objects. |
void |
replaceObjectId(java.lang.Object oldId,
java.lang.Object newId)
Replaces the objectId key value in the cache. |
void |
retrieve(java.lang.Object pc)
Retrieve field values of an instance from the store. |
void |
retrieveAll(java.util.Collection pcs)
Retrieve field values of instances from the store. |
void |
retrieveAll(java.util.Collection pcs,
boolean DFGOnly)
Retrieve field values of instances from the store. |
void |
retrieveAll(java.lang.Object[] pcs)
Retrieve field values of instances from the store. |
void |
retrieveAll(java.lang.Object[] pcs,
boolean DFGOnly)
Retrieve field values of instances from the store. |
void |
setIgnoreCache(boolean flag)
|
protected void |
setJTATransaction(java.lang.Object t)
with the current thread in the managed environment |
void |
setMultithreaded(boolean flag)
Set the Multithreaded flag for this PersistenceManager. |
void |
setStoreManager(StoreManager storeManager)
Sets a StoreManager that is ready to accept operations on it such as insert, etc. |
void |
setUserObject(java.lang.Object o)
The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance. |
protected boolean |
verify(java.lang.String username,
java.lang.String password)
Verify that cached instance of a PersistenceManager was initialy requested with the same values for username and password |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final org.apache.jdo.util.I18NHelper msg
Constructor Detail |
public PersistenceManagerImpl(PersistenceManagerFactoryInternal pmf, java.lang.String username, java.lang.String password)
pmf
- calling PersistenceManagerFactory as PersistenceManagerFactoryInternalusername
- user name used for accessing Connector or null if none
is provided.password
- user password used for accessing Connector or null if
none is provided.Method Detail |
public void setIgnoreCache(boolean flag)
setIgnoreCache
in interface javax.jdo.PersistenceManager
flag
- the ignoreCache valuePersistenceManager.setIgnoreCache(boolean flag)
public boolean getIgnoreCache()
getIgnoreCache
in interface javax.jdo.PersistenceManager
PersistenceManager.getIgnoreCache()
public void setMultithreaded(boolean flag)
setMultithreaded
in interface javax.jdo.PersistenceManager
flag
- the Multithreaded setting.public boolean getMultithreaded()
getMultithreaded
in interface javax.jdo.PersistenceManager
setMultithreaded(boolean)
public boolean isClosed()
isClosed
in interface javax.jdo.PersistenceManager
PersistenceManager.isClosed()
public void close()
close
in interface javax.jdo.PersistenceManager
PersistenceManager.close()
public javax.jdo.Transaction currentTransaction()
currentTransaction
in interface javax.jdo.PersistenceManager
public java.lang.Object getObjectById(java.lang.Object oid, boolean validate)
If the validate flag is true: This method verifies that there is an instance in the data store with the same oid, constructs an instance, and returns it. If there is no transaction active, then a hollow instance or persistent non-transactional instance is returned. If there is a transaction active, then a persistent clean instance is returned.
If the validate flag is false: If there is not already an instance in the cache with the same oid, then an instance is constructed and returned. If the instance does not exist in the data store, then this method will not fail. However, a request to access fields of the instance will throw an exception.
getObjectById
in interface javax.jdo.PersistenceManager
oid
- an ObjectIdvalidate
- if the existence of the instance is to be validated
public java.lang.Object getObjectById(java.lang.Class cls, java.lang.Object key)
getObjectById
in interface javax.jdo.PersistenceManager
cls
- The type of object to loadkey
- either the string representation of the object id, or
an object representation of a single field identity key
public java.lang.Object getObjectById(java.lang.Object oid)
getObjectById(oid, true);
- Specified by:
getObjectById
in interface javax.jdo.PersistenceManager
- Parameters:
oid
- The object id of the object to load
- Returns:
- the corresponding persistent instance
- Since:
- 2.0
public java.lang.Object getObjectId(java.lang.Object pc)
getObjectId
in interface javax.jdo.PersistenceManager
pc
- the PersistenceCapable instance
public java.lang.Class loadClass(java.lang.String name, java.lang.ClassLoader given) throws java.lang.ClassNotFoundException
PersistenceManagerInternal
If after the above has been tried on all the ClassLoaders, an appropriate Class has not been found, throws JDOUserException.
loadClass
in interface PersistenceManagerInternal
name
- Fully qualified name of the Class to load.given
- ClassLoader which is the first to be tried
in loading the named Class.
java.lang.ClassNotFoundException
- - if an appropriate Class can not
be loaded.PersistenceManagerInternal.loadClass(java.lang.String, java.lang.ClassLoader)
public java.lang.Class loadPCClassForObjectIdClass(java.lang.Class objectIdClass) throws java.lang.ClassNotFoundException
PersistenceManagerInternal
PersistenceManagerInternal.loadClass(java.lang.String, java.lang.ClassLoader)
:
loadPCClassForObjectIdClass
in interface PersistenceManagerInternal
java.lang.ClassNotFoundException
PersistenceManagerInternal.loadPCClassForObjectIdClass(java.lang.Class)
public java.lang.Object getInternalObjectId(java.lang.Object pc)
getInternalObjectId
in interface PersistenceManagerInternal
pc
-
public java.lang.Object getTransactionalObjectId(java.lang.Object pc)
getTransactionalObjectId
in interface javax.jdo.PersistenceManager
PersistenceManager.getTransactionalObjectId(java.lang.Object)
public java.lang.Object newObjectIdInstance(java.lang.Class pcClass, java.lang.Object key)
newObjectIdInstance
in interface javax.jdo.PersistenceManager
pcClass
- the Class
of the persistence-capable instancekey
- the value of the key field for single-field identity.
public java.util.Collection getObjectsById(java.util.Collection oids, boolean validate)
getObjectsById
in interface javax.jdo.PersistenceManager
oids
- the oids of the objects to returnvalidate
- if true, the existance of the objects in
the datastore will be validated.
getObjectById(Object,boolean)
public java.util.Collection getObjectsById(java.util.Collection oids)
getObjectsById(Collection, boolean)
with the validate flag true.
getObjectsById
in interface javax.jdo.PersistenceManager
oids
- the oids of the objects to return
getObjectsById(Collection,boolean)
public java.lang.Object[] getObjectsById(java.lang.Object[] oids, boolean validate)
getObjectsById
in interface javax.jdo.PersistenceManager
oids
- the oids of the objects to returnvalidate
- if true, the existance of the objects in
the datastore will be validated.
getObjectById(Object,boolean)
public java.lang.Object[] getObjectsById(java.lang.Object[] oids)
getObjectsById(Object[],boolean)
with the validate flag true.
getObjectsById
in interface javax.jdo.PersistenceManager
oids
- the oids of the objects to return
getObjectsById(Object[],boolean)
public java.lang.Class getObjectIdClass(java.lang.Class cls)
In order for the application to construct an instance of the ObjectId class it needs to know the class being used by the JDO implementation.
getObjectIdClass
in interface javax.jdo.PersistenceManager
cls
- the PersistenceCapable Class
getObjectById(java.lang.Object, boolean)
public abstract javax.jdo.Query newQuery()
newQuery
in interface javax.jdo.PersistenceManager
public abstract javax.jdo.Query newQuery(java.lang.Object compiled)
newQuery
in interface javax.jdo.PersistenceManager
compiled
- another Query from the same JDO implementation
public abstract javax.jdo.Query newQuery(java.lang.String query)
newQuery
in interface javax.jdo.PersistenceManager
query
- the single-string query
Query
public abstract javax.jdo.Query newQuery(java.lang.String language, java.lang.Object query)
newQuery
in interface javax.jdo.PersistenceManager
language
- the language of the query parameterquery
- the query, which is of a form determined by the language
public abstract javax.jdo.Query newQuery(java.lang.Class cls)
newQuery
in interface javax.jdo.PersistenceManager
cls
- the Class of the results
public abstract javax.jdo.Query newQuery(javax.jdo.Extent cln)
newQuery
in interface javax.jdo.PersistenceManager
cln
- the Extent of candidate instances
public abstract javax.jdo.Query newQuery(java.lang.Class cls, java.util.Collection cln)
newQuery
in interface javax.jdo.PersistenceManager
cls
- the Class of resultscln
- the Collection of candidate instances
public abstract javax.jdo.Query newQuery(java.lang.Class cls, java.lang.String filter)
newQuery
in interface javax.jdo.PersistenceManager
cls
- the Class of resultsfilter
- the Filter for candidate instances
public abstract javax.jdo.Query newQuery(java.lang.Class cls, java.util.Collection cln, java.lang.String filter)
newQuery
in interface javax.jdo.PersistenceManager
cls
- the Class of resultscln
- the Collection of candidate instancesfilter
- the Filter for candidate instances
public abstract javax.jdo.Query newQuery(javax.jdo.Extent cln, java.lang.String filter)
newQuery
in interface javax.jdo.PersistenceManager
cln
- the Extent of candidate instancesfilter
- the Filter for candidate instances
public abstract javax.jdo.Query newNamedQuery(java.lang.Class cls, java.lang.String queryName)
Query
with the given candidate class
from a named query. The query name given must be the name of a
query defined in metadata.
newNamedQuery
in interface javax.jdo.PersistenceManager
cls
- the Class
of candidate instancesqueryName
- the name of the query to look up in metadata
Query
public javax.jdo.Extent getExtent(java.lang.Class persistenceCapableClass, boolean subclasses)
getExtent
in interface javax.jdo.PersistenceManager
persistenceCapableClass
- Class of instancessubclasses
- whether to include instances of subclasses
StoreManager.getExtent(java.lang.Class, boolean, org.apache.jdo.pm.PersistenceManagerInternal)
,
Query
public javax.jdo.Extent getExtent(java.lang.Class persistenceCapableClass)
getExtent (persistenceCapableClass,
true)
.
getExtent
in interface javax.jdo.PersistenceManager
getExtent(Class,boolean)
public void makePersistent(java.lang.Object pc)
makePersistent
in interface javax.jdo.PersistenceManager
pc
- a transient instance of a Class that implements
PersistenceCapablepublic void makePersistentAll(java.lang.Object[] pcs)
makePersistentAll
in interface javax.jdo.PersistenceManager
pcs
- an array of transient instancesmakePersistent(Object pc)
public void makePersistentAll(java.util.Collection pcs)
makePersistentAll
in interface javax.jdo.PersistenceManager
pcs
- an collection of transient instancesmakePersistent(Object pc)
public void deletePersistent(java.lang.Object pc)
deletePersistent
in interface javax.jdo.PersistenceManager
pc
- a persistent instancepublic void deletePersistentAll(java.lang.Object[] pcs)
deletePersistentAll
in interface javax.jdo.PersistenceManager
pcs
- a Collection of persistent instancesdeletePersistent(Object pc)
public void deletePersistentAll(java.util.Collection pcs)
deletePersistentAll
in interface javax.jdo.PersistenceManager
pcs
- a Collection of persistent instancesdeletePersistent(Object pc)
public void makeTransient(java.lang.Object pc)
The instance loses its JDO identity and it is no longer associated with any PersistenceManager. The state of fields is preserved unchanged.
makeTransient
in interface javax.jdo.PersistenceManager
pc
- the instance to make transient.public void makeTransientAll(java.lang.Object[] pcs)
The instances lose their JDO identity and they are no longer associated with any PersistenceManager. The state of fields is preserved unchanged.
makeTransientAll
in interface javax.jdo.PersistenceManager
pcs
- the instances to make transient.public void makeTransientAll(java.util.Collection pcs)
The instances lose their JDO identity and they are no longer associated with any PersistenceManager. The state of fields is preserved unchanged.
makeTransientAll
in interface javax.jdo.PersistenceManager
pcs
- the instances to make transient.public void makeTransactional(java.lang.Object pc)
Transient instances normally do not observe transaction boundaries. This method makes transient instances sensitive to transaction completion. If an instance is modified in a transaction, and the transaction rolls back, the state of the instance is restored to the state before the first change in the transaction.
For persistent instances read in optimistic transactions, this method allows the application to make the state of the instance part of the transactional state. At transaction commit, the state of the instance in cache is compared to the state of the instance in the data store. If they are not the same, then an exception is thrown.
makeTransactional
in interface javax.jdo.PersistenceManager
pc
- the instance to make transactional.public void makeTransactionalAll(java.lang.Object[] pcs)
makeTransactionalAll
in interface javax.jdo.PersistenceManager
pcs
- the array of instances to make transactional.makeTransactional(Object pc)
public void makeTransactionalAll(java.util.Collection pcs)
makeTransactionalAll
in interface javax.jdo.PersistenceManager
pcs
- the Collection of instances to make transactional.makeTransactional(Object pc)
public void makeNontransactional(java.lang.Object pc)
Normally, at transaction completion, instances are evicted from the cache. This method allows an application to identify an instance as not being evicted from the cache at transaction completion. Instead, the instance remains in the cache with nontransactional state.
makeNontransactional
in interface javax.jdo.PersistenceManager
pc
- the instance to make nontransactional.public void makeNontransactionalAll(java.lang.Object[] pcs)
makeNontransactionalAll
in interface javax.jdo.PersistenceManager
pcs
- the array of instances to make nontransactional.makeNontransactional(Object pc)
public void makeNontransactionalAll(java.util.Collection pcs)
makeNontransactionalAll
in interface javax.jdo.PersistenceManager
pcs
- the Collection of instances to make nontransactional.makeNontransactional(Object pc)
public void evict(java.lang.Object pc)
evict
in interface javax.jdo.PersistenceManager
pc
- the instance to evict from the cache.public void evictAll(java.lang.Object[] pcs)
evictAll
in interface javax.jdo.PersistenceManager
pcs
- the array of instances to evict from the cache.evict(Object pc)
public void evictAll(java.util.Collection pcs)
evictAll
in interface javax.jdo.PersistenceManager
pcs
- the Collection of instance to evict from the cache.public void evictAll()
evictAll
in interface javax.jdo.PersistenceManager
evict(Object pc)
public void refresh(java.lang.Object pc)
In an optimistic transaction, the state of instances in the cache might not match the state in the data store. This method is used to reload the state of the instance from the data store so that a subsequent commit is more likely to succeed.
Outside a transaction, this method will refresh nontransactional state.
refresh
in interface javax.jdo.PersistenceManager
pc
- the instance to refresh.public void refreshAll(java.lang.Object[] pcs)
refreshAll
in interface javax.jdo.PersistenceManager
pcs
- the array of instances to refresh.refresh(Object pc)
public void refreshAll(java.util.Collection pcs)
refreshAll
in interface javax.jdo.PersistenceManager
pcs
- the Collection of instances to refresh.refresh(Object pc)
public void refreshAll()
If called with an active transaction, all transactional instances will be refreshed. If called outside an active transaction, all nontransactional instances will be refreshed.
refreshAll
in interface javax.jdo.PersistenceManager
refresh(Object pc)
public void refreshAll(javax.jdo.JDOException jdoe)
refreshAll
in interface javax.jdo.PersistenceManager
public void retrieve(java.lang.Object pc)
PersistenceManager
that the application intends to use the
instance, and its field values must be retrieved.
The PersistenceManager
might use policy information about the
class to retrieve associated instances.
retrieve
in interface javax.jdo.PersistenceManager
pc
- the instancepublic void retrieveAll(java.lang.Object[] pcs)
PersistenceManager
that the application intends to use the
instances, and all field values must be retrieved.
The PersistenceManager
might use policy information about the
class to retrieve associated instances.
retrieveAll
in interface javax.jdo.PersistenceManager
pcs
- the instancespublic void retrieveAll(java.lang.Object[] pcs, boolean DFGOnly)
PersistenceManager
that the application intends to use the
instances, and their field values should be retrieved. The fields
in the default fetch group must be retrieved, and the implementation
might retrieve more fields than the default fetch group.
The PersistenceManager
might use policy information about the
class to retrieve associated instances.
retrieveAll
in interface javax.jdo.PersistenceManager
pcs
- the instancesDFGOnly
- whether to retrieve only the default fetch group fieldspublic void retrieveAll(java.util.Collection pcs)
PersistenceManager
that the application intends to use the
instances, and all field values must be retrieved.
The PersistenceManager
might use policy information about the
class to retrieve associated instances.
retrieveAll
in interface javax.jdo.PersistenceManager
pcs
- the instancespublic void retrieveAll(java.util.Collection pcs, boolean DFGOnly)
PersistenceManager
that the application intends to use the
instances, and their field values should be retrieved. The fields
in the default fetch group must be retrieved, and the implementation
might retrieve more fields than the default fetch group.
The PersistenceManager
might use policy information about the
class to retrieve associated instances.
retrieveAll
in interface javax.jdo.PersistenceManager
pcs
- the instancesDFGOnly
- whether to retrieve only the default fetch group fieldspublic javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
getPersistenceManagerFactory
in interface javax.jdo.PersistenceManager
public void setUserObject(java.lang.Object o)
setUserObject
in interface javax.jdo.PersistenceManager
o
- the user instance to be remembered by the PersistenceManagergetUserObject()
public java.lang.Object getUserObject()
getUserObject
in interface javax.jdo.PersistenceManager
setUserObject(java.lang.Object)
public java.lang.Object detachCopy(java.lang.Object pc)
PersistenceManager
.
detachCopy
in interface javax.jdo.PersistenceManager
pc
- the instance to detach
detachCopyAll(Object[])
public java.util.Collection detachCopyAll(java.util.Collection pcs)
PersistenceManager
.
detachCopyAll
in interface javax.jdo.PersistenceManager
pcs
- the instances to detach
detachCopyAll(Object[])
public java.lang.Object[] detachCopyAll(java.lang.Object[] pcs)
PersistenceManager
. The objects returned can be
manipulated and re-attached with
attachCopyAll(Object[], boolean)
.
The detached instances will be
unmanaged copies of the specified parameters, and are suitable
for serialization and manipulation outside of a JDO
environment. When detaching instances, only fields in the
current FetchPlan
will be traversed. Thus, to detach a
graph of objects, relations to other persistent instances must
either be in the default-fetch-group
, or in the
current custom FetchPlan
.
detachCopyAll
in interface javax.jdo.PersistenceManager
pcs
- the instances to detach
javax.jdo.JDOUserException
- if any of the instances do notattachCopyAll(Object[], boolean)
,
getFetchPlan()
public java.lang.Object attachCopy(java.lang.Object pc, boolean makeTransactional)
PersistenceManager
.
attachCopy
in interface javax.jdo.PersistenceManager
pc
- instance to importmakeTransactional
- if true
, this method will
mark transactional the persistent instances corresponding
to all instances in the closure of the detached graph.
attachCopyAll(Object[],boolean)
public java.util.Collection attachCopyAll(java.util.Collection pcs, boolean makeTransactional)
PersistenceManager
.
attachCopyAll
in interface javax.jdo.PersistenceManager
pcs
- Collection of instances to importmakeTransactional
- if true
, this method will
mark transactional the persistent instances corresponding
to all instances in the closure of the detached graph.
attachCopyAll(Object[],boolean)
public java.lang.Object[] attachCopyAll(java.lang.Object[] pcs, boolean makeTransactional)
PersistenceManager
. Instances that were
previously detached from this or another
PersistenceManager
will have their changed merged
into the persistent instances. Instances that are new will be
persisted as new instances.
attachCopyAll
in interface javax.jdo.PersistenceManager
pcs
- array of instances to importmakeTransactional
- if true
, this method will
mark transactional the persistent instances corresponding
to all instances in the closure of the detached graph.
detachCopyAll(Object[])
public java.lang.Object putUserObject(java.lang.Object key, java.lang.Object val)
putUserObject
in interface javax.jdo.PersistenceManager
public java.lang.Object getUserObject(java.lang.Object key)
getUserObject
in interface javax.jdo.PersistenceManager
key
- the key of the object to be returned
public java.lang.Object removeUserObject(java.lang.Object key)
removeUserObject
in interface javax.jdo.PersistenceManager
key
- the key of the object to be removedpublic void flush()
If a datastore transaction is active, this method synchronizes the cache with the datastore and reports any exceptions.
If an optimistic transaction is active, this method obtains a datastore connection, synchronizes the cache with the datastore using this connection and reports any exceptions. The connection obtained by this method is held until the end of the transaction.
If exceptions occur during flush, the implementation will
set the current transaction's RollbackOnly
flag
(see Transaction.setRollbackOnly()
).
flush
in interface PersistenceManagerInternal
public void checkConsistency()
PersistenceManager
cache with the
datastore. This method has no effect if a transaction is not
active.
If a datastore transaction is active, this method verifies
the consistency of instances in the cache against the
datastore. An implementation might flush instances as if
flush()
were called, but it is not required to do
so.
If an optimistic transaction is active, this method obtains
a datastore connection and verifies the consistency of the
instances in the cache against the datastore. If any
inconsistencies are detected, a JDOOptimisticVerificationException
is thrown. This exception
contains a nested JDOOptimisticVerificationException
for each object that failed the consistency check. No
datastore resources acquired during the execution of this
method are held beyond the scope of this method.
checkConsistency
in interface javax.jdo.PersistenceManager
public javax.jdo.FetchPlan getFetchPlan()
FetchPlan
used by this
PersistenceManager
.
getFetchPlan
in interface javax.jdo.PersistenceManager
public java.lang.Object newInstance(java.lang.Class pcClass)
newInstance
in interface javax.jdo.PersistenceManager
pcClass
- Must be an abstract class or interface
that is declared in the metadata.
public javax.jdo.datastore.Sequence getSequence(java.lang.String name)
name
.
getSequence
in interface javax.jdo.PersistenceManager
name
- the name of the Sequence
public javax.jdo.datastore.JDOConnection getDataStoreConnection()
getDataStoreConnection
in interface javax.jdo.PersistenceManager
public void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener, java.lang.Class[] classes)
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
listenerInstance
.
The listenerInstance will be called for each event for which it implements the corresponding listenerInstance interface.
addInstanceLifecycleListener
in interface javax.jdo.PersistenceManager
listener
- the lifecycle listenerclasses
- the classes of interest to the listenerpublic void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
removeInstanceLifecycleListener
in interface javax.jdo.PersistenceManager
listener
- the listener instance to be removedpublic java.util.Properties getProperties()
Standard properties include:
public void assertIsOpen()
assertIsOpen
in interface PersistenceManagerInternal
public StoreManager getStoreManager()
PersistenceManagerInternal
getStoreManager
in interface PersistenceManagerInternal
PersistenceManagerInternal.getStoreManager()
public void setStoreManager(StoreManager storeManager)
PersistenceManagerInternal
setStoreManager
in interface PersistenceManagerInternal
storeManager
- the StoreManager to be used by this
PersistenceManagerPersistenceManagerInternal.setStoreManager(StoreManager)
public java.lang.Object newSCOInstanceInternal(java.lang.Class type)
newSCOInstanceInternal
in interface PersistenceManagerInternal
type
- Class of the new SCO instance
(Class type)
public java.util.Collection newCollectionInstanceInternal(java.lang.Class type, java.lang.Class elementType, boolean allowNulls, java.lang.Integer initialSize, java.lang.Float loadFactor, java.util.Collection initialContents, java.util.Comparator comparator)
newCollectionInstanceInternal
in interface PersistenceManagerInternal
PersistenceManagerInternal.newCollectionInstanceInternal(Class type,
Class elementType, boolean allowNulls, Integer initialSize,
Float loadFactor, Collection initialContents, Comparator comparator)
public java.util.Map newMapInstanceInternal(java.lang.Class type, java.lang.Class keyType, java.lang.Class valueType, boolean allowNulls, java.lang.Integer initialSize, java.lang.Float loadFactor, java.util.Map initialContents, java.util.Comparator comparator)
newMapInstanceInternal
in interface PersistenceManagerInternal
PersistenceManagerInternal.newMapInstanceInternal(Class type,
Class keyType, Class valueType, boolean allowNulls, Integer initialSize,
Float loadFactor, Map initialContents, Comparator comparator)
public boolean isSupportedSCOType(java.lang.Class type)
PersistenceManagerInternal
isSupportedSCOType
in interface PersistenceManagerInternal
type
- Class type of the field.
(Class type)
public void register(StateManagerInternal sm, java.lang.Object oid, boolean transactional, boolean throwDuplicateException)
PersistenceManagerInternal
register
in interface PersistenceManagerInternal
sm
- instance of StateManagerInternal to be addedoid
- ObjectId of the corresponding persistence-capable instancetransactional
- true if the corresponding lifecycle state is transactionalthrowDuplicateException
- true if the exception should be thrown in case the same ObjectId
has been already registered.PersistenceManagerInternal.register(StateManagerInternal sm, Object oid,
boolean transactional, boolean throwDuplicateException)
public void registerTransient(StateManagerInternal sm)
PersistenceManagerInternal
registerTransient
in interface PersistenceManagerInternal
sm
- instance of StateManagerInternal to be addedPersistenceManagerInternal.registerTransient(StateManagerInternal sm)
public void deregister(java.lang.Object oid)
PersistenceManagerInternal
deregister
in interface PersistenceManagerInternal
oid
- ObjectId of the instance to be removed.PersistenceManagerInternal.deregister(Object oid)
public void deregisterTransient(StateManagerInternal sm)
PersistenceManagerInternal
deregisterTransient
in interface PersistenceManagerInternal
sm
- instance of StateManagerInternal to be removedPersistenceManagerInternal.deregisterTransient(StateManagerInternal sm)
public void replaceObjectId(java.lang.Object oldId, java.lang.Object newId)
PersistenceManagerInternal
replaceObjectId
in interface PersistenceManagerInternal
oldId
- previous value of ObjectId.newId
- new value of ObjectId.PersistenceManagerInternal.replaceObjectId(Object oldId, Object newId)
public void markAsFlushed(StateManagerInternal sm)
PersistenceManagerInternal
markAsFlushed
in interface PersistenceManagerInternal
sm
- StateManagerInternal instance that has been flushedPersistenceManagerInternal.markAsFlushed(StateManagerInternal sm)
public boolean insideCommit()
PersistenceManagerInternal
insideCommit
in interface PersistenceManagerInternal
PersistenceManagerInternal.insideCommit()
public void hereIsStateManager(StateManagerInternal sm, javax.jdo.spi.PersistenceCapable pc)
hereIsStateManager
in interface PersistenceManagerInternal
pc
- PC instancesm
- StateManager to savepublic StateManagerInternal getStateManager(java.lang.Object oid, java.lang.Class pcClass)
PersistenceManagerInternal
getStateManager
in interface PersistenceManagerInternal
oid
- the given Object Id.pcClass
- Class of a PersistenceCapable instance to be created
if this Object Id was not registered with this PersistenceManager.
PersistenceManagerInternal.getStateManager(java.lang.Object, java.lang.Class)
public StateManagerInternal findStateManager(javax.jdo.spi.PersistenceCapable pc)
findStateManager
in interface PersistenceManagerInternal
pc
- PC instance
public javax.jdo.PersistenceManager getCurrentWrapper()
getCurrentWrapper
in interface PersistenceManagerInternal
public java.util.Collection getInsertedInstances()
getInsertedInstances
in interface PersistenceManagerInternal
PersistenceManagerInternal.getInsertedInstances()
public int hashCode()
public boolean equals(java.lang.Object obj)
obj
- the reference object with which to compare.
true
if this object is the same as the obj
argument; false
otherwise.protected void pushCurrentWrapper(PersistenceManagerWrapper pmw)
protected void popCurrentWrapper(PersistenceManagerWrapper prev)
protected void setJTATransaction(java.lang.Object t)
protected void deregisterJTA()
protected void forceClose()
protected boolean verify(java.lang.String username, java.lang.String password)
protected void flushInstances()
protected void afterCompletion(int status)
status
- javax.transaction.Statusprotected void notifyStatusChange(boolean isActive)
protected void notifyOptimistic(boolean optimistic)
public java.lang.ClassLoader getContextClassLoaderPrivileged() throws java.lang.SecurityException
java.lang.SecurityException
- thrown by getContextClassLoader.public void assertReadAllowed()
assertReadAllowed
in interface PersistenceManagerInternal
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |