gumbo.net.msg
Class MessageAgent.Handler

java.lang.Object
  |
  +--gumbo.net.msg.MessageHandler
        |
        +--gumbo.net.msg.MessageAgent.Handler
All Implemented Interfaces:
MessageListener
Enclosing class:
MessageAgent

protected abstract class MessageAgent.Handler
extends MessageHandler

Used by subclasses to handle messages received from this agent's message router (see addHandler()). Includes status and problem reporting, with all message related exceptions (Exception) being caught.


Constructor Summary
MessageAgent.Handler(java.lang.String action, java.lang.Class type)
          Creates an instance, which listens for the specified message type.
 
Method Summary
protected abstract  void implProcessMessage(Message message)
          Called by the system when a message is received.
 void processMessage(Message message, MessageWriter writer)
          Called when the listener needs to process a new message.
 
Methods inherited from class gumbo.net.msg.MessageHandler
getMessageTypes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageAgent.Handler

public MessageAgent.Handler(java.lang.String action,
                            java.lang.Class type)
Creates an instance, which listens for the specified message type.

Parameters:
action - The name of the action performed by the message (such as "open source window"), which is used for status and error reporting. Never null.
type - Message type. Never null.
Method Detail

implProcessMessage

protected abstract void implProcessMessage(Message message)
Called by the system when a message is received. The system handles all general status and problem reporting, and catches all exceptions (Exception) thrown.


processMessage

public final void processMessage(Message message,
                                 MessageWriter writer)
Description copied from interface: MessageListener
Called when the listener needs to process a new message. Presumably the message type (subclass) is one that the listener is interested in (see MessageRouter).

Parameters:
message - The message to be handled. Never null.
writer - Message writer to be used for sending a reply message (on the router thread). Null if none.