org.vrspace.util
Class Message

java.lang.Object
  extended byorg.vrspace.util.Message
Direct Known Subclasses:
Request

public class Message
extends java.lang.Object

Generic Message class. A message can be request, response or command. Constructor expects request string in format "class id event value" or "command arguments"
Request: request for a network object to change it's state. Object is specified by class and id, event specifies it's field/method (metod has set_ prefix, used if there is no public field with event name) and value is passed to method or used to set field value
Response: response to a previous request/command. Prefixed with + (ok) or - (error).
Command: request to the server rather to an object


Field Summary
protected  java.lang.String[] arguments
           
protected  java.lang.String className
           
protected  java.lang.String eventName
           
protected  java.lang.String eventValue
           
 java.lang.Exception exception
           
protected  boolean isResponse
           
protected  long objectId
           
protected  java.util.Vector path
           
protected  java.lang.String request
           
protected  boolean response
           
protected  long time
           
 
Constructor Summary
protected Message()
          Intended only for subclasses
  Message(java.lang.String line)
          Creates new message defined by line
 
Method Summary
 java.lang.String[] getArguments()
          Returns the command arguments
 java.lang.String getClassName()
          Returns the target object class name, or command if message is command
 java.lang.String getEventName()
          Returns target object field name
 java.lang.String getEventValue()
          Returns the event value
 long getId()
          Returns target object id or -1 if message is command
 java.lang.String getID()
          Returns className and id of targeted object.
 java.lang.String[] getPath()
          Returns the message path (list of servers it passed), null for local message
 java.lang.String getRequest()
          Returns the request string used to create this message
 boolean getResponse()
          returns true for ok or false for error
 long getTime()
          Returns the message creation time, in milliseconds
 boolean isResponse()
          Is this message a response
 void parseLine(java.lang.String line)
          parses line and fills in message fields
 java.lang.String toString()
          Returns the string representation of request, in the format expected by constructor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

time

protected long time

className

protected java.lang.String className

objectId

protected long objectId

eventName

protected java.lang.String eventName

eventValue

protected java.lang.String eventValue

response

protected boolean response

isResponse

protected boolean isResponse

exception

public java.lang.Exception exception

arguments

protected java.lang.String[] arguments

path

protected java.util.Vector path

request

protected java.lang.String request
Constructor Detail

Message

protected Message()
Intended only for subclasses


Message

public Message(java.lang.String line)
Creates new message defined by line

Method Detail

parseLine

public void parseLine(java.lang.String line)
parses line and fills in message fields


isResponse

public boolean isResponse()
Is this message a response


getResponse

public boolean getResponse()
returns true for ok or false for error


getClassName

public java.lang.String getClassName()
Returns the target object class name, or command if message is command


getArguments

public java.lang.String[] getArguments()
Returns the command arguments


getId

public long getId()
Returns target object id or -1 if message is command


getID

public java.lang.String getID()
Returns className and id of targeted object.


getEventName

public java.lang.String getEventName()
Returns target object field name


getEventValue

public java.lang.String getEventValue()
Returns the event value


getTime

public long getTime()
Returns the message creation time, in milliseconds


getRequest

public java.lang.String getRequest()
Returns the request string used to create this message


getPath

public java.lang.String[] getPath()
Returns the message path (list of servers it passed), null for local message


toString

public java.lang.String toString()
Returns the string representation of request, in the format expected by constructor