edu.sdsc.inca.protocol
Class MessageHandlerFactory
java.lang.Object
edu.sdsc.inca.protocol.MessageHandlerFactory
public class MessageHandlerFactory
- extends java.lang.Object
- Author:
- Cathie Olschanowsky
This factory reads a protocol stream and instantiates MessageHandler
classes. MessageHandler classes can be added using the addTask method.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MessageHandlerFactory
public MessageHandlerFactory()
newInstance
public static MessageHandler newInstance(ProtocolReader reader)
throws java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.io.IOException,
ProtocolException
- Returns an instance of a MessageHandler based on the next command coming
over a connection. Returns null on end of stream.
- Parameters:
reader
- the reader from which the next command is read
- Returns:
- the Task Handler mapped to the next command.
- Throws:
java.lang.IllegalAccessException
java.lang.InstantiationException
- Some problem instatiating the implemenation
java.io.IOException
- Problem reader next command
ProtocolException
- Bad data/unknown command in the input stream
registerMessageHandler
public static void registerMessageHandler(java.lang.String command,
java.lang.String handler)
- Add a task to the known list.
Every server that uses this class will need to do this.
- Parameters:
command
- The Command as it will be seen in the protocolhandler
- The handler that should be invoked upon this command