org.vrspace.server
Class DBObject

java.lang.Object
  extended byjava.util.Observable
      extended byorg.vrspace.server.VRObject
          extended byorg.vrspace.server.DBObject
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
PassiveDBObject, PrivateDBObject, PublicDBObject

public class DBObject
extends VRObject

DBObject defines methodes for database storage. When processing a request, sets the field value and stores itself into database, if one is specified.


Field Summary
protected  DB db
           
 
Fields inherited from class org.vrspace.server.VRObject
db_id, primitiveMap, primitives
 
Constructor Summary
DBObject()
           
DBObject(DB db)
          This constructor implies autocommit, that is, sendEvent will immediately store changed object into the database.
 
Method Summary
 void delete(DB db)
          Deletes itself from the database.
 java.lang.Object get(DB db, long id)
          Fetches the object having db_id = id from the database db
protected  void put()
          store this into the database
 void put(DB db)
          Stores (insert/update) the object into database db
 void sendEvent(Request r)
          Forwards request r to other clients, listeners added by Dispatcher.
 
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

db

protected DB db
Constructor Detail

DBObject

public DBObject()

DBObject

public DBObject(DB db)
This constructor implies autocommit, that is, sendEvent will immediately store changed object into the database.

Method Detail

put

public void put(DB db)
         throws java.lang.Exception
Stores (insert/update) the object into database db

Throws:
java.lang.Exception

put

protected void put()
store this into the database


get

public java.lang.Object get(DB db,
                            long id)
                     throws java.lang.Exception
Fetches the object having db_id = id from the database db

Throws:
java.lang.Exception

delete

public void delete(DB db)
            throws java.lang.Exception
Deletes itself from the database.

Throws:
java.lang.Exception

sendEvent

public void sendEvent(Request r)
               throws RequestException
Forwards request r to other clients, listeners added by Dispatcher. Sets the field r.eventName to r.eventValue. I field does not exist, forwards event anyway. Stores itself into the database if one is set. Throws RequestException if request target is another object, or if database exception occured. Calls setValue() method which actualy forwards the event.

Overrides:
sendEvent in class VRObject
Throws:
RequestException