org.apache.jdo.impl.pm
Class PersistenceManagerImpl

java.lang.Object
  extended by org.apache.jdo.impl.pm.PersistenceManagerImpl
All Implemented Interfaces:
javax.jdo.PersistenceManager, PersistenceManagerInternal

public abstract class PersistenceManagerImpl
extends java.lang.Object
implements PersistenceManagerInternal

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.

Author:
Marina Vatkina

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.
 boolean getDetachAllOnCommit()
          Get the value of the detachAllOnCommit flag.
 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.
 java.lang.Object makePersistent(java.lang.Object pc)
          Make the transient instance persistent in this PersistenceManager.
 java.util.Collection makePersistentAll(java.util.Collection pcs)
          Make an collection of instances persistent.
 java.lang.Object[] 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 makeTransient(java.lang.Object pc, boolean useFetchPlan)
          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.util.Collection pcs, boolean useFetchPlan)
          Make 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 makeTransientAll(java.lang.Object[] pcs, boolean useFetchPlan)
          Make 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 retrieve(java.lang.Object pc, boolean FGOnly)
          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 FGOnly)
          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 FGOnly)
          Retrieve field values of instances from the store.
 void setDetachAllOnCommit(boolean flag)
           
 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

msg

protected static final org.apache.jdo.util.I18NHelper msg
I18N message handler

Constructor Detail

PersistenceManagerImpl

public 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.

Parameters:
pmf - calling PersistenceManagerFactory as PersistenceManagerFactoryInternal
username - 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

setIgnoreCache

public void setIgnoreCache(boolean flag)
Specified by:
setIgnoreCache in interface javax.jdo.PersistenceManager
Parameters:
flag - the ignoreCache value
See Also:
PersistenceManager.setIgnoreCache(boolean flag)

getIgnoreCache

public boolean getIgnoreCache()
Get the value of the ignoreCache flag.

Specified by:
getIgnoreCache in interface javax.jdo.PersistenceManager
Returns:
the IgnoreCache flag
See Also:
PersistenceManager.getIgnoreCache()

setDetachAllOnCommit

public void setDetachAllOnCommit(boolean flag)
Specified by:
setDetachAllOnCommit in interface javax.jdo.PersistenceManager
Parameters:
flag - the detachAllOnCommit value
See Also:
PersistenceManager.setDetachAllOnCommit(boolean flag)

getDetachAllOnCommit

public boolean getDetachAllOnCommit()
Get the value of the detachAllOnCommit flag.

Specified by:
getDetachAllOnCommit in interface javax.jdo.PersistenceManager
Returns:
the DetachAllOnCommit flag
See Also:
PersistenceManager.getDetachAllOnCommit()

setMultithreaded

public void setMultithreaded(boolean flag)
Set the Multithreaded flag for this PersistenceManager. Applications that use multiple threads to invoke methods or access fields from instances managed by this PersistenceManager must set this flag to true. Instances managed by this PersistenceManager include persistent or transactional instances of PersistenceCapable classes, as well as helper instances such as Query, Transaction, or Extent.

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

getMultithreaded

public boolean getMultithreaded()
Get the current Multithreaded flag for this PersistenceManager.

Specified by:
getMultithreaded in interface javax.jdo.PersistenceManager
Returns:
the Multithreaded setting.
See Also:
setMultithreaded(boolean)

isClosed

public boolean isClosed()
Return whether this PersistenceManager is closed.

Specified by:
isClosed in interface javax.jdo.PersistenceManager
See Also:
PersistenceManager.isClosed()

close

public void close()
Close this persistence manager

Specified by:
close in interface javax.jdo.PersistenceManager
See Also:
PersistenceManager.close()

currentTransaction

public javax.jdo.Transaction currentTransaction()
Returns transaction associated with this persistence manager

Specified by:
currentTransaction in interface javax.jdo.PersistenceManager
Returns:
transaction current transaction

getObjectById

public 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.

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.

Specified by:
getObjectById in interface javax.jdo.PersistenceManager
Parameters:
oid - an ObjectId
validate - if the existence of the instance is to be validated
Returns:
the PersistenceCapable instance with the specified ObjectId

getObjectById

public java.lang.Object getObjectById(java.lang.Class cls,
                                      java.lang.Object key)
Looks up the instance of the given type with the given key.

Specified by:
getObjectById in interface javax.jdo.PersistenceManager
Parameters:
cls - The type of object to load
key - either the string representation of the object id, or an object representation of a single field identity key
Returns:
the corresponding persistent instance
Since:
2.0

getObjectById

public java.lang.Object getObjectById(java.lang.Object oid)
Looks up the instance corresponding to the specified oid. This is equivalent to 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

getObjectId

public java.lang.Object getObjectId(java.lang.Object pc)
The ObjectId returned by this method represents the JDO identity of the instance. The ObjectId is a copy (clone) of the internal state of the instance, and changing it does not affect the JDO identity of the instance. Delegates actual execution to the internal method.

