|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--PkgAgentSystem.Messaging.Message
A message, which can be sent from one agent to another.
Subclasses MUST be serializable, else messaging will NOT work!
ATTENTION:
The following is NOT allowed:
If a message contains a system class or an agent-system class, this class MUST NOT
store a contained agent-class in binary form. It may contain it as an field.
If the data is automatically restored from the stream during deserialization or read through
readObject, there is no problem. Not allowed is reading it in as an byte array and restoring it
from a different (self created) ObjectInputStream (via a ByteArrayInputStream).
The problem is the following: When the class is deserialized through the classloader of the
receiving agent, this class will be loaded (ot tried to be loaded) by the classloader of the
system-class/agent-system class, which is the primordial classloader. If this is successful,
there will be no possibility to cast it to the local type of the agent (which is loaded
through the agents classloader!). The data will not be available for the receiver.
Example: java.security.SignedObject
will not work.
Example: SignedMessage
PkgAgentSystem.Messaging.SignedMessage does work.
AgentBase
,
AgentSystem.sendMessage(AgentBase,Message)
, Serialized FormConstructor Summary | |
protected |
Message()
Create a new and empty message. |
protected |
Message(AgentIdentity sender,
AgentIdentity addressee,
long convTypeID,
long srcConvID,
long destConvID,
boolean fromInitiator)
Creates a new message from one agent to another. |
protected |
Message(MessageType inReplyTo)
Create a new message in reply to another one. |
Method Summary | |
Message |
copy()
Returns a shallow copy of this message. |
boolean |
fromInitiator()
Returns whether this message is from the initiator to the other party/parties or an answer. |
AgentIdentity |
getAddressee()
Returns the identity of the recipient of the message. |
long |
getConversationTypeID()
Returns the ID of the type of conversations handling this message. |
long |
getDestConversationID()
Returns the ID of the conversation at the recipient of the message. |
AgentIdentity |
getSender()
Returns the identity of the sender of the message. |
long |
getSrcConversationID()
Returns the ID of the conversation at the sender of the message. |
void |
setAddressee(AgentIdentity addressee)
Set the addressee of the message. |
void |
setConversationTypeID(long id)
Set the type ID for the conversation. |
void |
setDestConversationID(long id)
Set the ID for the conversation at the destination. |
void |
setFromInitiator(boolean fromInitiator)
Sets whether this message is from the initiator to the other party/parties or an answer. |
void |
setSender(AgentIdentity sender)
Set the sender of the message. |
void |
setSrcConversationID(long id)
Set the ID for the conversation at the sender. |
String |
toString()
Returns a string representation of this message. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
protected Message()
protected Message(AgentIdentity sender, AgentIdentity addressee, long convTypeID, long srcConvID, long destConvID, boolean fromInitiator)
sender
- the identity of the sender. Must be provided.addressee
- the identity of the recipient. Must be provided.convTypeID
- ID of the type of the conversation. Must not be 0.srcConvID
- ID of the conversation at the source. May be 0 for replies
to unknown conversations, ... (there is no conversation with those).destConvID
- ID of the conversation at the recipient. May be 0 for initial messages
(starting a conversation) and broadcasts.fromInitiator
- if true
, this message is from the initiator of the conversationprotected Message(MessageType inReplyTo)
Method Detail |
public void setSrcConversationID(long id)
setSrcConversationID
in interface MessageType
id
- the id of the conversation at the sender (may not be 0)public long getSrcConversationID()
getSrcConversationID
in interface MessageType
public void setDestConversationID(long id)
setDestConversationID
in interface MessageType
id
- the id of the conversation at the destination (may not be 0)public long getDestConversationID()
getDestConversationID
in interface MessageType
public boolean fromInitiator()
fromInitiator
in interface MessageType
true
if the message is from the initiator to the other party/partiespublic void setFromInitiator(boolean fromInitiator)
setFromInitiator
in interface MessageType
fromInitiator
- Shall be true
if the message is from the initiator to the other party/parties, false
otherwisepublic void setConversationTypeID(long id)
setConversationTypeID
in interface MessageType
id
- the id of the type of the conversation (may not be 0)public long getConversationTypeID()
getConversationTypeID
in interface MessageType
public void setSender(AgentIdentity sender)
setSender
in interface MessageType
sender
- the sender for the message (may not be null)public AgentIdentity getSender()
getSender
in interface MessageType
public void setAddressee(AgentIdentity addressee)
setAddressee
in interface MessageType
sender
- the addressee for the message (may not be null)public AgentIdentity getAddressee()
getAddressee
in interface MessageType
public Message copy() throws MessageException
MessageException
- if this message cannot be clonedpublic String toString()
toString
in class Object
|
Agent System POND 1.2 (28.2.2002) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |