All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class connection.MessageHandler

java.lang.Object
   |
   +----connection.MessageHandler

public class MessageHandler
extends Object
MessageHandler is a super class for all message handlers. It implements a mechanism for chaining message handlers and delivering a message through the chain until it reaches a handler that handles the message. Messages must subclasses of Message.

MessageHandler holds a reference to its successor in the message handler chain and a reference to the ConnectionManager who deliveres messages.

Version:
0.30, 1998/04/01
Author:
FRED development team, Antti Viljamaa, Jukka Viljamaa
See Also:
Message

Variable Index

 o connectionManager
The connection manager that deliveres messages.
 o successor
The possible successor of this message handler to which the message should be redirected if the handler does not know how to (fully) handle the message.

Constructor Index

 o MessageHandler(ConnectionManager, MessageHandler)
Creates a new message handler.

Method Index

 o getConnectionManager()
Returns the connection manager.
 o getSuccessor()
Returns the successor in the message handler chain.
 o handle(Message)
This method should be overridden in subclasses to actually handle the given message.
 o setConnectionManager(ConnectionManager)
Sets the connection manager.
 o setSuccessor(MessageHandler)
Sets the successor in the message handler chain.

Variables

 o connectionManager
 private ConnectionManager connectionManager
The connection manager that deliveres messages.

 o successor
 private MessageHandler successor
The possible successor of this message handler to which the message should be redirected if the handler does not know how to (fully) handle the message.

Constructors

 o MessageHandler
 public MessageHandler(ConnectionManager ml,
                       MessageHandler succ)
Creates a new message handler. Sets the successor and connection manager.

Methods

 o handle
 public boolean handle(Message m)
This method should be overridden in subclasses to actually handle the given message. If the handler does not recognize the message it should call super.handle(m), so that the message gets forwarded to the next handler.

 o getConnectionManager
 protected ConnectionManager getConnectionManager()
Returns the connection manager.

 o setConnectionManager
 protected void setConnectionManager(ConnectionManager ml)
Sets the connection manager.

 o getSuccessor
 protected MessageHandler getSuccessor()
Returns the successor in the message handler chain.

 o setSuccessor
 protected void setSuccessor(MessageHandler succ)
Sets the successor in the message handler chain.


All Packages  Class Hierarchy  This Package  Previous  Next  Index