org.apache.jdo.pm
Interface PersistenceManagerInternal

All Superinterfaces:
javax.jdo.PersistenceManager
All Known Implementing Classes:
PersistenceManagerImpl

public interface PersistenceManagerInternal
extends javax.jdo.PersistenceManager

Extends the PersistenceManager interface for JDO-internal use. Provides additional information and helper methods for StateManagerInternal interaction with the cache.

Author:
Marina Vatkina

Method Summary
 void assertIsOpen()
          assert this PM instance is open
 void assertReadAllowed()
          assert that the NontransactionalRead flag is true or a transaction is active.
 void deregister(java.lang.Object oid)
          Removes the object from the cache.
 void deregisterTransient(StateManagerInternal sm)
          Removes transient object from the transient cache.
 StateManagerInternal findStateManager(javax.jdo.spi.PersistenceCapable pc)
          Finds a StateManagerInternal for the given PersistenceCapable object.
 void flush()
          Called by Query or Extent to flush updates to the database in a datastore transaction.
 javax.jdo.PersistenceManager getCurrentWrapper()
          Returns current instance of PersistenceManager wrapper
 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)
          Provides an object id for the given PersistenceCapable.
 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.
 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 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 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 internally by the runtime to create a new tracked instance of type Collection.
 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 internally by the runtime to create a new tracked instance of type Map.
 java.lang.Object newSCOInstanceInternal(java.lang.Class type)
          Called internally by the runtime to create a new tracked instance.
 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 replaceObjectId(java.lang.Object oldId, java.lang.Object newId)
          Replaces the objectId key value in the cache.
 void setStoreManager(StoreManager storeManager)
          Sets a StoreManager that is ready to accept operations on it such as insert, etc.
 
Methods inherited from interface javax.jdo.PersistenceManager
addInstanceLifecycleListener, checkConsistency, close, currentTransaction, deletePersistent, deletePersistentAll, deletePersistentAll, detachCopy, detachCopyAll, detachCopyAll, evict, evictAll, evictAll, evictAll, getDataStoreConnection, getDetachAllOnCommit, getExtent, getExtent, getFetchPlan, getIgnoreCache, getMultithreaded, getObjectById, getObjectById, getObjectById, getObjectId, getObjectIdClass, getObjectsById, getObjectsById, getObjectsById, getObjectsById, getPersistenceManagerFactory, getSequence, getTransactionalObjectId, getUserObject, getUserObject, isClosed, makeNontransactional, makeNontransactionalAll, makeNontransactionalAll, makePersistent, makePersistentAll, makePersistentAll, makeTransactional, makeTransactionalAll, makeTransactionalAll, makeTransient, makeTransient, makeTransientAll, makeTransientAll, makeTransientAll, makeTransientAll, newInstance, newNamedQuery, newObjectIdInstance, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, putUserObject, refresh, refreshAll, refreshAll, refreshAll, refreshAll, removeInstanceLifecycleListener, removeUserObject, retrieve, retrieve, retrieveAll, retrieveAll, retrieveAll, retrieveAll, setDetachAllOnCommit, setIgnoreCache, setMultithreaded, setUserObject
 

Method Detail

assertIsOpen

public void assertIsOpen()
assert this PM instance is open


assertReadAllowed

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


getStoreManager

public StoreManager getStoreManager()
Provides a StoreManager that is ready to accept operations on it.

Returns:
A StoreManager.

setStoreManager

public void setStoreManager(StoreManager storeManager)
Sets a StoreManager that is ready to accept operations on it such as insert, etc.

Parameters:
storeManager - the StoreManager to be used by this PersistenceManager

getStateManager

public StateManagerInternal getStateManager(java.lang.Object oid,
                                            java.lang.Class pcClass)
Provides a StateManagerInternal for the given Object Id.

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.

findStateManager

public StateManagerInternal findStateManager(javax.jdo.spi.PersistenceCapable pc)
Finds a StateManagerInternal for the given PersistenceCapable object. Validates PersistenceManager associated with this PersistenceCapable object.

Parameters:
pc - the given PersistenceCapable object.
Returns:
A StateManagerInternal.

loadClass

public java.lang.Class loadClass(java.lang.String name,
                                 java.lang.ClassLoader given)
                          throws java.lang.ClassNotFoundException
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: 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.

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.

loadPCClassForObjectIdClass

public java.lang.Class loadPCClassForObjectIdClass(java.lang.Class objectIdClass)
                                            throws java.lang.ClassNotFoundException
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 loadClass(java.lang.String, java.lang.ClassLoader): The method returns the top most persistence-capable class in the case of an inheritance hierachy.

Throws:
java.lang.ClassNotFoundException

getInternalObjectId

public java.lang.Object getInternalObjectId(java.lang.Object pc)
Provides an object id for the given PersistenceCapable. The object id must not be given to user/client code.


register

public void register(StateManagerInternal sm,
                     java.lang.Object oid,
                     boolean transactional,
                     boolean throwDuplicateException)
Adds persistent object to the cache.

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.

registerTransient

public void registerTransient(StateManagerInternal sm)
Adds transient object to the transient cache.

Parameters:
sm - instance of StateManagerInternal to be added

deregister

public void deregister(java.lang.Object oid)
Removes the object from the cache.

Parameters:
oid - ObjectId of the instance to be removed.

deregisterTransient

public void deregisterTransient(StateManagerInternal sm)
Removes transient object from the transient cache.

Parameters:
sm - instance of StateManagerInternal to be removed

replaceObjectId

public void replaceObjectId(java.lang.Object oldId,
                            java.lang.Object newId)
Replaces the objectId key value in the cache.

Parameters:
oldId - previous value of ObjectId.
newId - new value of ObjectId.

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

Parameters:
pc - PC instance
sm - StateManager to save

markAsFlushed

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

Parameters:
sm - StateManagerInternal instance that has been flushed

insideCommit

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

Returns:
true if commit has started

newSCOInstanceInternal

public java.lang.Object newSCOInstanceInternal(java.lang.Class type)
Called internally by the runtime to create a new tracked instance. Will not result in marking field as dirty Returns a new Second Class Object instance of the type java.uti.Date, or supported subclass.

Parameters:
type - Class of the new SCO instance
Returns:
the object of the 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 internally by the runtime to create a new tracked instance of type Collection. Will not result in marking field as dirty


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


isSupportedSCOType

public boolean isSupportedSCOType(java.lang.Class type)
Called by StateManager to verify field type.

Parameters:
type - Class type of the field.
Returns:
true if this type is a supported SCO type.

flush

public void flush()
Called by Query or Extent to flush updates to the database in a datastore transaction. It is up to the StoreManager to decide at what point of the processing to call this method. No validation of the transaction type is performed.

Specified by:
flush in interface javax.jdo.PersistenceManager
Throws:
JDOUserException - if current transaction is not active.

getCurrentWrapper

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


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.

Returns:
Collection of Persistent-New instances.


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