org.vrspace.server
Class Transaction

java.lang.Object
  extended byjava.util.Observable
      extended byorg.vrspace.server.VRObject
          extended byorg.vrspace.server.DBObject
              extended byorg.vrspace.server.PassiveDBObject
                  extended byorg.vrspace.server.Transaction
All Implemented Interfaces:
java.lang.Cloneable, java.util.Observer

public class Transaction
extends PassiveDBObject
implements java.util.Observer

Transacton: collects request from a client. Caches all objects. Able of rollback, rollforward, isolation... PassiveDBObject: can be stored to database, cannot send nor receive network events.


Field Summary
static int LAST_COMMITED
           
static int LOCK_CLASS
           
static int LOCK_OBJECT
           
 
Fields inherited from class org.vrspace.server.DBObject
db
 
Fields inherited from class org.vrspace.server.VRObject
db_id, primitiveMap, primitives
 
Constructor Summary
Transaction()
           
 
Method Summary
 void commit()
          Commit
 void rollback()
          Rollback a transaction.
 void rollforward()
          Rollforward - reply each request.
 void start(Client c)
          Start a transaction with LAST_COMMITED lock level (no locking)
 void start(Client c, int level)
          Start a transaciton.
 void update(java.util.Observable obs, java.lang.Object req)
          Process a request from client.
 
Methods inherited from class org.vrspace.server.PassiveDBObject
sendEvent
 
Methods inherited from class org.vrspace.server.DBObject
delete, get, put, put
 
Methods inherited from class org.vrspace.server.VRObject
arrayToString, canRead, canWrite, clone, equals, fieldToText, fromString, fromText, getClassName, getField, getFields, getId, getID, getMemebers, hasField, hasMethod, isNew, newInstance, sendResponse, setField, setField, setField, setFields, setFields, setValue, stringToArray, toString, toText, toText, toText
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LAST_COMMITED

public static final int LAST_COMMITED
See Also:
Constant Field Values

LOCK_CLASS

public static final int LOCK_CLASS
See Also:
Constant Field Values

LOCK_OBJECT

public static final int LOCK_OBJECT
See Also:
Constant Field Values
Constructor Detail

Transaction

public Transaction()
Method Detail

start

public void start(Client c)
Start a transaction with LAST_COMMITED lock level (no locking)


start

public void start(Client c,
                  int level)
Start a transaciton. Starts listening to all changes that client made.

Parameters:
level - LOCK_CLASS, LOCK_RECORD, LAST_COMMITED

update

public void update(java.util.Observable obs,
                   java.lang.Object req)
Process a request from client. Request is allready processed by Dispatcher and validated. Called by Client.
With LOCK_OBJECT or LOCK_CLASS isolation level, it means that object was not locked before.

Specified by:
update in interface java.util.Observer

commit

public void commit()
Commit


rollback

public void rollback()
Rollback a transaction. Calls VRObject.sendEvent() to set each field value, so rollback may be distributed.


rollforward

public void rollforward()
Rollforward - reply each request. Calls VRObject.sendEvent().
This does not lock or unlock objects or classes