Specified by:
getObjectId in interface javax.jdo.PersistenceManager
Parameters:
pc - the PersistenceCapable instance
Returns:
the corresponding ObjectId of the instance. Returns null if pc is null, not persistence-capable, or not persistent.

loadClass

public java.lang.Class loadClass(java.lang.String name,
                                 java.lang.ClassLoader given)
                          throws java.lang.ClassNotFoundException
Description copied from interface: PersistenceManagerInternal
Provides a Class of the given name. This method will use one of as many as three ClassLoaders in attempting to load the named class. The ClassLoaders are:
  • The given Class Loader
  • The current Thread's context Class Loader
  • The class loader that was the context Class Loader of the thread which created this PersistenceManagerInternal
For each such non-null Class Loader, it is used as a parameter of Class.forName. If the result is not null, then the given Comparator's compare method is invoked with that Class and the given Object o. If that returns zero, that Class is returned. If either the Class.forName returns null or the comparator returns non-zero, the next non-null ClassLoader in the above list is tried in the same manner.

If after the above has been tried on all the ClassLoaders, an appropriate Class has not been found, throws JDOUserException.

Specified by:
loadClass in interface PersistenceManagerInternal
Parameters:
name - Fully qualified name of the Class to load.
given - ClassLoader which is the first to be tried in loading the named Class.
Throws:
java.lang.ClassNotFoundException - - if an appropriate Class can not be loaded.
See Also:
PersistenceManagerInternal.loadClass(java.lang.String, java.lang.ClassLoader)

loadPCClassForObjectIdClass

public java.lang.Class loadPCClassForObjectIdClass(java.lang.Class objectIdClass)
                                            throws java.lang.ClassNotFoundException
Description copied from interface: PersistenceManagerInternal
Provides the Class object of the persistence-capable class that defines the specified class as its ObjectId class. This method will use one of as many as three ClassLoaders in attempting to find the persistence-capable class. The ClassLoaders are the same as in PersistenceManagerInternal.loadClass(java.lang.String, java.lang.ClassLoader):
  • The given Class Loader, here the given class loader is the class loader of the ObjectId class
  • The current Thread's context Class Loader
  • The class loader that was the context Class Loader of the thread which created this PersistenceManagerInternal
The method returns the top most persistence-capable class in the case of an inheritance hierachy.

Specified by:
loadPCClassForObjectIdClass in interface PersistenceManagerInternal
Throws:
java.lang.ClassNotFoundException
See Also:
PersistenceManagerInternal.loadPCClassForObjectIdClass(java.lang.Class)

getInternalObjectId

public java.lang.Object getInternalObjectId(java.lang.Object pc)
Gets the internal object id for this instance. Returns null if it is not a PersistenceCapable instance.

Specified by:
getInternalObjectId in interface PersistenceManagerInternal
Parameters:
pc -
Returns:
the internal object id

getTransactionalObjectId

public java.lang.Object getTransactionalObjectId(java.lang.Object pc)
Specified by:
getTransactionalObjectId in interface javax.jdo.PersistenceManager
See Also:
PersistenceManager.getTransactionalObjectId(java.lang.Object)

newObjectIdInstance

public 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.

Specified by:
newObjectIdInstance in interface javax.jdo.PersistenceManager
Parameters:
pcClass - the Class of the persistence-capable instance
key - the value of the key field for single-field identity.
Returns:
an instance of the object identity class

getObjectsById

public java.util.Collection getObjectsById(java.util.Collection oids,
                                           boolean validate)
Return the objects with the given oids.

Specified by:
getObjectsById in interface javax.jdo.PersistenceManager
Parameters:
oids - the oids of the objects to return
validate - if true, the existance of the objects in the datastore will be validated.
Returns:
the objects that were looked up, in the same order as the oids parameter.
Since:
2.0
See Also:
getObjectById(Object,boolean)

getObjectsById

public java.util.Collection getObjectsById(java.util.Collection oids)
Return the objects with the given oids. This method is equivalent to calling getObjectsById(Collection, boolean) with the validate flag true.

Specified by:
getObjectsById in interface javax.jdo.PersistenceManager
Parameters:
oids - the oids of the objects to return
Returns:
the objects that were looked up, in the same order as the oids parameter.
Since:
2.0
See Also:
getObjectsById(Collection,boolean)

getObjectsById

public java.lang.Object[] getObjectsById(java.lang.Object[] oids,
                                         boolean validate)
Return the objects with the given oids.

Specified by:
getObjectsById in interface javax.jdo.PersistenceManager
Parameters:
oids - the oids of the objects to return
validate - if true, the existance of the objects in the datastore will be validated.
Returns:
the objects that were looked up, in the same order as the oids parameter.
Since:
2.0
See Also:
getObjectById(Object,boolean)

getObjectsById

