org.castor.persist
Class ObjectTracker
public final
class
ObjectTracker
extends Object
A transaction records all objects accessed during the lifetime
of the transaction in this record (queries and created).
This information, stored on a per-object basis within the
ObjectTracker, covers the database engine used
to persist the object, the object's OID, the object itself, and
whether the object has been deleted in this transaction,
created in this transaction.
Sidenote: Objects identified as read only are not updated
when the transaction commits.
Since: 0.9.9
Version: $Revision: 1.2 $ $Date: 2005/07/24 20:37:16 $
Author: Ralf Joachim Werner Guttmann Gregory Block
Method Summary |
String | allObjectStates() |
void | clear() |
LockEngine | getLockEngineForObject(Object o) |
ClassMolder | getMolderForObject(Object o) Retrieve the ClassMolder associated with a specific object. |
Object | getObjectForOID(LockEngine engine, OID oid, boolean allowReadOnly)
Retrieve the object for a given OID.
|
Collection | getObjectsWithCreatingStateSortedByLowestMolderPriority() Retrieve the list of creating objects, sorted in the order they should be
created. |
Collection | getObjectsWithDeletedStateSortedByHighestMolderPriority() Retrieve the list of deleted objects, sorted in the order they should be
deleted. |
Collection | getObjectsWithUpdateCacheNeededState() |
OID | getOIDForObject(Object o) |
Collection | getReadOnlyObjects() Retrieve the list of all read-only objects being tracked. |
Collection | getReadWriteObjects() Retrieve the list of all read-write objects being tracked. |
boolean | isCreated(Object o) |
boolean | isCreating(Object o) |
boolean | isDeleted(Object o) |
boolean | isReadOnly(Object o) |
boolean | isReadWrite(Object object) |
boolean | isTracking(Object object)
Determine whether an object is being tracked within this tracking manager. |
boolean | isUpdateCacheNeeded(Object object) |
boolean | isUpdatePersistNeeded(Object object) |
void | markCreated(Object object) |
void | markCreating(Object object) |
void | markDeleted(Object object) |
void | markReadOnly(Object o) |
void | markUpdateCacheNeeded(Object object) |
void | markUpdatePersistNeeded(Object object) |
String | objectStateToString(Object obj) |
int | readOnlySize() |
int | readWriteSize() |
void | removeOIDForObject(LockEngine engine, OID oid)
For a given lockengine and OID, remove references to an object in the maps.
|
void | setLockEngineForObject(Object obj, LockEngine engine) |
void | setOIDForObject(Object obj, LockEngine engine, OID oid)
For a given lockengine and OID, set the object in the maps. |
void | trackObject(LockEngine engine, ClassMolder molder, OID oid, Object object) |
void | trackOIDChange(Object obj, LockEngine engine, OID oldoid, OID newoid)
Record changes to an OID by re-tracking the OID information. |
void | unmarkAllDeleted() |
void | unmarkDeleted(Object object) |
void | unmarkReadOnly(Object o) |
void | unmarkUpdateCacheNeeded(Object object) |
void | unmarkUpdatePersistNeeded(Object object) |
void | untrackObject(Object object) |
public String allObjectStates()
public void clear()
public
LockEngine getLockEngineForObject(Object o)
Retrieve the ClassMolder associated with a specific object.
public Object getObjectForOID(
LockEngine engine,
OID oid, boolean allowReadOnly)
Retrieve the object for a given OID.
Parameters: allowReadOnly Allow (or ignore, if false) read-only objects to be returned.
Returns: The object associated with this oid.
public Collection getObjectsWithCreatingStateSortedByLowestMolderPriority()
Retrieve the list of creating objects, sorted in the order they should be
created.
public Collection getObjectsWithDeletedStateSortedByHighestMolderPriority()
Retrieve the list of deleted objects, sorted in the order they should be
deleted.
public Collection getObjectsWithUpdateCacheNeededState()
public
OID getOIDForObject(Object o)
public Collection getReadOnlyObjects()
Retrieve the list of all read-only objects being tracked.
public Collection getReadWriteObjects()
Retrieve the list of all read-write objects being tracked.
public boolean isCreated(Object o)
public boolean isCreating(Object o)
public boolean isDeleted(Object o)
public boolean isReadOnly(Object o)
public boolean isReadWrite(Object object)
public boolean isTracking(Object object)
Determine whether an object is being tracked within this tracking manager.
Parameters: object
Returns:
public boolean isUpdateCacheNeeded(Object object)
public boolean isUpdatePersistNeeded(Object object)
public void markCreated(Object object)
public void markCreating(Object object)
public void markDeleted(Object object)
public void markReadOnly(Object o)
public void markUpdateCacheNeeded(Object object)
public void markUpdatePersistNeeded(Object object)
public String objectStateToString(Object obj)
public int readOnlySize()
public int readWriteSize()
For a given lockengine and OID, remove references to an object in the maps.
This eliminates both the engine->oid->object and the object->oid.
Parameters: obj The object to stop tracking on engine The engine to stop tracking the OID for oid The oid of the object to stop tracking on.
public void setLockEngineForObject(Object obj,
LockEngine engine)
public void setOIDForObject(Object obj,
LockEngine engine,
OID oid)
For a given lockengine and OID, set the object in the maps. Note that an OID
can only be accessed via the LockManager which manages it.
Parameters: obj The object to track engine The engine to which the OID belongs oid The OID of the object to track
public void trackOIDChange(Object obj,
LockEngine engine,
OID oldoid,
OID newoid)
Record changes to an OID by re-tracking the OID information. When an object's
OID can change, ensure that the object is retracked.
Parameters: obj The object to record a tracking change for. engine The engine which is responsible for the old and new OID oldoid The old oid. newoid The new oid.
public void unmarkAllDeleted()
public void unmarkDeleted(Object object)
public void unmarkReadOnly(Object o)
public void unmarkUpdateCacheNeeded(Object object)
public void unmarkUpdatePersistNeeded(Object object)
public void untrackObject(Object object)
Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com