FileDocCategorySizeDatePackage
IdentityMapAccessor.javaAPI DocGlassfish v2 API37044Thu Jul 19 11:51:58 BST 2007oracle.toplink.essentials.internal.sessions

IdentityMapAccessor

public class IdentityMapAccessor extends Object implements IdentityMapAccessor, Serializable
INTERNAL: Internal subclass that provides access to identity maps through the session. Implements the IdentityMapAccessor interface which provides all publicly available identity map functionality to users. This is the main class that should be used to access identity maps. In general, any function that accesses the identity map manager should go through this class Any session specific functionality appears in subclasses

Fields Summary
protected IdentityMapManager
identityMapManager
This is the identity map manager for this accessor. It should only be accessed through the getter
protected AbstractSession
session
Constructors Summary
public IdentityMapAccessor(AbstractSession session, IdentityMapManager identityMapManager)
INTERNAL: An IdentityMapAccessor sits between the session and the identityMapManager It needs references in both directions


                         
         
        this.session = session;
        this.identityMapManager = identityMapManager;
    
Methods Summary
public oracle.toplink.essentials.internal.identitymaps.CacheKeyacquireDeferredLock(java.util.Vector primarKey, java.lang.Class javaClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Deferred lock the identity map for the object, this is used for avoiding deadlock The return cacheKey should be used to release the deferred lock

        return getIdentityMapManager().acquireDeferredLock(primarKey, javaClass, descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.CacheKeyacquireLock(java.util.Vector primarKey, java.lang.Class javaClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Lock the identity map for the object, this must be done when building objects. The return cacheKey should be used to release the lock

        return acquireLock(primarKey, javaClass, false, descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.CacheKeyacquireLock(java.util.Vector primaryKey, java.lang.Class domainClass, boolean forMerge, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Provides access for setting a concurrency lock on an object in the IdentityMap. called with true from the merge process, if true then the refresh will not refresh the object

see
IdentityMap#aquire

        return getIdentityMapManager().acquireLock(primaryKey, domainClass, forMerge, descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.CacheKeyacquireLockNoWait(java.util.Vector primaryKey, java.lang.Class domainClass, boolean forMerge, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Provides access for setting a concurrency lock on an object in the IdentityMap. called with true from the merge process, if true then the refresh will not refresh the object

see
IdentityMap#aquire

        return getIdentityMapManager().acquireLockNoWait(primaryKey, domainClass, forMerge, descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.CacheKeyacquireReadLockOnCacheKey(java.util.Vector primaryKey, java.lang.Class domainClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Find the cachekey for the provided primary key and place a readlock on it. This will allow multiple users to read the same object but prevent writes to the object while the read lock is held.

        return getIdentityMapManager().acquireReadLockOnCacheKey(primaryKey, domainClass, descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.CacheKeyacquireReadLockOnCacheKeyNoWait(java.util.Vector primaryKey, java.lang.Class domainClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Find the cachekey for the provided primary key and place a readlock on it. This will allow multiple users to read the same object but prevent writes to the object while the read lock is held. If no readlock can be acquired then do not wait but return null.

        return getIdentityMapManager().acquireReadLockOnCacheKeyNoWait(primaryKey, domainClass, descriptor);
    
public booleanacquireWriteLock()
INTERNAL: Lock the entire cache if the cache isolation requires. By default concurrent reads and writes are allowed. By write, unit of work merge is meant.

        return getIdentityMapManager().acquireWriteLock();
    
public voidclearQueryCache(oracle.toplink.essentials.queryframework.ReadQuery query)
ADVANCED: Clear the query class associated with the passed-in read query

        getIdentityMapManager().clearQueryCache(query);
    
public voidclearQueryCache(java.lang.String sessionQueryName)
ADVANCED: Clear the query cache associated with the named query on the session

        getIdentityMapManager().clearQueryCache((ReadQuery)session.getQuery(sessionQueryName));
    
public voidclearQueryCache(java.lang.String descriptorQueryName, java.lang.Class queryClass)
ADVANCED: Clear the query cache associated with the named query on the descriptor for the given class

        getIdentityMapManager().clearQueryCache((ReadQuery)session.getDescriptor(queryClass).getQueryManager().getQuery(descriptorQueryName));
    
public voidclearQueryCache()
ADVANCED: Clear all the query caches

        getIdentityMapManager().clearQueryCache();
    
public booleancontainsKey(java.util.Vector key, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Return whether the identity maps contain an item of the given class and key

        return getIdentityMapManager().containsKey(key, theClass, descriptor);
    
public booleancontainsObjectInIdentityMap(java.lang.Object object)
ADVANCED: Return if their is an object for the primary key.

        return containsObjectInIdentityMap(getSession().keyFromObject(object), object.getClass());
    
public booleancontainsObjectInIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass)
ADVANCED: Return if their is an object for the primary key.

        ClassDescriptor descriptor = getSession().getDescriptor(theClass);
        return containsObjectInIdentityMap(primaryKey, theClass, descriptor);
    
public booleancontainsObjectInIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Return if their is an object for the primary key.

        return getIdentityMapManager().containsKey(primaryKey, theClass, descriptor);
    
public booleancontainsObjectInIdentityMap(oracle.toplink.essentials.sessions.Record rowContainingPrimaryKey, java.lang.Class theClass)
ADVANCED: Return if their is an object for the row containing primary key and the class.

        return containsObjectInIdentityMap(extractPrimaryKeyFromRow(rowContainingPrimaryKey, theClass), theClass);
    
protected java.util.VectorextractPrimaryKeyFromRow(oracle.toplink.essentials.sessions.Record rowContainingPrimaryKey, java.lang.Class theClass)
INTERNAL: Extract primary key from a row

param
DatabaseRow to extract primary key from
param
Class
return
Vector primary key

        return this.session.getDescriptor(theClass).getObjectBuilder().extractPrimaryKeyFromRow((AbstractRecord)rowContainingPrimaryKey, this.session);
    
public java.util.VectorgetAllFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow)
ADVANCED: Query the cache in-memory. If the expression is too complex an exception will be thrown.

        return getAllFromIdentityMap(selectionCriteria, theClass, translationRow, new InMemoryQueryIndirectionPolicy());
    
public java.util.VectorgetAllFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow, oracle.toplink.essentials.queryframework.InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean shouldReturnInvalidatedObjects)
ADVANCED: Query the cache in-memory. If the expression is too complex an exception will be thrown. Only return objects that are invalid in the cache if specified.

        return getIdentityMapManager().getAllFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, shouldReturnInvalidatedObjects);
    
public java.util.VectorgetAllFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow, oracle.toplink.essentials.queryframework.InMemoryQueryIndirectionPolicy valueHolderPolicy)
ADVANCED: Query the cache in-memory. If the expression is too complex an exception will be thrown.

        return getAllFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, true);
    
public oracle.toplink.essentials.internal.identitymaps.CacheKeygetCacheKeyForObject(java.lang.Object object, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Retrieve the cache key for the given object from the identity maps

param
Object object the object to get the cache key for
return
CacheKey

        return getCacheKeyForObject(getSession().keyFromObject(object, descriptor), object.getClass(), descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.CacheKeygetCacheKeyForObject(java.util.Vector primaryKey, java.lang.Class myClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Retrieve the cache key for the given identity information

param
Vector the primary key of the cache key to be retrieved
param
Class the class of the cache key to be retrieved
return
CacheKey

        return getIdentityMapManager().getCacheKeyForObject(primaryKey, myClass, descriptor);
    
public java.util.VectorgetClassesRegistered()
INTERNAL: This method is used to get a list of those classes with IdentityMaps in the Session.

        return getIdentityMapManager().getClassesRegistered();
    
public java.lang.ObjectgetFromIdentityMap(java.lang.Object object)
ADVANCED: Return the object from the identity with primary and class of the given object.

        return getFromIdentityMap(getSession().keyFromObject(object), object.getClass());
    
public java.lang.ObjectgetFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass)
ADVANCED: Return the object from the identity with the primary and class.

        return getFromIdentityMap(primaryKey, theClass, true);
    
public java.lang.ObjectgetFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor, oracle.toplink.essentials.internal.queryframework.JoinedAttributeManager joinedAttributeManager)
INTERNAL: Return the object from the identity with the primary and class.

        return getFromIdentityMap(primaryKey, theClass, true, descriptor, joinedAttributeManager);
    
public java.lang.ObjectgetFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects)
ADVANCED: Return the object from the identity with the primary and class. Only return invalidated objects if requested.

        return getFromIdentityMap(primaryKey, theClass, shouldReturnInvalidatedObjects, getSession().getDescriptor(theClass), null);
    
public java.lang.ObjectgetFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor, oracle.toplink.essentials.internal.queryframework.JoinedAttributeManager joinedAttributeManager)
INTERNAL: Return the object from the identity with the primary and class. Only return invalidated objects if requested.

        return getIdentityMapManager().getFromIdentityMap(primaryKey, theClass, shouldReturnInvalidatedObjects, descriptor);
    
public java.lang.ObjectgetFromIdentityMap(oracle.toplink.essentials.sessions.Record rowContainingPrimaryKey, java.lang.Class theClass)
ADVANCED: Return the object from the identity with the primary and class.

        return getFromIdentityMap(extractPrimaryKeyFromRow((AbstractRecord)rowContainingPrimaryKey, theClass), theClass);
    
public java.lang.ObjectgetFromIdentityMap(oracle.toplink.essentials.sessions.Record rowContainingPrimaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects)
ADVANCED: Return the object from the identity with the primary and class. Only return invalidated objects if requested.

        return getFromIdentityMap(extractPrimaryKeyFromRow((AbstractRecord)rowContainingPrimaryKey, theClass), theClass, shouldReturnInvalidatedObjects);
    
public java.lang.ObjectgetFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow)
ADVANCED: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

        return getFromIdentityMap(selectionCriteria, theClass, translationRow, new InMemoryQueryIndirectionPolicy());
    
public java.lang.ObjectgetFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow, oracle.toplink.essentials.queryframework.InMemoryQueryIndirectionPolicy valueHolderPolicy)
ADVANCED: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

        return getFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, false);
    
public java.lang.ObjectgetFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow, oracle.toplink.essentials.queryframework.InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean conforming)
INTERNAL: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

        return getFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, conforming, true, getSession().getDescriptor(theClass));
    