public java.lang.Object[] getObjectsById(java.lang.Object[] oids)
Return the objects with the given oids. This method is equivalent to calling getObjectsById(Object[],boolean) with the validate flag true.

Specified by:
getObjectsById in interface javax.jdo.PersistenceManager
Parameters:
oids - the oids of the objects to return
Returns:
the objects that were looked up, in the same order as the oids parameter.
Since:
2.0
See Also:
getObjectsById(Object[],boolean)

getObjectIdClass

public java.lang.Class getObjectIdClass(java.lang.Class cls)
Return the Class that implements the JDO Identity for the specified PersistenceCapable Class. The application can use the returned Class to construct a JDO Identity instance for application identity PersistenceCapable classes. This JDO Identity instance can then be used to get an instance of the PersistenceCapable class for use in the application.

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.

Specified by:
getObjectIdClass in interface javax.jdo.PersistenceManager
Parameters:
cls - the PersistenceCapable Class
Returns:
the Class of the ObjectId of the parameter
See Also:
getObjectById(java.lang.Object, boolean)

newQuery

public abstract javax.jdo.Query newQuery()
Create a new Query with no elements.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Returns:
a new Query instance with no elements.

newQuery

public abstract javax.jdo.Query newQuery(java.lang.Object compiled)
Create a new Query using elements from another Query. The other Query must have been created by the same JDO implementation. It might be active in a different PersistenceManager or might have been serialized and restored.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
compiled - another Query from the same JDO implementation
Returns:
the new Query

newQuery

public 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.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
query - the single-string query
Returns:
the new Query
Since:
2.0

newQuery

public abstract javax.jdo.Query newQuery(java.lang.String language,
                                         java.lang.Object query)
Create a new Query using the specified language.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
language - the language of the query parameter
query - the query, which is of a form determined by the language
Returns:
the new Query

newQuery

public abstract javax.jdo.Query newQuery(java.lang.Class cls)
Create a new Query specifying the Class of the results.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of the results
Returns:
the new Query

newQuery

public abstract javax.jdo.Query newQuery(javax.jdo.Extent cln)
Create a new Query with the candidate Extent; the class is taken from the Extent.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cln - the Extent of candidate instances
Returns:
the new Query

newQuery

public 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.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of results
cln - the Collection of candidate instances
Returns:
the new Query

newQuery

public 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.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of results
filter - the Filter for candidate instances
Returns:
the new Query

newQuery

public 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.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of results
cln - the Collection of candidate instances
filter - the Filter for candidate instances
Returns:
the new Query

newQuery

public abstract javax.jdo.Query newQuery(javax.jdo.Extent cln,
                                         java.lang.String filter)
Create a new Query with the candidate Extent and Filter. The class is taken from the Extent.

Specified by:
newQuery in interface javax.jdo.PersistenceManager
Parameters:
cln - the Extent of candidate instances
filter - the Filter for candidate instances
Returns:
the new Query

newNamedQuery

public 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. The query name given must be the name of a query defined in metadata.

Specified by:
newNamedQuery in interface javax.jdo.PersistenceManager
Parameters:
cls - the Class of candidate instances
queryName - the name of the query to look up in metadata
Returns:
the new Query
Since:
2.0

getExtent

public 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. This method returns an Extent of instances in the data store that might be iterated or given to a Query as the Extent of candidate instances.

Specified by:
getExtent in interface javax.jdo.PersistenceManager
Parameters:
persistenceCapableClass - Class of instances
subclasses - whether to include instances of subclasses
Returns:
an Extent of instances.
See Also:
StoreManager.getExtent(java.lang.Class, boolean, org.apache.jdo.pm.PersistenceManagerInternal), Query

getExtent

public javax.jdo.Extent getExtent(java.lang.Class persistenceCapableClass)
Equivalent to getExtent (persistenceCapableClass, true).

Specified by:
getExtent in interface javax.jdo.PersistenceManager
Since:
2.0
See Also:
getExtent(Class,boolean)

makePersistent

public java.lang.Object makePersistent(java.lang.Object pc)
Make the transient instance persistent in this PersistenceManager. This method must be called in an active transaction. The PersistenceManager assigns an ObjectId to the instance and transitions it to persistent-new. The instance will be managed in the Extent associated with its Class. The instance will be put into the data store at commit.

Specified by:
makePersistent in interface javax.jdo.PersistenceManager
Parameters:
pc - a transient instance of a Class that implements PersistenceCapable

makePersistentAll

public java.lang.Object[] makePersistentAll(java.lang.Object[] pcs)
Make an array of instances persistent.

Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - an array of transient instances
See Also:
makePersistent(Object pc)

makePersistentAll

public java.util.Collection makePersistentAll(java.util.Collection pcs)
Make an collection of instances persistent.

Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - an collection of transient instances
See Also:
makePersistent(Object pc)

deletePersistent

