edu.sdsc.inca.protocol
Class MessageHandler

java.lang.Object
  extended by edu.sdsc.inca.protocol.MessageHandler
Direct Known Subclasses:
GetLog, LogConfig, Ping, VerifyProtocolVersion

public abstract class MessageHandler
extends java.lang.Object

Author:
Cathie Olschanowsky, Jim Hayes The MessageHandler class should help guide the creation of all of the message handlers for each Inca server.

Field Summary
protected static org.apache.log4j.Logger logger
          logger that can be used by all MessageHandlers.
 
Constructor Summary
MessageHandler()
           
 
Method Summary
static void errorReply(ProtocolWriter writer, java.lang.String msg)
          A convenience method that logs and writes an error message.
abstract  void execute(ProtocolReader reader, ProtocolWriter writer)
          Execute should run the task using the reader and writer for in/output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
logger that can be used by all MessageHandlers.

Constructor Detail

MessageHandler

public MessageHandler()
Method Detail

execute

public abstract void execute(ProtocolReader reader,
                             ProtocolWriter writer)
                      throws java.lang.Exception
Execute should run the task using the reader and writer for in/output. Close the reader and writer to indicate that the client connection should be closed.

Throws:
java.lang.Exception

errorReply

public static void errorReply(ProtocolWriter writer,
                              java.lang.String msg)
A convenience method that logs and writes an error message.

Parameters:
writer - the writer to use to send the error message
msg - the error message