nl.west.aaa
Class MessageHandlerContainer

java.lang.Object
  |
  +--nl.west.aaa.MessageHandlerContainer
Direct Known Subclasses:
AAAUnit, DomainHandler

public class MessageHandlerContainer
extends java.lang.Object
implements MessageHandler

Class that handles incoming messages by sending them to registered handlers.


Field Summary
protected  java.util.Vector messageHandlers
          The registered handlers of incoming messages.
 
Constructor Summary
MessageHandlerContainer()
           
 
Method Summary
 void addMessageHandler(MessageHandler handler)
          Register the MessageHandler as a handler of incoming messages.
 boolean handleMessage(Message msg, AAAUnit unit)
          Try sending the message to the handlers.
 void removeMessageHandler(MessageHandler handler)
          Remove the given MessageHandler from the list of registered MessageHandlers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageHandlers

protected java.util.Vector messageHandlers
The registered handlers of incoming messages. The first handler should be tried first.
Constructor Detail

MessageHandlerContainer

public MessageHandlerContainer()
Method Detail

handleMessage

public boolean handleMessage(Message msg,
                             AAAUnit unit)
Try sending the message to the handlers. If a handler responds positive true is returned, otherwise false is returned.
Specified by:
handleMessage in interface MessageHandler

addMessageHandler

public void addMessageHandler(MessageHandler handler)
Register the MessageHandler as a handler of incoming messages. All incoming messages that are not replies to sent messages are fed through the registered MessageHandlers.

removeMessageHandler

public void removeMessageHandler(MessageHandler handler)
Remove the given MessageHandler from the list of registered MessageHandlers.



Arthur <arthur@ch.twi.tudelft.nl> http://ch.twi.tudelft.nl/~arthur/
2002-05-27