All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sics.agentbase.core.MessageDispatcher

java.lang.Object
   |
   +----sics.agentbase.core.MessageDispatcher

public class MessageDispatcher
extends Object

Constructor Index

 o MessageDispatcher()

Method Index

 o addMessageListener(String, MessageListener)
Adds a message listener with the specified name.
 o deliverMessage(Message)
Delivers a message to a message listener.
 o getDefaultMessageDispatcher()
Returns the default MessageDispatcher.
 o getMessageListener(String)
Returns the message listener with the specified name.
 o removeMessageListener(String)
Removes the message listener with the specified name.

Constructors

 o MessageDispatcher
 public MessageDispatcher()

Methods

 o getDefaultMessageDispatcher
 public static MessageDispatcher getDefaultMessageDispatcher()
Returns the default MessageDispatcher.

Returns:
the default MessageDispatcher object.
 o addMessageListener
 public synchronized void addMessageListener(String name,
                                             MessageListener listener)
Adds a message listener with the specified name.

Parameters:
name - the name of the message listener to add.
listener - the message listener to be added.
 o removeMessageListener
 public synchronized void removeMessageListener(String name)
Removes the message listener with the specified name.

Parameters:
name - the name of the message listener to remove.
 o getMessageListener
 public MessageListener getMessageListener(String name)
Returns the message listener with the specified name.

Parameters:
name - the name of the message listener to return.
Returns:
the message listener or null if no message listener with the specified name exists.
 o deliverMessage
 public void deliverMessage(Message msg)
Delivers a message to a message listener. The value returned from the method getLocalReceiver in the message is used to deliver the message to a message listener with matching name.

If no message listener can be found, the method error in the message is invoked with the error RECEIVER_UNKNOWN.

Parameters:
msg - the message to be added.
See Also:
RECEIVER_UNKNOWN, getLocalReceiver, error

All Packages  Class Hierarchy  This Package  Previous  Next  Index