org.apache.ojb.otm
Interface EditingContext

All Known Implementing Classes:
ConcreteEditingContext

public interface EditingContext

The EditingContext contains and manages the set of object read/edited within the context of a transaction. Logically, this could be considered similar to a document that is being edited. During commit, all objects within this transaction that are marked as being written to (ones with a write lock) are written back to the persistent store.

Author:
Raghu Rajah

Method Summary
 java.util.Collection getAllObjectsInContext()
           
 void insert(Identity oid, java.lang.Object object, int lock)
          Insert the given object into the EditingContext, acquiring the specified lock.
 java.lang.Object lookup(Identity oid)
          Lookup object with the given oid in the Context.
 State lookupState(Identity oid)
          lookup the state of an object, given the oid, in the context
 void remove(Identity oid)
          Remove a managed object from the management of this EditingContext.
 void setState(Identity oid, State state)
           
 

Method Detail

insert

public void insert(Identity oid,
                   java.lang.Object object,
                   int lock)
            throws LockingException
Insert the given object into the EditingContext, acquiring the specified lock.

Parameters:
oid - the identity of the object to be inserted
object - the object to insert
lock - the lock to be acquired.
Throws:
LockingException - thrown by the Lock Manager to avoid deadlocks. The insertion could be re-attempted if the lock fails.

remove

public void remove(Identity oid)
Remove a managed object from the management of this EditingContext. All edits on the object will be lost. All locks kept by this object will be released.

Parameters:
oid - the Identity of the object to be removed from this context.

lookup

public java.lang.Object lookup(Identity oid)
                        throws LockingException
Lookup object with the given oid in the Context.

Parameters:
oid - the oid of the object to lookup
Throws:
LockingException

lookupState

public State lookupState(Identity oid)
                  throws LockingException
lookup the state of an object, given the oid, in the context

Parameters:
oid -
Returns:
the state of that object in the context, null if the object is not in the context
Throws:
LockingException

setState

public void setState(Identity oid,
                     State state)

getAllObjectsInContext

public java.util.Collection getAllObjectsInContext()


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14