Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.vrspace.server
Class Request  view Request download Request.java

java.lang.Object
  extended byorg.vrspace.util.Message
      extended byorg.vrspace.server.Request
All Implemented Interfaces:
java.lang.Cloneable

public class Request
extends org.vrspace.util.Message
implements java.lang.Cloneable

This class represents a single request from the client. It extends Message to adding request logging capabilites, and also adds Client


Field Summary
protected  Client client
           
 java.lang.Exception exception
           
 VRObject object
           
protected  boolean sendObject
           
protected  Session session
           
 
Fields inherited from class org.vrspace.util.Message
arguments, className, eventName, eventValue, isResponse, objectId, path, request, response, time
 
Constructor Summary
Request(Client c, java.lang.String request)
          Creates new Request as specified by request
Request(Client c, VRObject obj)
          This constructor is intended to send object over net
Request(Request r, java.lang.String request)
          This constructor uses client and session info from passed request.
 
Method Summary
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 Client getClient()
          Returns the originating client
 VRObject getObject()
          Returns wrapped object.
 boolean isEvent()
          Returns true if this request represents an event (VRObject state change) rather than an object.
 boolean sendObject()
          Returns true if this Request contains a VRObject intended for transfer over network.
(package private)  void setClass(java.lang.String cls)
           
(package private)  void setId(long id)
           
 java.lang.String toLogEntry()
          Returns request string suitable for logging
 java.lang.String toString()
          If this request contains VRObject, returns its toText(), otherwise returns Message.toString()
 
Methods inherited from class org.vrspace.util.Message
getArguments, getClassName, getEventName, getEventValue, getId, getPath, getRequest, getResponse, getTime, isResponse, parseLine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

client

protected Client client

session

protected Session session

sendObject

protected boolean sendObject

exception

public java.lang.Exception exception

object

public VRObject object
Constructor Detail

Request

public Request(Client c,
               java.lang.String request)
Creates new Request as specified by request


Request

public Request(Request r,
               java.lang.String request)
This constructor uses client and session info from passed request. Intended for usage in commands that need to provide feedback over a specific session.


Request

public Request(Client c,
               VRObject obj)
This constructor is intended to send object over net

Method Detail

getClient

public Client getClient()
Returns the originating client


toLogEntry

public java.lang.String toLogEntry()
Returns request string suitable for logging


toString

public java.lang.String toString()
If this request contains VRObject, returns its toText(), otherwise returns Message.toString()


sendObject

public boolean sendObject()
Returns true if this Request contains a VRObject intended for transfer over network. Set by Client.addObject().


isEvent

public boolean isEvent()
Returns true if this request represents an event (VRObject state change) rather than an object. For now, = !sendObject()


getObject

public VRObject getObject()
Returns wrapped object. May return null before Dispatcher processes request, thus unsafe to use in Client extensions


setId

void setId(long id)

setClass

void setClass(java.lang.String cls)

clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }