org.vrspace.server
Class OwnedDBObject

java.lang.Object
  extended byjava.util.Observable
      extended byorg.vrspace.server.VRObject
          extended byorg.vrspace.server.DBObject
              extended byorg.vrspace.server.PublicDBObject
                  extended byorg.vrspace.server.OwnedDBObject
All Implemented Interfaces:
java.lang.Cloneable, Owned
Direct Known Subclasses:
AuthInfo, Chatroom, Client, File, Item, James, Jetty, JMF, JXTA, Site, Tomcat, Transform

public class OwnedDBObject
extends PublicDBObject
implements Owned

Forwards events to all the listeners, but receives events only from owners.


Field Summary
 
Fields inherited from class org.vrspace.server.DBObject
db
 
Fields inherited from class org.vrspace.server.VRObject
db_id, primitiveMap, primitives
 
Constructor Summary
OwnedDBObject()
           
 
Method Summary
 void addOwner(Owner c)
          Interface Owned
 boolean isOwned(Owner c)
          Interface Owned
 void notifyOwners(java.lang.Object o)
          Interface Owned
 void ownershipRequired(Request r)
          Called from sendEvent( request ) in case request comes from non-owner.
 void processEvent(Request r)
          Process a request.
 void removeOwner(Owner c)
          Interface Owned
 void sendEvent(Request r)
          Forwards request r to other clients, listeners added by Dispatcher.
 
Methods inherited from class org.vrspace.server.PublicDBObject
setValue
 
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, 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
 

Constructor Detail

OwnedDBObject

public OwnedDBObject()
Method Detail

sendEvent

public void sendEvent(Request r)
               throws RequestException
Forwards request r to other clients, listeners added by Dispatcher. Throws RequestException if request target is another object, or if event source is not in it's owners list.

Overrides:
sendEvent in class DBObject
Throws:
RequestException

ownershipRequired

public void ownershipRequired(Request r)
                       throws RequestException
Called from sendEvent( request ) in case request comes from non-owner. Intended for subclases. This implementation throws RequestException. NOTE: in order distribute this request further you need to processEvent( r );

Throws:
RequestException

processEvent

public void processEvent(Request r)
                  throws RequestException
Process a request. Called from sendEvent if request comes from owner. Intedend for use by sublcasses, utility function.

Throws:
RequestException

addOwner

public void addOwner(Owner c)
Interface Owned

Specified by:
addOwner in interface Owned

removeOwner

public void removeOwner(Owner c)
Interface Owned

Specified by:
removeOwner in interface Owned

isOwned

public boolean isOwned(Owner c)
Interface Owned

Specified by:
isOwned in interface Owned

notifyOwners

public void notifyOwners(java.lang.Object o)
Interface Owned

Specified by:
notifyOwners in interface Owned