Google

JanosVM v0.6.0 Java API Documentation: Class JSIMessage
JanosVM v0.6.0 Java API

edu.utah.janosvm.kit.comm.jsi
Class JSIMessage

java.lang.Object
  |
  +--edu.utah.janosvm.kit.comm.jsi.JSIMessage

public class JSIMessage
extends java.lang.Object

The JSIMessage


Field Summary
static int CARRIER
           
static int CREATE_PROPERTY
           
static int DELETE_PROPERTY
           
static int ERROR
           
static int EXECUTE_PROPERTY
           
static int GET_PROPERTY
           
static int GET_SUITES
           
static int LIST_PROPERTIES
           
static int REPLY
           
static java.lang.String SET_DATA
          The name of the attribute that contains the data to be used in a set.
static int SET_PROPERTY
           
static int SHUTDOWN
           
static int WHAT_MAX
           
static int WHAT_NONE
           
 
Constructor Summary
JSIMessage()
          Construct an empty message.
 
Method Summary
 JSIMessage add(JSIPair jp)
          Add an identifier/value pair to the message.
 JSIMessage add(java.lang.String tag, JSIPropertyInfo value)
          Add an identifier/value pair to the message.
 JSIMessage add(java.lang.String tag, JSIPropertyInfo[] value)
          Add an identifier/value pair to the message.
 JSIMessage add(java.lang.String tag, java.lang.String value)
          Add an identifier/value pair to the message.
 void clear()
          Clear the contents of a message so it can be reused.
 int count(java.lang.String tag)
          Count the number of identifier/value pairs in the message.
 void error(java.lang.String why)
          Clear the message and set it to be error reply with the given data.
 java.lang.String expect(java.lang.String tag)
          Expect an identifier/value pair in the message.
 JSIPair expectPair(java.lang.String tag)
          Expect an identifier/value pair in the message.
 byte[] flatten()
           
 java.lang.String get(java.lang.String tag)
          Get an identifier/value pair from the message.
 java.lang.String get(java.lang.String tag, int instance, java.lang.String defaultValue)
          Get an identifier/value pair from the message.
 java.lang.String get(java.lang.String tag, java.lang.String defaultValue)
          Get an identifier/value pair from the message.
 java.util.Vector getIdentifiers()
           
 JSIPair getPair(java.lang.String tag)
          Get an identifier/value pair from the message.
 JSIPair getPair(java.lang.String tag, int instance)
          Get an identifier/value pair from the message.
 int getRemainingSpecifierCount()
           
 int getSpecifierCount()
           
 int getWhat()
           
static JSIMessage instantiate(byte[] msg)
          Instantiate a flattened message.
 JSIPair popSpecifier()
          Pop a specifier off the stack.
 void pushSpecifier(JSIPair jp)
          Push a specifier onto the stack.
 void pushSpecifier(java.lang.String tag)
          Push a specifier onto the stack.
 void pushSpecifier(java.lang.String tag, java.lang.String value)
          Push a specifier onto the stack.
 void remove(java.lang.String tag, int instance)
          Remove an identifier value pair from the message.
 void reply(JSIPropertyInfo[] result)
          Clear the message and set it to be a valid reply with the given data.
 void reply(long result)
          Clear the message and set it to be a valid reply with the given data.
 void reply(java.lang.String result)
          Clear the message and set it to be a valid reply with the given data.
 void restoreSpecifier()
          Restore the last specifier popped off the stack.
 void setWhat(int what)
           
 java.lang.String toString()
           
 void unflatten(byte[] buf)
          Unmarshal the message in this.buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WHAT_NONE

public static final int WHAT_NONE

ERROR

public static final int ERROR

SHUTDOWN

public static final int SHUTDOWN

CARRIER

public static final int CARRIER

REPLY

public static final int REPLY

GET_SUITES

public static final int GET_SUITES

LIST_PROPERTIES

public static final int LIST_PROPERTIES

GET_PROPERTY

public static final int GET_PROPERTY

SET_PROPERTY

public static final int SET_PROPERTY

CREATE_PROPERTY

public static final int CREATE_PROPERTY

DELETE_PROPERTY

public static final int DELETE_PROPERTY

EXECUTE_PROPERTY

public static final int EXECUTE_PROPERTY

WHAT_MAX

public static final int WHAT_MAX

SET_DATA

public static final java.lang.String SET_DATA
The name of the attribute that contains the data to be used in a set.
Constructor Detail

JSIMessage

public JSIMessage()
Construct an empty message.
Method Detail

setWhat

public void setWhat(int what)
Parameters:
what - The message type.

getWhat

public int getWhat()
Returns:
The message type.

pushSpecifier

public void pushSpecifier(JSIPair jp)
Push a specifier onto the stack.
Parameters:
jp - The specifier to add.

pushSpecifier

public void pushSpecifier(java.lang.String tag,
                          java.lang.String value)
Push a specifier onto the stack.
Parameters:
tag - The specifier name.
value - The specifier value.

pushSpecifier

