org.exolab.castor.persist
Interface DepositBox

All Known Implementing Classes:
ObjectLock

public interface DepositBox

DepositBox is an interface for ClassMolder to access the dirty checking cache of an object.

Checking for accessMode will be done to each access of the DepositBox. Only if a transaction has write access may setObject() or IllegalArgumentException will be thrown.

Only if a transaction with read or write access may call getObject(). Multiple transactions may own read access of the same DespositBox at the same time. Only one transaction may own write access at any given time.

Every time setObject() is called, the internal timestamp will be updated.

Author:
Thomas Yip

Method Summary
 java.lang.Object[] getObject(TransactionContext tx)
          Get the object from the DespositBox, only the transaction have the read or write lock can get it.
 OID getOID()
          Get the object's OID.
 long getVersion()
           
 void setObject(TransactionContext tx, java.lang.Object[] object, long version)
          Set an object into the DespositBox, only a transaction has the write lock may call it method or IllegalArgumentException will be thrown.
 void setVersion(long version)
          Sets the new version of this object.
 

Method Detail

getOID

OID getOID()
Get the object's OID.

Returns:
the object's OID.

setObject

void setObject(TransactionContext tx,
               java.lang.Object[] object,
               long version)
Set an object into the DespositBox, only a transaction has the write lock may call it method or IllegalArgumentException will be thrown.

Parameters:
tx - the transaction in action
object - to be store into deposit box
version - of the object to be stored

getObject

java.lang.Object[] getObject(TransactionContext tx)
Get the object from the DespositBox, only the transaction have the read or write lock can get it.

Parameters:
tx - the transaction in action
Returns:
An object instance.

getVersion

long getVersion()
Returns:
the version (a timestamp) of the last setObject(object) call.

setVersion

void setVersion(long version)
Sets the new version of this object.

Parameters:
version - a timestamp.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com