|
|||||||||
| Home >> All >> org >> vrspace >> [ server overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.vrspace.server
Class Client

java.lang.Objectjava.util.Observable
org.vrspace.server.VRObject
org.vrspace.server.DBObject
org.vrspace.server.PublicDBObject
org.vrspace.server.OwnedDBObject
org.vrspace.server.Client
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Observer, org.vrspace.attributes.Owned, org.vrspace.attributes.Owner
- Direct Known Subclasses:
- org.vrspace.server.object.User
- public class Client
- extends OwnedDBObject
- implements java.util.Observer, org.vrspace.attributes.Owner
- extends OwnedDBObject
Generic Client class. Tracks visible objects, but forwards events to Dispatcher even if client sends events to invisible VRObjects.
| Field Summary | |
long |
_lastLogin
|
protected AuthInfo |
authInfo
|
protected Dispatcher |
dispatcher
|
java.lang.String |
name
client name (login) |
protected boolean |
online
|
protected Transform |
pos
|
protected Scene |
scene
|
protected Session |
session
|
protected int |
sessions
|
long |
transform
|
| Fields inherited from class org.vrspace.server.OwnedDBObject |
|
| Fields inherited from class org.vrspace.server.DBObject |
db |
| Fields inherited from class org.vrspace.server.VRObject |
db_id, isNew, primitiveMap, primitives |
| Fields inherited from class java.util.Observable |
|
| Constructor Summary | |
Client()
|
|
Client(Dispatcher d,
AuthInfo a)
Construct a new client. |
|
| Method Summary | |
void |
addObject(VRObject obj)
Add an object to the scene. |
void |
addObserver(java.util.Observer o)
Called when another client observes this one instead of Observable.addObserver() |
void |
addOwned(org.vrspace.attributes.Owned o)
Interface Owner - own o |
void |
deleteObserver(java.util.Observer o)
called when this another client stops observing this, overrides Observable.deleteObserver() |
protected void |
destroy()
Clean up. |
java.lang.ClassLoader |
getClassLoader()
Returns ClassLoader of this thread |
Dispatcher |
getDispatcher()
Returns Dispatcher |
protected org.vrspace.attributes.ObjectFilter |
getFilter(Request r,
java.lang.String filter)
|
java.lang.String |
getName()
Get client name |
Transform |
getPos()
This returns client's Transform. |
org.vrspace.util.ObservableProperties |
getProperties()
Convenicence method |
java.lang.String |
getProperty(java.lang.String key)
Convenicence method |
Scene |
getScene()
Returns this client's scene |
Session |
getSession()
this shouldn't be public... |
protected void |
init()
This is called by the dispatcher after login. |
void |
invalidRequest(Request r)
Called from Dispatcher if request() sent an invalid request |
boolean |
isOnline()
Is client on-line? |
boolean |
isOwner(org.vrspace.attributes.Owned o)
Interface Owner - owns o? |
boolean |
owns(VRObject o)
Convenience method. |
void |
quit()
Logout. |
void |
removeAll()
Removes all objects from the scene |
void |
removeObject(VRObject obj)
Remove object obj from the scene |
void |
removeOwned(org.vrspace.attributes.Owned o)
Interface Owner - do not own o |
void |
request(Request r)
A new client request. |
void |
sendResponse(Request r,
java.lang.String response)
Sends the response back to the client TODO: Include more information to the response (originating request id) |
void |
set__password(Request r,
java.lang.String passwd)
Changes password |
void |
set__sceneRange(Request r,
java.lang.String range)
Set Scene range |
void |
set__sceneSize(Request r,
java.lang.String size)
Set Scene size |
void |
set_addFilter(Request r,
java.lang.String filter)
adds class filter usage: my addFilter org.vrspace.server.filter.ClassFilter VrmlFile removes all VrmlFile instances from the scene. Default package name for filters is org.vrspace.server.filter Tries to call constructor with following parameters: - String - Request - none (Class.newInstance) |
void |
set_removeFilter(Request r,
java.lang.String filter)
removes filter |
void |
setProperty(java.lang.String name,
java.lang.String value)
Convenicence method |
protected void |
setValue(Request r)
This method forwards events to other intances on the net Request is already processed, validated etc. |
void |
update(java.util.Observable o,
java.lang.Object req)
Method update is called from VRObject class notifyObservers() Notifies the client an object in the scene has changed |
void |
updateAuthInfo(Client c)
Updates AuthInfo. |
void |
updateOwnership(org.vrspace.attributes.Owned o,
java.lang.Object obj)
Called when : - this client receives an object, scene updates - another ownership change occur |
void |
updateScene()
update the scene |
void |
updateScene(double x,
double y,
double z)
Update the scene with those coordinates, should be called with scene changes |
| Methods inherited from class org.vrspace.server.OwnedDBObject |
addOwner, isOwned, notifyOwners, removeOwner, 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, lock, lockClass, newInstance, sendResponse, setField, setField, setField, setFields, setFields, stringToArray, toString, toText, toText, toText, unlock, unlockClass |
| Methods inherited from class java.util.Observable |
clearChanged, countObservers, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
dispatcher
protected Dispatcher dispatcher
authInfo
protected AuthInfo authInfo
session
protected Session session
scene
protected Scene scene
transform
public long transform
_lastLogin
public long _lastLogin
sessions
protected int sessions
name
public java.lang.String name
- client name (login)
pos
protected Transform pos
online
protected boolean online
| Constructor Detail |
Client
public Client()
Client
public Client(Dispatcher d, AuthInfo a)
- Construct a new client. Each client type should do init here, i.e. User
should build up the scene.
| Method Detail |
getName
public java.lang.String getName()
- Get client name
getDispatcher
public Dispatcher getDispatcher()
- Returns Dispatcher
addObserver
public void addObserver(java.util.Observer o)
- Called when another client observes this one instead of Observable.addObserver()
deleteObserver
public void deleteObserver(java.util.Observer o)
- called when this another client stops observing this, overrides Observable.deleteObserver()
update
public void update(java.util.Observable o, java.lang.Object req)
- Method update is called from VRObject class notifyObservers()
Notifies the client an object in the scene has changed
- Specified by:
updatein interfacejava.util.Observer
sendResponse
public void sendResponse(Request r, java.lang.String response)
- Sends the response back to the client
TODO:
Include more information to the response (originating request id)
quit
public void quit()
- Logout. First clears the scene.
request
public void request(Request r)
- A new client request. Network layer constructs new request and calls this method.
Asks the Dispatcher to change a VRObject's variable value.
If Dispatcher throws an exception, it's propagated to the client.
invalidRequest
public void invalidRequest(Request r)
- Called from Dispatcher if request() sent an invalid request
addObject
public void addObject(VRObject obj) throws java.lang.IllegalAccessException
- Add an object to the scene. Called from ProxyDispatcher, Scene, VRObject or Command classes...
Creates new Requests and sends them to the uderlying session
removeObject
public void removeObject(VRObject obj) throws java.lang.IllegalAccessException
- Remove object obj from the scene
removeAll
public void removeAll()
- Removes all objects from the scene
destroy
protected void destroy()
- Clean up.
init
protected void init()
- This is called by the dispatcher after login. Session and all other
fields are set prior to init.
This implementation does nothing.
updateScene
public void updateScene()
throws VRObjectException
- update the scene
updateScene
public void updateScene(double x,
double y,
double z)
throws VRObjectException
- Update the scene with those coordinates, should be called with scene changes
setValue
protected void setValue(Request r)
- This method forwards events to other intances on the net
Request is already processed, validated etc.
Here, just determine what should be forwareded.
NOTE: this implementation does nothing- Overrides:
setValuein classPublicDBObject
addOwned
public void addOwned(org.vrspace.attributes.Owned o)
- Interface Owner - own o
- Specified by:
addOwnedin interfaceorg.vrspace.attributes.Owner
removeOwned
public void removeOwned(org.vrspace.attributes.Owned o)
- Interface Owner - do not own o
- Specified by:
removeOwnedin interfaceorg.vrspace.attributes.Owner
isOwner
public boolean isOwner(org.vrspace.attributes.Owned o)
- Interface Owner - owns o?
- Specified by:
isOwnerin interfaceorg.vrspace.attributes.Owner
owns
public boolean owns(VRObject o)
- Convenience method. Calls isOwner( Owned ) if o instanceof Owned, else
returns false.
updateOwnership
public void updateOwnership(org.vrspace.attributes.Owned o, java.lang.Object obj)
- Called when :
- this client receives an object, scene updates - another ownership change occur- Specified by:
updateOwnershipin interfaceorg.vrspace.attributes.Owner
isOnline
public boolean isOnline()
- Is client on-line?
getPos
public Transform getPos()
- This returns client's Transform. Needed to calculate distances.
set_addFilter
public void set_addFilter(Request r, java.lang.String filter) throws java.lang.Exception
- adds class filter
usage: my addFilter org.vrspace.server.filter.ClassFilter VrmlFile removes all VrmlFile instances from the scene. Default package name for filters is org.vrspace.server.filter Tries to call constructor with following parameters:
- String
- Request
- none (Class.newInstance)
getFilter
protected org.vrspace.attributes.ObjectFilter getFilter(Request r, java.lang.String filter) throws java.lang.Exception
set_removeFilter
public void set_removeFilter(Request r, java.lang.String filter) throws java.lang.Exception
- removes filter
getScene
public Scene getScene()
- Returns this client's scene
updateAuthInfo
public void updateAuthInfo(Client c) throws java.lang.Exception
- Updates AuthInfo. Use when db_id or class changes.
set__password
public void set__password(Request r, java.lang.String passwd)
- Changes password
getProperties
public org.vrspace.util.ObservableProperties getProperties()
- Convenicence method
getProperty
public java.lang.String getProperty(java.lang.String key)
- Convenicence method
setProperty
public void setProperty(java.lang.String name, java.lang.String value)
- Convenicence method
getClassLoader
public java.lang.ClassLoader getClassLoader()
- Returns ClassLoader of this thread
set__sceneSize
public void set__sceneSize(Request r, java.lang.String size)
- Set Scene size
set__sceneRange
public void set__sceneRange(Request r, java.lang.String range)
- Set Scene range
getSession
public Session getSession()
- this shouldn't be public...
|
|||||||||
| Home >> All >> org >> vrspace >> [ server overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC