org.exolab.castor.persist
public class ClassMolder extends Object
Beside loading, ClassMolder is also repsonsible for storing, removing, creating an object to and from a persistence storage, as well as reverting an object to previous state.
Each instance of ClassMolder deals with exactly one persistable type, interacts with one instance of Persistent and belongs to one LockEngine.
Field Summary | |
---|---|
boolean | resolversHaveBeenReset |
boolean | _isKeyGenUsed
Is a key kenerator used for the base class? |
Constructor Summary | |
---|---|
ClassMolder(DatingService ds, MappingLoader loader, LockEngine lock, ClassDescriptor clsDesc, Persistence persist)
Creates an instance of this class. |
Method Summary | |
---|---|
void | addDependent(ClassMolder dep)
Mutator method to add a dependent ClassMolder
|
void | addExtendent(ClassMolder ext)
Mutator method to add a extent ClassMolder
|
Object | create(TransactionContext tx, OID oid, DepositBox locker, Object object)
Create an object of the base class with specified identity into the persistence storage.
|
void | delete(TransactionContext tx, OID oid)
Delete an object of the base type from the persistence storage.
|
void | expireCache(TransactionContext tx, ObjectLock locker)
Inspect the fields stored in the object passed as an argument for
contained objects. |
AccessMode | getAccessMode(AccessMode txMode)
Get the effective accessMode of the the base type
|
Object | getActualIdentity(TransactionContext tx, Object o)
Get the identity from a object of the base type
|
Object | getActualIdentity(ClassLoader loader, Object o)
Get the identity from a object of the base type
|
int | getCacheParam()
Return the preferred LRU cache capacity for caching object of this type
|
String | getCacheType()
Return the preferred LRU cache mechanism for caching object of this type
|
CallbackInterceptor | getCallback()
Get the callback interceptor of the base type
|
ClassMolder | getDepends()
Get the depends class' ClassMolder |
ClassMolder | getExtends()
Get the extends class' ClassMolder
|
FieldMolder[] | getFields()
Get the FieldMolder of the fields of the base type,
except the identity fields. |
Object | getIdentity(TransactionContext tx, Object o)
Get the identity from a object of the base type
If object isn't persistent and key generator is used, returns null
|
FieldMolder[] | getIds()
Get the FieldMolders of the identity fields |
Class | getJavaClass(ClassLoader loader)
Get the base class of this ClassMolder given a ClassLoader |
LockEngine | getLockEngine()
Get the LockEngine which this ClassMolder belongs to.
|
String | getName()
Get the fully qualified name of the base type of this ClassMolder
|
Persistence | getPersistence()
Get the Persisetence of the base type
|
int | getPriority()
Determines the create priority of the data object class represented by
this ClassMolder. |
boolean | isAssignableFrom(Class cls)
check if the current ClassModlder is assignable from the class
instance.
|
boolean | isDefaultIdentity(Object identity)
Test if the specified identity is the default value of the type. |
boolean | isDependent()
Return true if the base type of this ClassMolder is an dependent
class. |
boolean | isKeyGeneratorUsed()
Return true if a key generator is used for the base type of this ClassMolder |
boolean | isKeyGenUsed()
Return true if a key generator is used for the base type of this ClassMolder |
Object | load(TransactionContext tx, OID oid, DepositBox locker, ProposedObject proposedObject, AccessMode suggestedAccessMode)
Load an object with specified identity from the persistent storage.
|
Object | load(TransactionContext tx, OID oid, DepositBox locker, ProposedObject proposedObject, AccessMode suggestedAccessMode, QueryResults results) |
void | markCreate(TransactionContext tx, OID oid, DepositBox locker, Object object)
Walk the object model and mark object that should be created.
|
void | markDelete(TransactionContext tx, OID oid, DepositBox locker, Object object)
Prepare to delete an object with the specified identity. |
Object | newInstance(ClassLoader loader)
Return a new instance of the base class with the provided ClassLoader object
|
boolean | preStore(TransactionContext tx, OID oid, DepositBox locker, Object object, int timeout)
Check the object for modification. |
boolean | removeRelation(TransactionContext tx, Object object, ClassMolder relatedMolder, Object relatedObject)
Remove the reference of a related object from an object of
the base class. |
void | resetResolvers() |
void | revertObject(TransactionContext tx, OID oid, DepositBox locker, Object object)
Revert the object back to the state of begining of the transaction
If the object is loaded, it will be revert as it was loaded. |
void | setDepends(ClassMolder dep)
Mutator method to set the depends ClassMolder
|
void | setExtends(ClassMolder ext)
Mutator method to set the extends ClassMolder
|
void | setFieldsNull(Object object)
Set all persistence fields of object of the base type to null.
|
void | setIdentity(TransactionContext tx, Object object, Object identity)
Set the identity into an object
|
void | setPersistence(Persistence persist)
Mutator method to set the PersistenceEngine of
|
void | store(TransactionContext tx, OID oid, DepositBox locker, Object object)
Store a data object into the persistent storage of the base class of this
ClassMolder.
|
String | toString() |
boolean | update(TransactionContext tx, OID oid, DepositBox locker, Object object, AccessMode suggestedAccessMode)
Update the object which loaded or created in the other transaction to
the persistent storage.
|
void | updateCache(TransactionContext tx, OID oid, DepositBox locker, Object object)
Update the dirty checking cache. |
void | writeLock(TransactionContext tx, OID oid, DepositBox locker, Object object)
Acquire a write lock on an object of the base type with the specified
identity from the persistence storage.
|
Parameters: ds is the helper class for resolving depends and extends relationship among all the ClassMolder in the same LockEngine. loader the mapping loader. lock the lock engine. clsDesc the classDescriptor for the base class. persist the Persistence for the base class.
Throws: ClassNotFoundException If a class cannot be loaded. MappingException if an error occured with analysing the mapping information.
Parameters: tx transaction in action oid the object identity of the object to be created. locker the dirty checking cache of the object object the object to be created
Returns: the identity of the object
Parameters: tx - transaction in action oid - the object identity of the target object
Parameters: tx The org.exolab.castor.persist.TransactionContext locker The object that contains the fields to be inspected
Parameters: txMode - the default transaction accessMode
Returns: the effective acessMode of the base type
Parameters: tx the transaction context o - object of the base type
Returns: return an Object[] which contains the identity of the object
Parameters: loader the current class loader o - object of the base type
Returns: return an Object[] which contains the identity of the object
Parameters: tx the transaction context o - object of the base type
Returns: return an Object[] which contains the identity of the object
Parameters: loader the classloader
Returns: the Class
instance
class
instance.
Parameters: cls the Class to check the assignation
Returns: true if assignable
Parameters: tx the TransactionContext in action oid the object identity of the desired object locker the DepositBox of the object which is used to store the dirty checking cache of the object. suggestedAccessMode the acessMode for the object
Returns: the object stamp for the object in the persistent storage
Parameters: tx transaction in action oid the object identity of the object to be created. locker the dirty checking cache of the object object the object to be created
Parameters: tx - transaction in action oid - object's identity of the target object locker - the dirty checking cache of the target object object - the target object
Parameters: loader the ClassLoader object to use to create a new object
Returns: Object the object reprenseted by this ClassMolder, and instanciated with the provided ClassLoader instance.
Throws: ClassNotFoundException IllegalAccessException InstantiationException
Parameters: tx transaction in action oid the object identity of the object locker the dirty check cache for the object object the data object to be checked timeout timeout of updating the lock if needed
Returns: true if the object is modified
If the related object is PersistanceCapable, the field will be set null. If the related object is a Collection, then the related object will be removed from the Collection.
If any changed occured, transactionContext.markModified will be called, to indicate the object is modified.
It method will iterate thur all of the object's field and try to remove all the occurrence.
Parameters: tx the TransactionContext of the transaction in action object the target object of the base type of this ClassMolder relatedMolder the ClassMolder of the related object to be removed from the object relatedObject the object to be removed
Parameters: tx - transaction in action oid - the object identity of the target object locker - the dirty checking cache of the target object object - the target object
Parameters: object - target object
Parameters: tx the transaction context object the object to set the identity identity the new identity for the object
Parameters: tx Transaction in action oid the object identity of the stored object locker the dirty check cache of the object object the object to be stored
Parameters: tx Transaction in action oid the object identity of the stored object locker the dirty check cache of the object object the object to be stored
Returns: boolean true if the updating object should be created
Parameters: tx - transaction in action oid - object's identity of the target object locker - the dirty checking cache of the target object object - the target object
Parameters: tx - Transaction in action oid - the object identity of the target object locker - the dirty checking cache of the object object - the target object