|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.utah.janosvm.kit.comm.jsi.JSIMessage
The JSIMessage
Field Summary | |
private byte[] |
buffer
The buffer used when marshalling/unmarshalling a flattened message. |
static int |
CARRIER
|
static int |
CREATE_PROPERTY
|
private int |
cursor
The current position in the buffer. |
static int |
DELETE_PROPERTY
|
static int |
ERROR
|
static int |
EXECUTE_PROPERTY
|
static int |
GET_PROPERTY
|
static int |
GET_SUITES
|
private java.util.Vector |
identifiers
The set of identifier/value pairs in the message. |
static int |
LIST_PROPERTIES
|
static java.lang.String[] |
MESSAGE_TYPE_STRINGS
An array of strings that correspond to the above message type enumeration. |
private int |
messageSize
The size of the flattened message. |
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
|
(package private) static int |
SIZEOF_INT
The size of an integer on the wire. |
private int |
specifierIndex
The current position in the specifier stack. |
private java.util.Vector |
specifiers
The specifier stack. |
private int |
what
The type of message. |
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. |
(package private) static int |
alignedSize(int size)
|
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. |
private int |
findIdentifier(java.lang.String tag,
int instance)
Find an identifier instance 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. |
(package private) byte[] |
readBytes(int length)
|
(package private) int |
readInt()
|
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. |
(package private) void |
writeBytes(byte[] b)
|
(package private) void |
writeInt(int i)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0 |
Field Detail |
public static final int WHAT_NONE
public static final int ERROR
public static final int SHUTDOWN
public static final int CARRIER
public static final int REPLY
public static final int GET_SUITES
public static final int LIST_PROPERTIES
public static final int GET_PROPERTY
public static final int SET_PROPERTY
public static final int CREATE_PROPERTY
public static final int DELETE_PROPERTY
public static final int EXECUTE_PROPERTY
public static final int WHAT_MAX
public static final java.lang.String[] MESSAGE_TYPE_STRINGS
public static final java.lang.String SET_DATA
static final int SIZEOF_INT
private byte[] buffer
private int cursor
private int messageSize
private int what
private final java.util.Vector specifiers
private int specifierIndex
private final java.util.Vector identifiers
Constructor Detail |
public JSIMessage()
Method Detail |
static int alignedSize(int size)
size
- The size to align.public void setWhat(int what)
what
- The message type.public int getWhat()
public void pushSpecifier(JSIPair jp)
jp
- The specifier to add.public void pushSpecifier(java.lang.String tag, java.lang.String value)
tag
- The specifier name.value
- The specifier value.public void pushSpecifier(java.lang.String tag)
tag
- The specifier name.public JSIPair popSpecifier()
public void restoreSpecifier()
public int getSpecifierCount()
public int getRemainingSpecifierCount()
public java.util.Vector getIdentifiers()
public JSIMessage add(JSIPair jp)
jp
- The pair to add.public JSIMessage add(java.lang.String tag, java.lang.String value)
tag
- The identifiervalue
- The valuepublic JSIMessage add(java.lang.String tag, JSIPropertyInfo value)
tag
- The identifiervalue
- The valuepublic JSIMessage add(java.lang.String tag, JSIPropertyInfo[] value)
tag
- The identifiervalue
- An array of JSIPropertyInfo's to add to the message.private int findIdentifier(java.lang.String tag, int instance)
tag
- The identifier to find.instance
- The instance of the identifier to find.public void remove(java.lang.String tag, int instance)
tag
- The identifier to remove.instance
- The instance of the identifier to remove.public int count(java.lang.String tag)
tag
- The identifier to count.public java.lang.String get(java.lang.String tag, int instance, java.lang.String defaultValue)
tag
- The identifier to get.instance
- The instance of the identifier to get.defaultValue
- The value to return if the identifier isn't found.public java.lang.String get(java.lang.String tag)
tag
- The identifier to get.public java.lang.String get(java.lang.String tag, java.lang.String defaultValue)
tag
- The identifier to get.defaultValue
- The value to return if the identifier isn't found.public JSIPair getPair(java.lang.String tag, int instance)
tag
- The identifier to get.instance
- The instance of the identifier to get.public JSIPair getPair(java.lang.String tag)
tag
- The identifier to get.public java.lang.String expect(java.lang.String tag) throws MissingPairException
tag
- The identifier to get.Throws
- a MissingPairException if the tag couldn't be found.public JSIPair expectPair(java.lang.String tag) throws MissingPairException
tag
- The identifier to get.Throws
- a MissingPairException if the tag couldn't be found.public void clear()
public void reply(java.lang.String result)
result
- The string value to send back as the reply.public void reply(JSIPropertyInfo[] result)
result
- The property info array to send back as the reply.public void reply(long result)
result
- The integer value to send back as the reply.public void error(java.lang.String why)
why
- A brief explanation of the error.public byte[] flatten()
public void unflatten(byte[] buf) throws JSIEncodingException
void writeInt(int i)
i
- The integer to write to the internal buffer.void writeBytes(byte[] b)
b
- The byte array to write to the internal buffer.int readInt()
byte[] readBytes(int length)
length
- The length of the byte array to unmarshal from thelength
- internal buffer.public java.lang.String toString()
toString
in class java.lang.Object
public static final JSIMessage instantiate(byte[] msg) throws JSIEncodingException
msg
- The byte array containing the flattened message.
|
JanosVM v1.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |