All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sics.agentbase.kqml.KQMLMessage

java.lang.Object
   |
   +----sics.agentbase.core.Message
           |
           +----sics.agentbase.core.AgentMessage
                   |
                   +----sics.agentbase.kqml.KQMLMessage

public class KQMLMessage
extends AgentMessage
KQMLMessage is a class that represents the fields of a KQML message. It deals with all the valid KQML performatives.


Constructor Index

 o KQMLMessage()
Constructs a new empty KQMLMessage.

Method Index

 o getContent()
Returns the parsed content of this message.
 o getContentLanguage()
Returns the content language for this message.
 o getInReplyTo()
Returns the id to which this message is a reply.
 o getLocalReceiver()
Returns the local receiver of this message (the name of the object to deliver this message to).
 o getOntology()
Returns the ontology of this message.
 o getReceiver()
Returns the receiver of this message.
 o getReplyWith()
Returns the id to be used when replying to this message.
 o getSender()
Returns the sender of this message.
 o main(String[])
 o readMessage(InputStream)
Reads a message from the specified input stream.
 o send()
Sends this message to this message's receiver.
 o setContent(Object)
Sets the content for this message.
 o setContentLanguage(String)
Sets the content language for this message.
 o setDefaultContentLanguage(String)
Sets the default content language for all KQMLMessages.
 o setInReplyTo(String)
Sets the id of the message to which this message is a reply.
 o setOntology(String)
Sets the ontology of this message.
 o setReceiver(String)
Sets the receiver of this message.
 o setReplyWith(String)
Sets the id to be used when replying to this message.
 o setSender(String)
Sets the sender of this message.
 o toString()
Returns a string representation of this message.

Constructors

 o KQMLMessage
 public KQMLMessage()
Constructs a new empty KQMLMessage.

Methods

 o setDefaultContentLanguage
 public static void setDefaultContentLanguage(String cl)
Sets the default content language for all KQMLMessages.

Parameters:
cl - the default content language to use.
See Also:
getContentLanguage, getContent
 o getSender
 public synchronized String getSender()
Returns the sender of this message.

Returns:
the sender of this message or null if none exists.
 o 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
 o getReceiver
 public synchronized String getReceiver()
Returns the receiver of this message.

Returns:
the receiver of this message or null if no receiver exists.
 o getOntology
 public synchronized String getOntology()
Returns the ontology of this message.

Returns:
the ontology of this message or null if none exists.
 o 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.
 o 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.
 o 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
 o 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
 o setSender
 public void setSender(String sender)
Sets the sender of this message.

Parameters:
sender - the name of the sender.
 o setReceiver
 public void setReceiver(String receiver)
Sets the receiver of this message.

Parameters:
receiver - the name of the receiver.
 o setOntology
 public void setOntology(String ontology)
Sets the ontology of this message.

Parameters:
ontology - the ontology.
 o 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.
 o 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.
 o setContentLanguage
 public void setContentLanguage(String language)
Sets the content language for this message.

Parameters:
language - the content language to set.
 o 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.
 o 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
 o 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
 o toString
 public synchronized String toString()
Returns a string representation of this message.

Returns:
a string representation of this message.
Overrides:
toString in class AgentMessage
 o main
 public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index