public void pushSpecifier(java.lang.String tag)
Push a specifier onto the stack.
Parameters:
tag - The specifier name.

popSpecifier

public JSIPair popSpecifier()
Pop a specifier off the stack.
Returns:
The specifier at the top of the stack.

restoreSpecifier

public void restoreSpecifier()
Restore the last specifier popped off the stack.

getSpecifierCount

public int getSpecifierCount()
Returns:
The number of specifiers on the stack.

getRemainingSpecifierCount

public int getRemainingSpecifierCount()
Returns:
The number of specifiers left on the stack.

getIdentifiers

public java.util.Vector getIdentifiers()
Returns:
An enumeration containing the identifier/value pairs.

add

public JSIMessage add(JSIPair jp)
Add an identifier/value pair to the message.
Parameters:
jp - The pair to add.
Returns:
this

add

public JSIMessage add(java.lang.String tag,
                      java.lang.String value)
Add an identifier/value pair to the message.
Parameters:
tag - The identifier
value - The value
Returns:
this

add

public JSIMessage add(java.lang.String tag,
                      JSIPropertyInfo value)
Add an identifier/value pair to the message.
Parameters:
tag - The identifier
value - The value
Returns:
this

add

public JSIMessage add(java.lang.String tag,
                      JSIPropertyInfo[] value)
Add an identifier/value pair to the message.
Parameters:
tag - The identifier
value - An array of JSIPropertyInfo's to add to the message.
Returns:
this

remove

public void remove(java.lang.String tag,
                   int instance)
Remove an identifier value pair from the message.
Parameters:
tag - The identifier to remove.
instance - The instance of the identifier to remove.

count

public int count(java.lang.String tag)
Count the number of identifier/value pairs in the message.
Parameters:
tag - The identifier to count.
Returns:
The number of occurrences of the given identifier in the message

get

public java.lang.String get(java.lang.String tag,
                            int instance,
                            java.lang.String defaultValue)
Get an identifier/value pair from the message.
Parameters:
tag - The identifier to get.
instance - The instance of the identifier to get.
defaultValue - The value to return if the identifier isn't found.
Returns:
The string value of the identifier or the defaultValue if it

get

public java.lang.String get(java.lang.String tag)
Get an identifier/value pair from the message.
Parameters:
tag - The identifier to get.
Returns:
The string value of the identifier or null if it wasn't found.

get

public java.lang.String get(java.lang.String tag,
                            java.lang.String defaultValue)
Get an identifier/value pair from the message.
Parameters:
tag - The identifier to get.
defaultValue - The value to return if the identifier isn't found.
Returns:
The string value of the identifier or the defaultValue if it

getPair

public JSIPair getPair(java.lang.String tag,
                       int instance)
Get an identifier/value pair from the message.
Parameters:
tag - The identifier to get.
instance - The instance of the identifier to get.
Returns:
The pair associated with the given identifier or null if it

getPair

public JSIPair getPair(java.lang.String tag)
Get an identifier/value pair from the message.
Parameters:
tag - The identifier to get.
Returns:
The pair associated with the given identifier or null if it

expect

public java.lang.String expect(java.lang.String tag)
                        throws MissingPairException
Expect an identifier/value pair in the message.
Parameters:
tag - The identifier to get.
Returns:
The string value of the pair.
Throws:
Throws - a MissingPairException if the tag couldn't be found.

expectPair

public JSIPair expectPair(java.lang.String tag)
                   throws MissingPairException
Expect an identifier/value pair in the message.
Parameters:
tag - The identifier to get.
Returns:
The pair associated with the given identifier.
Throws:
Throws - a MissingPairException if the tag couldn't be found.

clear

public void clear()
Clear the contents of a message so it can be reused.

reply

public void reply(java.lang.String result)
Clear the message and set it to be a valid reply with the given data.
Parameters:
result - The string value to send back as the reply.

reply

public void reply(JSIPropertyInfo[] result)
Clear the message and set it to be a valid reply with the given data.
Parameters:
result - The property info array to send back as the reply.

reply

public void reply(long result)
Clear the message and set it to be a valid reply with the given data.
Parameters:
result - The integer value to send back as the reply.

error

public void error(java.lang.String why)
Clear the message and set it to be error reply with the given data.
Parameters:
why - A brief explanation of the error.

flatten

public byte[] flatten()
Returns:
A flattened version of this message.

unflatten

public void unflatten(byte[] buf)
               throws JSIEncodingException
Unmarshal the message in this.buffer.
Returns:
True if the process worked.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

instantiate

public static final JSIMessage instantiate(byte[] msg)
                                    throws JSIEncodingException
Instantiate a flattened message.
Parameters:
msg - The byte array containing the flattened message.
Returns:
The unflattened JSIMessage or null if the process failed.

JanosVM v0.6.0 Java API

This documentation is Copyright (C) 2000-2002 The University of Utah. All Rights Reserved. See the documentation license for distribution terms and restrictions.
Documentation, software, and mailing lists for the JanosVM can be found at the Janos Project web page: http://www.cs.utah.edu/flux/janos/
Generated on Mar 17, 2002