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
-
connectionManager
- The connection manager that deliveres messages.
-
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.
-
MessageHandler(ConnectionManager, MessageHandler)
- Creates a new message handler.
-
getConnectionManager()
- Returns the connection manager.
-
getSuccessor()
- Returns the successor in the message handler chain.
-
handle(Message)
- This method should be overridden in subclasses to actually handle
the given message.
-
setConnectionManager(ConnectionManager)
- Sets the connection manager.
-
setSuccessor(MessageHandler)
- Sets the successor in the message handler chain.
connectionManager
private ConnectionManager connectionManager
- The connection manager that deliveres messages.
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.
MessageHandler
public MessageHandler(ConnectionManager ml,
MessageHandler succ)
- Creates a new message handler. Sets the successor and connection manager.
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.
getConnectionManager
protected ConnectionManager getConnectionManager()
- Returns the connection manager.
setConnectionManager
protected void setConnectionManager(ConnectionManager ml)
- Sets the connection manager.
getSuccessor
protected MessageHandler getSuccessor()
- Returns the successor in the message handler chain.
setSuccessor
protected void setSuccessor(MessageHandler succ)
- Sets the successor in the message handler chain.
All Packages Class Hierarchy This Package Previous Next Index