All Packages Class Hierarchy This Package Previous Next Index
Class sics.agentbase.mil.MILMessage
java.lang.Object
|
+----sics.agentbase.core.Message
|
+----sics.agentbase.core.AgentMessage
|
+----sics.agentbase.mil.MILMessage
- public class MILMessage
- extends AgentMessage
The MILMessage class implements a MIL message.
-
MILMessage()
- Constructs a new empty MILMessage.
-
getContent()
- Returns the parsed content of this message.
-
getContentLanguage()
- Returns the content language for this message.
-
getInReplyTo()
- Returns the id to which this message is a reply.
-
getLocalReceiver()
- Returns the local receiver of this message (the name of the object
to deliver this message to).
-
getReceiver()
- Returns the receiver of this message.
-
getReplyWith()
- Returns the id to be used when replying to this message.
-
getSender()
- Returns the sender of this message.
-
main(String[])
- Test program.
-
readMessage(InputStream)
- Reads a message from the specified input stream.
-
send()
- Sends this message to this message's receiver.
-
setContent(Object)
- Sets the content for this message.
-
setContentLanguage(String)
- Sets the content language for this message.
-
setDefaultContentLanguage(String)
- Sets the default content language for all MILMessages.
-
setInReplyTo(String)
- Sets the id of the message to which this message is a reply.
-
setReceiver(String)
- Sets the receiver of this message.
-
setReplyWith(String)
- Sets the id to be used when replying to this message.
-
setSender(String)
- Sets the sender of this message.
-
toString()
- Returns a string representation of this message.
MILMessage
public MILMessage()
- Constructs a new empty MILMessage.
setDefaultContentLanguage
public static void setDefaultContentLanguage(String cl)
- Sets the default content language for all MILMessages.
- Parameters:
- cl - the default content language to use.
- See Also:
- getContentLanguage, getContent
getSender
public synchronized String getSender()
- Returns the sender of this message.
- Returns:
- the sender of this message or
null if none exists.
getLocalReceiver
public String getLocalReceiver()
- Returns the local receiver of this message (the name of the object
to deliver this message to).
Overrides the getLocalReceiver from Message since
it is not automatically set when parsing agent messages.
- Returns:
- the local receiver of this message or
null if no
receiver exists.
- Overrides:
- getLocalReceiver in class Message
getReceiver
public synchronized String getReceiver()
- Returns the receiver of this message.
- Returns:
- the receiver of this message or
null if no receiver
exists.
getInReplyTo
public synchronized String getInReplyTo()
- Returns the id to which this message is a reply.
- Returns:
- the id to which this message is a reply or
null if none exists.
getReplyWith
public synchronized String getReplyWith()
- Returns the id to be used when replying to this message.
- Returns:
- the id to be used when repying to this message
or
null if none exists.
getContentLanguage
public synchronized String getContentLanguage()
- Returns the content language for this message.
If no content language exists, the default content language is returned.
- Returns:
- the content language for this message.
- See Also:
- setDefaultContentLanguage
getContent
public synchronized Object getContent() throws IOException
- Returns the parsed content of this message.
The content language is used to find a content handler for parsing
the content. If no content language is set, the default
content language is used instead.
- Returns:
- the parsed content of this message or
null if
none exists.
- Throws: IOException
- if an I/O or parse error occurs.
- See Also:
- setDefaultContentLanguage
setSender
public void setSender(String sender)
- Sets the sender of this message.
- Parameters:
- sender - the name of the sender.
setReceiver
public void setReceiver(String receiver)
- Sets the receiver of this message.
- Parameters:
- receiver - the name of the receiver.
setInReplyTo
public void setInReplyTo(String id)
- Sets the id of the message to which this message is a reply.
- Parameters:
- id - the id of the message to which this message is a reply.
setReplyWith
public void setReplyWith(String id)
- Sets the id to be used when replying to this message.
- Parameters:
- id - the id to be used when replying.
setContentLanguage
public void setContentLanguage(String language)
- Sets the content language for this message.
- Parameters:
- language - the content language to set.
setContent
public synchronized void setContent(Object content)
- Sets the content for this message.
When generating a message, the method
toString is invoked
in the content object to get a string representation.
The content language is used at reception to find a content handler
capable of parsing the string representation back to its
internal representation.
- Parameters:
- content - the content to set.
send
public synchronized void send() throws IOException
- Sends this message to this message's receiver.
- Throws: IOException
- if the message could not be sent.
- Overrides:
- send in class Message
readMessage
public synchronized void readMessage(InputStream stream) throws IOException
- Reads a message from the specified input stream.
- Parameters:
- stream - the input stream to read from.
- Throws: IOException
- if an I/O or parse error occurs.
- Overrides:
- readMessage in class AgentMessage
toString
public synchronized String toString()
- Returns a string representation of this message.
- Returns:
- a string representation of this message.
- Overrides:
- toString in class AgentMessage
main
public static void main(String args[])
- Test program.
All Packages Class Hierarchy This Package Previous Next Index