public void deletePersistent(java.lang.Object pc)
Delete the persistent instance from the data store. This method must be called in an active transaction. The data store object will be removed at commit. Unlike makePersistent, which makes the closure of the instance persistent, the closure of the instance is not deleted from the data store. This method has no effect if the instance is already deleted in the current transaction. This method throws an exception if the instance is transient or is managed by another PersistenceManager.

Specified by:
deletePersistent in interface javax.jdo.PersistenceManager
Parameters:
pc - a persistent instance

deletePersistentAll

public void deletePersistentAll(java.lang.Object[] pcs)
Delete an array of instances from the data store.

Specified by:
deletePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - a Collection of persistent instances
See Also:
deletePersistent(Object pc)

deletePersistentAll

public void deletePersistentAll(java.util.Collection pcs)
Delete a Collection of instances from the data store.

Specified by:
deletePersistentAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - a Collection of persistent instances
See Also:
deletePersistent(Object pc)

makeTransient

public void makeTransient(java.lang.Object pc)
Make an instance transient, removing it from management by this PersistenceManager.

The instance loses its JDO identity and it is no longer associated with any PersistenceManager. The state of fields is preserved unchanged.

Specified by:
makeTransient in interface javax.jdo.PersistenceManager
Parameters:
pc - the instance to make transient.

makeTransientAll

public void makeTransientAll(java.lang.Object[] pcs)
Make an array of instances transient, removing them from management by this PersistenceManager.

The instances lose their JDO identity and they are no longer associated with any PersistenceManager. The state of fields is preserved unchanged.

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances to make transient.

makeTransientAll

public void makeTransientAll(java.util.Collection pcs)
Make a Collection of instances transient, removing them from management by this PersistenceManager.

The instances lose their JDO identity and they are no longer associated with any PersistenceManager. The state of fields is preserved unchanged.

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances to make transient.

makeTransient

public void makeTransient(java.lang.Object pc,
                          boolean useFetchPlan)
Make an instance transient, removing it from management by this PersistenceManager. Because FOStore doesn't support the notion of a fetch plan, this method behaves exactly as makeTransient(Object pc).

Specified by:
makeTransient in interface javax.jdo.PersistenceManager
See Also:
PersistenceManager.makeTransient(Object, boolean);

makeTransientAll

public void makeTransientAll(java.lang.Object[] pcs,
                             boolean useFetchPlan)
Make instances transient, removing them from management by this PersistenceManager. Because FOStore doesn't support the notion of a fetch plan, this method behaves exactly as makeTransientAll(Object[] pcs).

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
See Also:
PersistenceManager.makeTransientAll(Object[], boolean);

makeTransientAll

public void makeTransientAll(java.util.Collection pcs,
                             boolean useFetchPlan)
Make instances transient, removing them from management by this PersistenceManager. Because FOStore doesn't support the notion of a fetch plan, this method behaves exactly as makeTransientAll(Collection pcs).

Specified by:
makeTransientAll in interface javax.jdo.PersistenceManager
See Also:
PersistenceManager.makeTransientAll(Collection, boolean);

makeTransactional

public void makeTransactional(java.lang.Object pc)
Make an instance subject to transactional boundaries.

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.

Specified by:
makeTransactional in interface javax.jdo.PersistenceManager
Parameters:
pc - the instance to make transactional.

makeTransactionalAll

public void makeTransactionalAll(java.lang.Object[] pcs)
Make an array of instances subject to transactional boundaries.

Specified by:
makeTransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the array of instances to make transactional.
See Also:
makeTransactional(Object pc)

makeTransactionalAll

public void makeTransactionalAll(java.util.Collection pcs)
Make a Collection of instances subject to transactional boundaries.

Specified by:
makeTransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the Collection of instances to make transactional.
See Also:
makeTransactional(Object pc)

makeNontransactional

public void makeNontransactional(java.lang.Object pc)
Make an instance non-transactional after commit.

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.

Specified by:
makeNontransactional in interface javax.jdo.PersistenceManager
Parameters:
pc - the instance to make nontransactional.

makeNontransactionalAll

public void makeNontransactionalAll(java.lang.Object[] pcs)
Make an array of instances non-transactional after commit.

Specified by:
makeNontransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the array of instances to make nontransactional.
See Also:
makeNontransactional(Object pc)

makeNontransactionalAll

public void makeNontransactionalAll(java.util.Collection pcs)
Make a Collection of instances non-transactional after commit.

Specified by:
makeNontransactionalAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the Collection of instances to make nontransactional.
See Also:
makeNontransactional(Object pc)

evict

public void evict(java.lang.Object pc)
Mark an instance as no longer needed in the cache. Eviction is normally done automatically by the PersistenceManager at transaction completion. This method allows the application to explicitly provide a hint to the PersistenceManager that the instance is no longer needed in the cache.

Specified by:
evict in interface javax.jdo.PersistenceManager
Parameters:
pc - the instance to evict from the cache.

evictAll

