|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectthings.thinger.service.actor.ActorMessage
public class ActorMessage
A message.
MESSAGE = SEQUENCE,TYPE,NUMBER.PARAMETERS,NUMBER.ATTRIBUTES,PARAMETERS,ATTRIBUTES
SEQUENCE = int (4-byte, jvm ordered)
NUMBER.PARAMETERS = int (4-byte, jvm ordered), number of at PAIRs
NUMBER.ATTRIBUTES = int (4-byte, jvm ordered), number of at PAIRs
TYPE = STRING (for the message type)
PARAMETERS = PAIR.1,PAIR.N
NUMBER = int (4-byte, jvm ordered) representing the number of pairs
PAIR.x = STRING,STRING (representing name/value)
STRING = SIZE,BYTES
SIZE = int (4-byte, jvm ordered)
BYTES = byte[SIZE]
This is not entirely thread safe. You should add a parameter during load or save which could cause the messages to get munged. I'm not sure this would ever be used across multiple threads, so I won't synchronize it.
Version History
EPG - Initial - 11 MAY 07
| Field Summary | |
|---|---|
int |
sequence
The sequence number. |
| Constructor Summary | |
|---|---|
ActorMessage()
Default constructor. |
|
ActorMessage(int theSequence)
This is the convenience constructor. |
|
| Method Summary | |
|---|---|
void |
addAttribute(NVImmutable p)
Add an attribute. |
void |
addAttribute(java.lang.String name,
java.lang.String value)
Add an attribute. |
void |
addParamter(NVImmutable p)
Add a parameter. |
void |
addParamter(java.lang.String name,
java.lang.String value)
Add a parameter. |
java.lang.String |
getAttribute(java.lang.String name)
Get a parameter by name. |
java.lang.String |
getParameter(java.lang.String name)
Get a parameter by name. |
java.lang.String |
getType()
Get type. |
void |
load(java.io.InputStream is)
Load this message from a stream. |
void |
save(java.io.OutputStream os)
Save this message to a stream. |
void |
setType(java.lang.String messageType)
Set type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public int sequence
| Constructor Detail |
|---|
public ActorMessage()
public ActorMessage(int theSequence)
theSequence - A sequence number. This should be incremented for every order.| Method Detail |
|---|
public void addParamter(NVImmutable p)
throws java.lang.Throwable
p - A ready made parameter. It will be treated as a single value.
java.lang.Throwable
public void addParamter(java.lang.String name,
java.lang.String value)
throws java.lang.Throwable
name - The parameter name.value - The parameter value.
java.lang.Throwablepublic java.lang.String getParameter(java.lang.String name)
name - The parameter's name. If null it will return null;
public void addAttribute(NVImmutable p)
throws java.lang.Throwable
p - A ready made attribute. It will be treated as a single value.
java.lang.Throwable
public void addAttribute(java.lang.String name,
java.lang.String value)
throws java.lang.Throwable
name - The attribute name.value - The attribute value.
java.lang.Throwablepublic java.lang.String getAttribute(java.lang.String name)
name - The parameter's name. If null., it will return null;
public void load(java.io.InputStream is)
throws java.lang.Throwable
is - The stream.
java.lang.Throwable
public void save(java.io.OutputStream os)
throws java.lang.Throwable
os - The stream.
java.lang.Throwablepublic void setType(java.lang.String messageType)
messageType - The type. Try to keep them under 2k. If they are too big, they will be rejected by the distant end.public java.lang.String getType()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||