public java.lang.ObjectgetFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow, oracle.toplink.essentials.queryframework.InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean conforming, boolean shouldReturnInvalidatedObjects)
INTERNAL: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

        return getFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, conforming, shouldReturnInvalidatedObjects, getSession().getDescriptor(theClass));
    
public java.lang.ObjectgetFromIdentityMap(oracle.toplink.essentials.expressions.Expression selectionCriteria, java.lang.Class theClass, oracle.toplink.essentials.sessions.Record translationRow, oracle.toplink.essentials.queryframework.InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean conforming, boolean shouldReturnInvalidatedObjects, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

        return getIdentityMapManager().getFromIdentityMap(selectionCriteria, theClass, translationRow, valueHolderPolicy, conforming, shouldReturnInvalidatedObjects, descriptor);
    
public java.lang.ObjectgetFromIdentityMapWithDeferredLock(java.util.Vector primaryKey, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Return the object from the identity with the primary and class.

        return getFromIdentityMapWithDeferredLock(primaryKey, theClass, true, descriptor);
    
public java.lang.ObjectgetFromIdentityMapWithDeferredLock(java.util.Vector primaryKey, java.lang.Class theClass, boolean shouldReturnInvalidatedObjects, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Return the object from the identity with the primary and class. Only return invalidated objects if requested

        return getIdentityMapManager().getFromIdentityMapWithDeferredLock(primaryKey, theClass, shouldReturnInvalidatedObjects, descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.IdentityMapgetIdentityMap(java.lang.Class theClass)
INTERNAL: Get the identity map for the given class from the IdentityMapManager

        ClassDescriptor descriptor = getSession().getDescriptor(theClass);
        if (descriptor == null) {
            throw ValidationException.missingDescriptor(theClass.toString());
        }
        return this.getIdentityMap(descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.IdentityMapgetIdentityMap(oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Get the identity map for the given class from the IdentityMapManager

        return getIdentityMapManager().getIdentityMap(descriptor);
    
public oracle.toplink.essentials.internal.identitymaps.IdentityMapManagergetIdentityMapManager()
INTERNAL: Get the IdentityMapManager for this IdentityMapAccessor This method should be used for all IdentityMapManager access since it may be overridden in sub classes.

        if (session.hasBroker()) {
            return getSession().getBroker().getIdentityMapAccessorInstance().getIdentityMapManager();
        }
        return identityMapManager;
    
public longgetRemainingValidTime(java.lang.Object object)
ADVANCED: Return the remaining life of this object. This method is associated with use of TopLink's cache invalidation feature and returns the difference between the next expiry time of the object and its read time. The method will return 0 for invalidated objects.

        Vector primaryKey = getSession().keyFromObject(object);
        ClassDescriptor descriptor = getSession().getDescriptor(object);
        CacheKey key = getCacheKeyForObject(primaryKey, object.getClass(), descriptor);
        if (key == null) {
            throw QueryException.objectDoesNotExistInCache(object);
        }
        return descriptor.getCacheInvalidationPolicy().getRemainingValidTime(key);
    
public oracle.toplink.essentials.internal.sessions.AbstractSessiongetSession()
INTERNAL: get the session associated with this IdentityMapAccessor

        return session;
    
public java.lang.ObjectgetWrapper(java.util.Vector primaryKey, java.lang.Class theClass)
INTERNAL: Get the wrapper object from the cache key associated with the given primary key, this is used for EJB.

        return getIdentityMapManager().getWrapper(primaryKey, theClass);
    
public oracle.toplink.essentials.internal.helper.WriteLockManagergetWriteLockManager()
INTERNAL: Returns the single write Lock manager for this session

        return getIdentityMapManager().getWriteLockManager();
    
public java.lang.ObjectgetWriteLockValue(java.lang.Object object)
ADVANCED: Extract the write lock value from the identity map.

        return getWriteLockValue(getSession().keyFromObject(object), object.getClass());
    
public java.lang.ObjectgetWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass)
ADVANCED: Extract the write lock value from the identity map.

        return getWriteLockValue(primaryKey, theClass, getSession().getDescriptor(theClass));
    
public java.lang.ObjectgetWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
ADVANCED: Extract the write lock value from the identity map.

        return getIdentityMapManager().getWriteLockValue(primaryKey, theClass, descriptor);
    
public voidinitializeAllIdentityMaps()
PUBLIC: Reset the entire object cache.

NOTE: be careful using this method. This method blows away both this session's and its parents caches, this includes the server cache or any other cache. This throws away any objects that have been read in. Extream caution should be used before doing this because object identity will no longer be maintained for any objects currently read in. This should only be called if the application knows that it no longer has references to object held in the cache.

        getSession().log(SessionLog.FINER, SessionLog.CACHE, "initialize_all_identitymaps");
        getIdentityMapManager().initializeIdentityMaps();
    
public voidinitializeIdentityMap(java.lang.Class theClass)
PUBLIC: Reset the identity map for only the instances of the class. For inheritance the user must make sure that they only use the root class. Caution must be used in doing this to ensure that the objects within the identity map are not referenced from other objects of other classes or from the application.

        getSession().log(SessionLog.FINER, SessionLog.CACHE, "initialize_identitymap", theClass);
        getIdentityMapManager().initializeIdentityMap(theClass);
    
public voidinitializeIdentityMaps()
PUBLIC: Reset the entire local object cache. This throws away any objects that have been read in. Extream caution should be used before doing this because object identity will no longer be maintained for any objects currently read in. This should only be called if the application knows that it no longer has references to object held in the cache.

        getSession().log(SessionLog.FINER, SessionLog.CACHE, "initialize_identitymaps");
        getIdentityMapManager().initializeIdentityMaps();
        getSession().getCommitManager().reinitialize();
    
public oracle.toplink.essentials.internal.identitymaps.CacheKeyinternalPutInIdentityMap(java.lang.Object object, java.util.Vector key, java.lang.Object writeLockValue, long readTime, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used. The readTime may also be included in the cache key as it is constructed. Return the cache-key.

        return getIdentityMapManager().putInIdentityMap(object, key, writeLockValue, readTime, descriptor);
    
public voidinvalidateAll()
ADVANCED: Set all of the objects from all identity maps to be invalid in TopLink's identity maps.

        Enumeration identiyMapClasses = getIdentityMapManager().getIdentityMapClasses();
        
        while (identiyMapClasses.hasMoreElements()) {
            invalidateClass((Class) identiyMapClasses.nextElement());
        }
    
public voidinvalidateClass(java.lang.Class myClass)
ADVANCED: Set all of the objects of a specific class to be invalid in TopLink's identity maps Will set the recurse on inheritance to true.

        invalidateClass(myClass, true);
    
public voidinvalidateClass(java.lang.Class myClass, boolean recurse)
ADVANCED: Set all of the objects of a specific class to be invalid in TopLink's identity maps. User can set the recurse flag to false if they do not want to invalidate all the classes within an inheritance tree.

        //forward the call to getIdentityMap locally in case subclasses overload
        IdentityMap identityMap = this.getIdentityMap(myClass);
        synchronized (identityMap) {
            Enumeration keys = identityMap.keys();

            while (keys.hasMoreElements()) {
                CacheKey key = (CacheKey)keys.nextElement();
                Object obj = key.getObject();

                if (recurse || ((obj != null) && obj.getClass().equals(myClass))) {
                    key.setInvalidationState(CacheKey.CACHE_KEY_INVALID);
                }
            }
        }
    
public voidinvalidateObject(java.lang.Object object)
ADVANCED: Set an object to be invalid in the TopLink identity maps. If the object does not exist in the cache, thiss method will return without any action

        invalidateObject(getSession().keyFromObject(object), object.getClass());
    
public voidinvalidateObject(java.util.Vector primaryKey, java.lang.Class theClass)
ADVANCED: Set an object to be invalid in the TopLink identity maps. If the object does not exist in the cache, this method will return without any action

        ClassDescriptor descriptor = getSession().getDescriptor(theClass);
        //forward the call to getCacheKeyForObject locally in case subclasses overload
        CacheKey key = this.getCacheKeyForObject(primaryKey, theClass, descriptor);
        if (key != null) {
            key.setInvalidationState(CacheKey.CACHE_KEY_INVALID);
        }
    
public voidinvalidateObject(oracle.toplink.essentials.sessions.Record rowContainingPrimaryKey, java.lang.Class theClass)
ADVANCED: Set an object to be invalid in the TopLink identity maps. If the object does not exist in the cache, this method will return without any action

        invalidateObject(extractPrimaryKeyFromRow(rowContainingPrimaryKey, theClass), theClass);
    
public voidinvalidateObjects(oracle.toplink.essentials.expressions.Expression selectionCriteria)
ADVANCED: Set all of the objects from the given Expression to be invalid in the TopLink Identity Maps

        invalidateObjects(getAllFromIdentityMap(selectionCriteria, selectionCriteria.getBuilder().getQueryClass(), new DatabaseRecord(1)));
    
public voidinvalidateObjects(java.util.Vector collection)
ADVANCED: Set all of the objects in the given collection to be invalid in the TopLink Identity Maps This method will take no action for any objects in the collection that do not exist in the cache.

        Enumeration enumtr = collection.elements();
        while (enumtr.hasMoreElements()) {
            invalidateObject(enumtr.nextElement());
        }
    
public booleanisValid(java.lang.Object object)
ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise

        return isValid(getSession().keyFromObject(object), object.getClass());
    
public booleanisValid(java.util.Vector primaryKey, java.lang.Class theClass)
ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise

        ClassDescriptor descriptor = getSession().getDescriptor(theClass);
        //forward the call to getCacheKeyForObject locally in case subclasses overload
        CacheKey key = this.getCacheKeyForObject(primaryKey, theClass, descriptor);
        if (key == null) {
            throw QueryException.classPkDoesNotExistInCache(theClass, primaryKey);
        }
        return !descriptor.getCacheInvalidationPolicy().isInvalidated(key, System.currentTimeMillis());
    
public booleanisValid(oracle.toplink.essentials.internal.sessions.AbstractRecord rowContainingPrimaryKey, java.lang.Class theClass)
ADVANCED: Return true if this object is valid in TopLink's identity maps return false otherwise

        return isValid(extractPrimaryKeyFromRow(rowContainingPrimaryKey, theClass), theClass);
    
public voidprintIdentityMap(java.lang.Class businessClass)
PUBLIC: Used to print all the objects in the identity map of the passed in class. The output of this method will be logged to this session's SessionLog at SEVERE level.

        if (getSession().shouldLog(SessionLog.SEVERE, SessionLog.CACHE)) {
            getIdentityMapManager().printIdentityMap(businessClass);
        }
    
public voidprintIdentityMapLocks()
PUBLIC: Used to print all the locks in every identity map in this session. The output of this method will be logged to this session's SessionLog at FINEST level.

        if (getSession().shouldLog(SessionLog.FINEST, SessionLog.CACHE)) {
            getIdentityMapManager().printLocks();
        }
    
public voidprintIdentityMaps()
PUBLIC: Used to print all the objects in every identity map in this session. The output of this method will be logged to this session's SessionLog at SEVERE level.

        if (getSession().shouldLog(SessionLog.SEVERE, SessionLog.CACHE)) {
            getIdentityMapManager().printIdentityMaps();
        }
    
public java.lang.ObjectputInIdentityMap(java.lang.Object object)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.

        return putInIdentityMap(object, getSession().keyFromObject(object));
    
public java.lang.ObjectputInIdentityMap(java.lang.Object object, java.util.Vector key)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.

        return putInIdentityMap(object, key, null);
    
public java.lang.ObjectputInIdentityMap(java.lang.Object object, java.util.Vector key, java.lang.Object writeLockValue)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.

        return putInIdentityMap(object, key, writeLockValue, 0);
    
public java.lang.ObjectputInIdentityMap(java.lang.Object object, java.util.Vector key, java.lang.Object writeLockValue, long readTime)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used. The readTime may also be included in the cache key as it is constructed

        ClassDescriptor descriptor = getSession().getDescriptor(object);
        return putInIdentityMap(object, key, writeLockValue, readTime, descriptor);
    
public java.lang.ObjectputInIdentityMap(java.lang.Object object, java.util.Vector key, java.lang.Object writeLockValue, long readTime, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used. The readTime may also be included in the cache key as it is constructed

        CacheKey cacheKey = internalPutInIdentityMap(object, key, writeLockValue, readTime, descriptor);
        if (cacheKey == null) {
            return null;
        }
        return cacheKey.getObject();
    
public voidreleaseWriteLock()
INTERNAL: Lock the entire cache if the cache isolation requires. By default concurrent reads and writes are allowed. By write, unit of work merge is meant.

        getIdentityMapManager().releaseWriteLock();
    
public java.lang.ObjectremoveFromIdentityMap(java.lang.Object object)
ADVANCED: Remove the object from the object cache. Caution should be used when calling to avoid violating object identity. The application should only call this is it knows that no references to the object exist.

        return removeFromIdentityMap(getSession().keyFromObject(object), object.getClass());
    
public java.lang.ObjectremoveFromIdentityMap(java.util.Vector key, java.lang.Class theClass)
ADVANCED: Remove the object from the object cache.

        ClassDescriptor descriptor = getSession().getDescriptor(theClass);
        return removeFromIdentityMap(key, theClass, descriptor);
    
public java.lang.ObjectremoveFromIdentityMap(java.util.Vector key, java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)
INTERNAL: Remove the object from the object cache.

        return getIdentityMapManager().removeFromIdentityMap(key, theClass, descriptor);
    
public voidsetIdentityMapManager(oracle.toplink.essentials.internal.identitymaps.IdentityMapManager identityMapManager)
INTERNAL: Set the IdentityMapManager for this IdentityMapAccessor

        this.identityMapManager = identityMapManager;
    
public voidsetWrapper(java.util.Vector primaryKey, java.lang.Class theClass, java.lang.Object wrapper)
INTERNAL: Update the wrapper object the cache key associated with the given primary key, this is used for EJB.

        getIdentityMapManager().setWrapper(primaryKey, theClass, wrapper);
    
public voidupdateWriteLockValue(java.lang.Object object, java.lang.Object writeLockValue)
ADVANCED: Update the write lock value in the identity map.

        updateWriteLockValue(getSession().keyFromObject(object), object.getClass(), writeLockValue);
    
public voidupdateWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass, java.lang.Object writeLockValue)
ADVANCED: Update the write lock value in the identity map.

        getIdentityMapManager().setWriteLockValue(primaryKey, theClass, writeLockValue);
    
public voidvalidateCache()
INTERNAL: This can be used to help debugging an object identity problem. An object identity problem is when an object in the cache references an object not in the cache. This method will validate that all cached objects are in a correct state.

        //pass certain calls to this in order to allow subclasses to implement own behaviour
        getSession().log(SessionLog.FINER, SessionLog.CACHE, "validate_cache");
        // This define an inner class for process the itteration operation, don't be scared, its just an inner class.
        DescriptorIterator iterator = new DescriptorIterator() {
            public void iterate(Object object) {
                if (!containsObjectInIdentityMap(IdentityMapAccessor.this.session.getDescriptor(object.getClass()).getObjectBuilder().extractPrimaryKeyFromObject(object, IdentityMapAccessor.this.getSession()), object.getClass())) {
                    IdentityMapAccessor.this.session.log(SessionLog.FINEST, SessionLog.CACHE, "stack_of_visited_objects_that_refer_to_the_corrupt_object", getVisitedStack());
                    IdentityMapAccessor.this.session.log(SessionLog.FINER, SessionLog.CACHE, "corrupt_object_referenced_through_mapping", getCurrentMapping());
                    IdentityMapAccessor.this.session.log(SessionLog.FINER, SessionLog.CACHE, "corrupt_object", object);
                }
            }
        };

        iterator.setSession(getSession());
        Iterator descriptors = getSession().getDescriptors().values().iterator();
        while (descriptors.hasNext()) {
            ClassDescriptor descriptor = (ClassDescriptor)descriptors.next();
            for (Enumeration mapEnum = getIdentityMap(descriptor).elements();
                     mapEnum.hasMoreElements();) {
                iterator.startIterationOn(mapEnum.nextElement());
            }
        }