public void evictAll(java.lang.Object[] pcs)
Mark an array of instances as no longer needed in the cache.

Specified by:
evictAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the array of instances to evict from the cache.
See Also:
evict(Object pc)

evictAll

public void evictAll(java.util.Collection pcs)
Mark a Collection of instances as no longer needed in the cache.

Specified by:
evictAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the Collection of instance to evict from the cache.

evictAll

public void evictAll()
Mark all persistent-nontransactional instances as no longer needed in the cache. It transitions all persistent-nontransactional instances to hollow. Transactional instances are subject to eviction based on the RetainValues setting.

Specified by:
evictAll in interface javax.jdo.PersistenceManager
See Also:
evict(Object pc)

refresh

public void refresh(java.lang.Object pc)
Refresh the state of the instance from the data store.

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.

Specified by:
refresh in interface javax.jdo.PersistenceManager
Parameters:
pc - the instance to refresh.

refreshAll

public void refreshAll(java.lang.Object[] pcs)
Refresh the state of an array of instances from the data store.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the array of instances to refresh.
See Also:
refresh(Object pc)

refreshAll

public void refreshAll(java.util.Collection pcs)
Refresh the state of a Collection of instances from the data store.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the Collection of instances to refresh.
See Also:
refresh(Object pc)

refreshAll

public void refreshAll()
Refresh the state of all applicable instances from the data store.

If called with an active transaction, all transactional instances will be refreshed. If called outside an active transaction, all nontransactional instances will be refreshed.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
See Also:
refresh(Object pc)

refreshAll

public void refreshAll(javax.jdo.JDOException jdoe)
Refreshes all instances in the exception that failed verification.

Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Since:
2.0

retrieve

public void retrieve(java.lang.Object pc)
Retrieve field values of an instance from the store. This tells the 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.

Specified by:
retrieve in interface javax.jdo.PersistenceManager
Parameters:
pc - the instance

retrieve

public void retrieve(java.lang.Object pc,
                     boolean FGOnly)
Retrieve field values of an instance from the store.

The PersistenceManager might use policy information about the class to retrieve associated instances.

Specified by:
retrieve in interface javax.jdo.PersistenceManager
Parameters:
pc - the instance
FGOnly - whether to retrieve only the fields in the fetch plan

retrieveAll

public void retrieveAll(java.lang.Object[] pcs)
Retrieve field values of instances from the store. This tells the 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.

Specified by:
retrieveAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances

retrieveAll

public void retrieveAll(java.lang.Object[] pcs,
                        boolean FGOnly)
Retrieve field values of instances from the store. This tells the 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.

Specified by:
retrieveAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances
FGOnly - whether to retrieve only the fields in the fetch plan
Since:
1.0.1

retrieveAll

public void retrieveAll(java.util.Collection pcs)
Retrieve field values of instances from the store. This tells the 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.

Specified by:
retrieveAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances

retrieveAll

public void retrieveAll(java.util.Collection pcs,
                        boolean FGOnly)
Retrieve field values of instances from the store. This tells the 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.

Specified by:
retrieveAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances
FGOnly - whether to retrieve only the fields in the fetch plan
Since:
1.0.1

getPersistenceManagerFactory

public javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory()
This method returns the PersistenceManagerFactory used to create this PersistenceManager. It returns null if this instance was created via a constructor.

Specified by:
getPersistenceManagerFactory in interface javax.jdo.PersistenceManager
Returns:
the PersistenceManagerFactory that created this PersistenceManager

setUserObject

public 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.

Specified by:
setUserObject in interface javax.jdo.PersistenceManager
Parameters:
o - the user instance to be remembered by the PersistenceManager
See Also:
getUserObject()

getUserObject

public java.lang.Object getUserObject()
The application can manage the PersistenceManager instances more easily by having an application object associated with each PersistenceManager instance.

Specified by:
getUserObject in interface javax.jdo.PersistenceManager
Returns:
the user object associated with this PersistenceManager
See Also:
setUserObject(java.lang.Object)

detachCopy

public java.lang.Object detachCopy(java.lang.Object pc)
Detach the specified object from the PersistenceManager.

Specified by:
detachCopy in interface javax.jdo.PersistenceManager
Parameters:
pc - the instance to detach
Returns:
the detached instance
Since:
2.0
See Also:
detachCopyAll(Object[])

detachCopyAll

public java.util.Collection detachCopyAll(java.util.Collection pcs)
Detach the specified objects from the PersistenceManager.

Specified by:
detachCopyAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances to detach
Returns:
the detached instances
Since:
2.0
See Also:
detachCopyAll(Object[])

detachCopyAll

public java.lang.Object[] detachCopyAll(java.lang.Object[] pcs)
Detach the specified objects from the 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.

Specified by:
detachCopyAll in interface javax.jdo.PersistenceManager
Parameters:
pcs - the instances to detach
Returns:
the detached instances
Throws:
javax.jdo.JDOUserException - if any of the instances do not
Since:
2.0
See Also:
attachCopyAll(Object[], boolean), getFetchPlan()

attachCopy

public java.lang.Object attachCopy(java.lang.Object pc,
                                   boolean makeTransactional)
Import the specified object into the PersistenceManager.

Parameters:
pc - instance to import
makeTransactional - if true, this method will mark transactional the persistent instances corresponding to all instances in the closure of the detached graph.
Returns:
the re-attached instance
Since:
2.0
See Also:
attachCopyAll(Object[],boolean)

attachCopyAll

public java.util.Collection attachCopyAll(java.util.Collection pcs,
                                          boolean makeTransactional)
Import the specified objects into the PersistenceManager.

Parameters:
pcs - Collection of instances to import
makeTransactional - if true, this method will mark transactional the persistent instances corresponding to all instances in the closure of the detached graph.
Returns:
the re-attached instances
Since:
2.0
See Also:
attachCopyAll(Object[],boolean)

attachCopyAll

public java.lang.Object[] attachCopyAll(java.lang.Object[] pcs,
                                        boolean makeTransactional)
Import the specified objects into the 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.

Parameters:
pcs - array of instances to import
makeTransactional - if true, this method will mark transactional the persistent instances corresponding to all instances in the closure of the detached graph.
Returns:
the re-attached instances
Since:
2.0
See Also:
detachCopyAll(Object[])

putUserObject

public java.lang.Object putUserObject(java.lang.Object key,
                                      java.lang.Object val)
Put the specified key-value pair into the map of user objects.

Specified by:
putUserObject in interface javax.jdo.PersistenceManager
Since:
2.0

getUserObject

public java.lang.Object getUserObject(java.lang.Object key)
Get the value for the specified key from the map of user objects.

Specified by:
getUserObject in interface javax.jdo.PersistenceManager
Parameters:
key - the key of the object to be returned
Returns:
the object
Since:
2.0

removeUserObject

public java.lang.Object removeUserObject(java.lang.Object key)
Remove the specified key and its value from the map of user objects.

Specified by:
removeUserObject in interface javax.jdo.PersistenceManager
Parameters:
key - the key of the object to be removed
Since:
2.0

flush

public void flush()
Flushes all dirty, new, and deleted instances to the data store. It has no effect if a transaction is not active.

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()).

Specified by:
flush in interface javax.jdo.PersistenceManager
Specified by:
flush in interface PersistenceManagerInternal
Since:
2.0

checkConsistency

public void checkConsistency()
Validates the 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.

Specified by:
checkConsistency in interface javax.jdo.PersistenceManager
Since:
2.0

getFetchPlan

public javax.jdo.FetchPlan getFetchPlan()
Returns the FetchPlan used by this PersistenceManager.

Specified by:
getFetchPlan in interface javax.jdo.PersistenceManager
Returns:
the FetchPlan
Since:
2.0

newInstance

public java.lang.Object newInstance(java.lang.Class pcClass)
Creates an instance of a persistence-capable interface or abstract class. The returned instance is transient.

Specified by:
newInstance in interface javax.jdo.PersistenceManager
Parameters:
pcClass - Must be an abstract class or interface that is declared in the metadata.
Returns:
the created instance
Since:
2.0

getSequence

public javax.jdo.datastore.Sequence getSequence(java.lang.String name)
Returns the sequence identified by name.

Specified by:
getSequence in interface javax.jdo.PersistenceManager
Parameters:
name - the name of the Sequence
Returns:
the Sequence
Since:
2.0

getDataStoreConnection

public 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. If called in an optimistic transaction or outside an active transaction, the object returned will not be enlisted in any transaction.

Specified by:
getDataStoreConnection in interface javax.jdo.PersistenceManager
Returns:
the JDOConnection instance
Since:
2.0

addInstanceLifecycleListener

public void addInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener,
                                         java.lang.Class[] classes)
Adds the listener instance to the list of lifecycle event listeners. 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 listenerInstance.

The listenerInstance will be called for each event for which it implements the corresponding listenerInstance interface.

Specified by:
addInstanceLifecycleListener in interface javax.jdo.PersistenceManager
Parameters:
listener - the lifecycle listener
classes - the classes of interest to the listener
Since:
2.0

removeInstanceLifecycleListener

public void removeInstanceLifecycleListener(javax.jdo.listener.InstanceLifecycleListener listener)
Removes the listener instance from the list of lifecycle event listeners.

Specified by:
removeInstanceLifecycleListener in interface javax.jdo.PersistenceManager
Parameters:
listener - the listener instance to be removed
Since:
2.0

getProperties

public java.util.Properties getProperties()
The JDO vendor might store certain non-operational properties and make those properties available to applications (for troubleshooting).

