|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--moses.message.Message
This class represents in a single object all the messages that can
possibly circulate between agent-controller, controller-controller
and controller-external_member.
The class only offers two methods concerned with serialization
and deserialization of a message to and from a DataInput(Output)Stream
(Java default serialization mechanism is not an efficient alternative).
The class has a polymorphic behavior. It declares a pool of variable,
representing all the possible fields in all the possible messages,
and a number of indicator flags (int). Depending on the value of the flags,
only certain variables in the pool actually store values (the rest are null).
All the messages start with an integer value, indicating the number of bytes
that follow in the message (body length). It follows a byte value indicating
the type of message (all types are defined in moses.util.Const class),
followed by an int value indicating the message unique sequence number.
The subsequent values depend on the type of the message.
A list of all messages and their serial layout is presented bellow:
agent-controller communication:
-------------------------------------------------------------------------
send
|I:b-size|B:type|I:seq_no|B:p_type|S:source|S:dest|...
SND| SPLD| |S:s_payload|
OPLD| |O:o_payload|
BPLD| |I:plen |B[]:b_payload|
send_exp
|I:b-size|B:type|I:seq_no|B:p_type|S:source|S:dest|...
SNDE| SPLD| |S:s_payload|S:s_lname|
OPLD| |O:o_payload|S:s_lname|
BPLD| |I:plen |B[]:b_payload|S:s_lname|
send_ack
|I:b-size|B:type|I:seq_no|
ACK
send_cert
|I:b-size|B:type|I:seq_no|S:source|O:cert|
CERT
send_self_cert
|I:b-size|B:type|I:seq_no|S:source|O:cert||I:plen |B[]:sign |
SCERT
adopt
// |I:b-size|B:type|I:seq_no|B:a_type|B:l_type|S:source|S:pwd|S:law|S:arg1|S:arg2|
|I:b-size|B:type|I:seq_no|B:l_type|S:source|S:pwd|S:law|S:arg1|S:arg2|B[]:sign ("sign" saves the certifeid list see CertVerifierList) |
ADOPT
reconnect
|I:b-size|B:type|I:seq_no|S:source|S:pwd|
RECON
test
|I:b-size|B:type|I:seq_no|S:source|S:arg1|S:arg2|
TEST
change_password
|I:b-size|B:type|I:seq_no|S:pwd|S:opwd|
CHPWD
change_password_answer
|I:b-size|B:type|I:seq_no|B:status|
CHPWDA
adopt_answer
|I:b-size|B:type|I:seq_no|B:status|
ADANS
adopt_answer_certified
|I:b-size|B:type|I:seq_no|O:cert||I:plen |B[]:sign |
ADANSC
controller-controller communication:
-------------------------------------------------------------------------
forward
|I:b-size|B:type|I:seq_no|B:p_type|S:source|S:dest|
FWD| SPLD| |S:s_payload |S:s_hash|S:s_lname|S:d_hash|
OPLD| |O:o_payload |S:s_hash|S:s_lname|S:d_hash|
BPLD| |I:plen|B[]:b_payload|S:s_hash|S:s_lname|S:d_hash|
controller
|I:b-size|B:type|I:seq_no|
CNTR
controller_cert
|I:b-size|B:type|I:seq_no|S:source|O:cert||I:plen |B[]:sign |
CNTRCERT
create
// |I:b-size|B:type|I:seq_no|B:a_type|B:l_type|S:dest|S:pwd|S:law|S:arg1|S:arg2|S:source|S:s_lname|S:s_hash|
|I:b-size|B:type|I:seq_no|B:l_type|S:dest|S:pwd|S:law|S:arg1|S:arg2|S:source|S:s_lname|S:s_hash|
CRT
exception
|I:b-size|B:type|I:seq_no|B:ex_po|...
EXC|
FWD|B:p_type|S:source|S:dest|...
SPLD| |S:s_payload |S:d_hash|S:fcause|
OPLD| |O:o_payload |S:d_hash|S:fcause|
BPLD| |I:plen|B[]:b_payload|S:d_hash|S:fcause|
//ADOPT|B:a_type|B:l_type|S:source|S:pwd|S:law|S:arg1|S:arg2|S:fcause|
// CRT|B:a_type|B:l_type|S:dest|S:pwd|S:law|S:arg1|S:arg2|S:source|S:s_lname|S:s_hash|S:fcause|
CRT|B:l_type|S:dest|S:pwd|S:law|S:arg1|S:arg2|S:source|S:s_lname|S:s_hash|S:fcause|
controller-external_member communication:
-------------------------------------------------------------------------
submit
|I:b-size|B:type|I:seq_no|B:p_type|S:source|S:dest|I:sport|...
SBMT| SPLD| |S:s_payload|
OPLD| |O:o_payload|
BPLD| |I:plen |B[]:b_payload|
submitp
|I:b-size|B:type|I:seq_no|B:p_type|S:source|S:dest|I:sport|...
SBMTP| SPLD| |S:s_payload|S:pwd|
OPLD| |O:o_payload|S:pwd|
BPLD| |I:plen |B[]:b_payload|S:pwd|
submitc
|I:b-size|B:type|I:seq_no|B:p_type|S:source|S:dest|I:sport|...
SBMTC| SPLD| |S:s_payload|O:cert|
OPLD| |O:o_payload|O:cert|
BPLD| |I:plen |B[]:b_payload|O:cert|I:plen |B[]:sign |
error_message
|I:b-size|B:type|I:seq_no|I:status|
ERR
exmember
|I:b-size|B:type|I:seq_no|S:dest||I:sport|
EXM
| Field Summary | |
java.lang.String |
arg1
Holds the adoption argument supplied by the actor. |
java.lang.String |
arg2
Holds an extra adoption argument; not used at present time. |
byte[] |
b_payload
Holds the byte array payload of this message according to the type of the message; null otherwise. |
moses.security.LGICert |
cert
Holds the LGI certificate when such a certificate is exchanged during a particular message. |
java.lang.String |
d_hash
The hash of the destination law. |
static int |
DEFAULT_AS
Minimum default size of a message; it represents the preallocated space for a ByteArrayOutputStream |
static int |
DEFAULT_MAXS
The maximum size allowed for a message. |
java.lang.String |
dest
Holds the moses name of the destination of this message. |
int |
ex_po
This field contains the type of the payload of the original message reported during an exception message. |
java.lang.String |
fcause
Holds the failure cause during an exception message. |
int |
l_type
Holds the type of the law referenced in this message; it is either Const.IMM or Const.URL. |
java.lang.String |
law
Holds the law URL |
java.lang.Object |
o_payload
Holds the Object payload of this message according to the type of the message; null otherwise. |
java.lang.String |
opwd
Holds the old reconnection password during changing the password. |
int |
p_type
Maintains the payload type: String, Object and byte array. |
java.lang.String |
pwd
Holds the reconnection password of the actor. |
java.lang.String |
s_hash
This field contains the hash of the law of the source of the message. |
java.lang.String |
s_lname
The name of the law of the source of the message; necessary only as a suggestion, when the destination is not in the portal. |
java.lang.String |
s_payload
Holds the String payload of this message according to the type of the message; null otherwise. |
int |
seq_no
Maintains the message sequence number. |
byte[] |
sign
Holds the signature of a self-certificate when such a certificate is exchanged during a particular message. |
java.lang.String |
source
Holds the moses name of the source of this message. |
int |
sport
Sender port for a submitted message. |
int |
status
Status answer the controller reports to the actor. |
int |
type
Variable maintaining the type of the message being sent. |
| Constructor Summary | |
Message()
The default constructor, allocates and initializes all necessary structures for a message. |
|
| Method Summary | |
moses.message.Message |
copy()
Copy itself into a new Message object. |
static void |
main(java.lang.String[] args)
|
void |
read(java.io.DataInput dis)
Read (deserializing) method: Considering the layout presented in the description of this class, first read the first Integer coming from the DataInputStream argument. |
void |
write_cached(java.io.DataOutput dos)
Version of write method where data to serialized is assumed to have been previously cached in the "recv" byte array (perhaps from a previous read). |
void |
write(java.io.DataOutput dos)
Write(serializing) method: initially resets a ByteArrayOutputStream object then proceeds in writing all the data into the byte array, according to the message layout. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public int type
public int seq_no
public int p_type
public java.lang.String source
public java.lang.String dest
public java.lang.String s_payload
public java.lang.Object o_payload
public byte[] b_payload
public moses.security.LGICert cert
public byte[] sign
public int l_type
public java.lang.String pwd
public java.lang.String opwd
public java.lang.String law
public java.lang.String arg1
public java.lang.String arg2
public int status
public java.lang.String s_hash
public java.lang.String s_lname
public java.lang.String d_hash
public int ex_po
public java.lang.String fcause
public int sport
public static final int DEFAULT_AS
public static final int DEFAULT_MAXS
| Constructor Detail |
public Message()
| Method Detail |
public void write(java.io.DataOutput dos)
throws java.io.IOException
dos - argument specifies the DataOutputStream where to write the message to.
java.io.IOException
public void read(java.io.DataInput dis)
throws java.lang.Exception
dis - argument specifies the DataInputStream where to read the message from.
java.lang.Exception
public void write_cached(java.io.DataOutput dos)
throws java.io.IOException
It may be useful for forwarding unmodified messages carrying objects .
java.io.IOExceptionpublic moses.message.Message copy()
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||