Standard properties include:

  • VendorName
  • VersionNumber
  • Returns:
    the Properties of this PersistenceManager

    assertIsOpen

    public void assertIsOpen()
    assert this PM instance is open

    Specified by:
    assertIsOpen in interface PersistenceManagerInternal

    getStoreManager

    public StoreManager getStoreManager()
    Description copied from interface: PersistenceManagerInternal
    Provides a StoreManager that is ready to accept operations on it.

    Specified by:
    getStoreManager in interface PersistenceManagerInternal
    Returns:
    A StoreManager.
    See Also:
    PersistenceManagerInternal.getStoreManager()

    setStoreManager

    public void setStoreManager(StoreManager storeManager)
    Description copied from interface: PersistenceManagerInternal
    Sets a StoreManager that is ready to accept operations on it such as insert, etc.

    Specified by:
    setStoreManager in interface PersistenceManagerInternal
    Parameters:
    storeManager - the StoreManager to be used by this PersistenceManager
    See Also:
    PersistenceManagerInternal.setStoreManager(StoreManager)

    newSCOInstanceInternal

    public java.lang.Object newSCOInstanceInternal(java.lang.Class type)
    Called by internally by the runtime to create a new tracked instance. Will not result in marking field as dirty

    Specified by:
    newSCOInstanceInternal in interface PersistenceManagerInternal
    Parameters:
    type - Class of the new SCO instance
    Returns:
    the object of the class type
    See Also:
    (Class type)

    newCollectionInstanceInternal

    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)
    Called by internally by the runtime to create a new tracked instance. Will not result in marking field as dirty

    Specified by:
    newCollectionInstanceInternal in interface PersistenceManagerInternal
    See Also:
    PersistenceManagerInternal.newCollectionInstanceInternal(Class type, Class elementType, boolean allowNulls, Integer initialSize, Float loadFactor, Collection initialContents, Comparator comparator)

    newMapInstanceInternal

    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)
    Called by internally by the runtime to create a new tracked instance. Will not result in marking field as dirty.

    Specified by:
    newMapInstanceInternal in interface PersistenceManagerInternal
    See Also:
    PersistenceManagerInternal.newMapInstanceInternal(Class type, Class keyType, Class valueType, boolean allowNulls, Integer initialSize, Float loadFactor, Map initialContents, Comparator comparator)

    isSupportedSCOType

    public boolean isSupportedSCOType(java.lang.Class type)
    Description copied from interface: PersistenceManagerInternal
    Called by StateManager to verify field type.

    Specified by:
    isSupportedSCOType in interface PersistenceManagerInternal
    Parameters:
    type - Class type of the field.
    Returns:
    true if this type is a supported SCO type.
    See Also:
    (Class type)

    register

    public void register(StateManagerInternal sm,
                         java.lang.Object oid,
                         boolean transactional,
                         boolean throwDuplicateException)
    Description copied from interface: PersistenceManagerInternal
    Adds persistent object to the cache.

    Specified by:
    register in interface PersistenceManagerInternal
    Parameters:
    sm - instance of StateManagerInternal to be added
    oid - ObjectId of the corresponding persistence-capable instance
    transactional - true if the corresponding lifecycle state is transactional
    throwDuplicateException - true if the exception should be thrown in case the same ObjectId has been already registered.
    See Also:
    PersistenceManagerInternal.register(StateManagerInternal sm, Object oid, boolean transactional, boolean throwDuplicateException)

    registerTransient

    public void registerTransient(StateManagerInternal sm)
    Description copied from interface: PersistenceManagerInternal
    Adds transient object to the transient cache.

    Specified by:
    registerTransient in interface PersistenceManagerInternal
    Parameters:
    sm - instance of StateManagerInternal to be added
    See Also:
    PersistenceManagerInternal.registerTransient(StateManagerInternal sm)

    deregister

    public void deregister(java.lang.Object oid)
    Description copied from interface: PersistenceManagerInternal
    Removes the object from the cache.

    Specified by:
    deregister in interface PersistenceManagerInternal
    Parameters:
    oid - ObjectId of the instance to be removed.
    See Also:
    PersistenceManagerInternal.deregister(Object oid)

    deregisterTransient

    public void deregisterTransient(StateManagerInternal sm)
    Description copied from interface: PersistenceManagerInternal
    Removes transient object from the transient cache.

    Specified by:
    deregisterTransient in interface PersistenceManagerInternal
    Parameters:
    sm - instance of StateManagerInternal to be removed
    See Also:
    PersistenceManagerInternal.deregisterTransient(StateManagerInternal sm)

    replaceObjectId

    public void replaceObjectId(java.lang.Object oldId,
                                java.lang.Object newId)
    Description copied from interface: PersistenceManagerInternal
    Replaces the objectId key value in the cache.

    Specified by:
    replaceObjectId in interface PersistenceManagerInternal
    Parameters:
    oldId - previous value of ObjectId.
    newId - new value of ObjectId.
    See Also:
    PersistenceManagerInternal.replaceObjectId(Object oldId, Object newId)

    markAsFlushed

    public void markAsFlushed(StateManagerInternal sm)
    Description copied from interface: PersistenceManagerInternal
    Called by StateManagerInternal#markAsFlushed() to adjust transactional cache(s) if necessary after successful flush to the data store.

    Specified by:
    markAsFlushed in interface PersistenceManagerInternal
    Parameters:
    sm - StateManagerInternal instance that has been flushed
    See Also:
    PersistenceManagerInternal.markAsFlushed(StateManagerInternal sm)

    insideCommit

    public boolean insideCommit()
    Description copied from interface: PersistenceManagerInternal
    Returns true if the call initiated as a result of the commit process, versus flush for query in a datastore transaction.

    Specified by:
    insideCommit in interface PersistenceManagerInternal
    Returns:
    true if commit has started
    See Also:
    PersistenceManagerInternal.insideCommit()

    hereIsStateManager

    public 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

    Specified by:
    hereIsStateManager in interface PersistenceManagerInternal
    Parameters:
    pc - PC instance
    sm - StateManager to save

    getStateManager

    public StateManagerInternal getStateManager(java.lang.Object oid,
                                                java.lang.Class pcClass)
    Description copied from interface: PersistenceManagerInternal
    Provides a StateManagerInternal for the given Object Id.

    Specified by:
    getStateManager in interface PersistenceManagerInternal
    Parameters:
    oid - the given Object Id.
    pcClass - Class of a PersistenceCapable instance to be created if this Object Id was not registered with this PersistenceManager.
    Returns:
    A StateManagerInternal.
    See Also:
    PersistenceManagerInternal.getStateManager(java.lang.Object, java.lang.Class)

    findStateManager

    public StateManagerInternal findStateManager(javax.jdo.spi.PersistenceCapable pc)
    A helper method to find the StateManager associated with this PC instance

    Specified by:
    findStateManager in interface PersistenceManagerInternal
    Parameters:
    pc - PC instance
    Returns:
    StateManager as StateManagerInternal

    getCurrentWrapper

    public javax.jdo.PersistenceManager getCurrentWrapper()
    Returns current wrapper

    Specified by:
    getCurrentWrapper in interface PersistenceManagerInternal

    getInsertedInstances

    public 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. Called by the Extent.iterator.

    Specified by:
    getInsertedInstances in interface PersistenceManagerInternal
    Returns:
    Collection of Persistent-New instances.
    See Also:
    PersistenceManagerInternal.getInsertedInstances()

    hashCode

    public int hashCode()
    Returns a hash code value for this PersistenceManager.

    Overrides:
    hashCode in class java.lang.Object
    Returns:
    a hash code value for this PersistenceManager.

    equals

    public boolean equals(java.lang.Object obj)
    Indicates whether some other object is "equal to" this one.

    Overrides:
    equals in class java.lang.Object
    Parameters:
    obj - the reference object with which to compare.
    Returns:
    true if this object is the same as the obj argument; false otherwise.

    pushCurrentWrapper

    protected void pushCurrentWrapper(PersistenceManagerWrapper pmw)
    Remember the current wrapper


    popCurrentWrapper

    protected void popCurrentWrapper(PersistenceManagerWrapper prev)
    Replace current wrapper with the previous


    setJTATransaction

    protected void setJTATransaction(java.lang.Object t)
    with the current thread in the managed environment


    deregisterJTA

    protected void deregisterJTA()
    Disassociate this PersistenceManager with the current JTA transaction.


    forceClose

    protected void forceClose()
    Close this persistence manager even if there are open wrappers or an uncomplete transaction. Called by transaction completion in case of an inconsistent state or as a part of a normal close process.


    verify

    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


    flushInstances

    protected void flushInstances()
    Called by Transaction commit() Loops through transactional cache and calls PersistentStore.updatePersistent() on each instance


    afterCompletion

    protected void afterCompletion(int status)
    Called by Transaction commit() or rollback() cleans up transactional cache

    Parameters:
    status - javax.transaction.Status

    notifyStatusChange

    protected void notifyStatusChange(boolean isActive)
    For Transaction to notify PersistenceManager that status is changed


    notifyOptimistic

    protected void notifyOptimistic(boolean optimistic)
    For Transaction to notify PersistenceManager that optimistic flag is changed


    getContextClassLoaderPrivileged

    public java.lang.ClassLoader getContextClassLoaderPrivileged()
                                                          throws java.lang.SecurityException
    Calls getContextClassLoader for the current Thread in a doPrivileged block.

    Returns:
    the context class loader of the current Thread
    Throws:
    java.lang.SecurityException - thrown by getContextClassLoader.

    assertReadAllowed

    public void assertReadAllowed()
    Assert the NontransactionalRead flag is true or a transaction is active.

    Specified by:
    assertReadAllowed in interface PersistenceManagerInternal


    Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.