FourMS
Class MessageDispatcher

java.lang.Object
  extended by FourMS.MessageDispatcher
Direct Known Subclasses:
FourMSControllerMessageDispatcher

public abstract class MessageDispatcher
extends java.lang.Object

This class is a base class for the message dispatcher subclasses. It provides methods to process the incoming message to assist the dispatcher in distributing the instructions that have come in to the objects which will be responsible for performing the semantics associated with the instruction. For instance, sometimes a ER412 protocol message may be sent to the software which may have many instructions to be carried out by the software system e.g. AFS200() MFW100() MFW101(100)

Version:
$Id: MessageDispatcher.java,v 1.4 2006/04/07 08:05:39 cb Exp $
Author:
Craige Bevil


Field Summary
private  FourMSMessage currentMessageToProcess
          This is message which is currently being processed by the class and will be used for returning the next 4MS instruction
private  int NextMessageToReturn
          This is the next message to return when the caller calls the ExtractNext4MSInstruction method.
 
Constructor Summary
MessageDispatcher()
           
 
Method Summary
 java.lang.String ExtractNext4MSInstruction()
          This method will return the next instruction to be processed by the system.
 java.lang.String ExtractNext4MSInstruction(FourMSMessage IncomingMessageData)
          This method will return the next instruction to be processed by the system.
private  java.lang.String fetchNextMessage()
          This will be used to return the next 4MS message if there is one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NextMessageToReturn

private int NextMessageToReturn
This is the next message to return when the caller calls the ExtractNext4MSInstruction method. This will be reset when the caller provides another 4MSMessage object to process.


currentMessageToProcess

private FourMSMessage currentMessageToProcess
This is message which is currently being processed by the class and will be used for returning the next 4MS instruction

Constructor Detail

MessageDispatcher

public MessageDispatcher()
Method Detail

ExtractNext4MSInstruction

public java.lang.String ExtractNext4MSInstruction()
This method will return the next instruction to be processed by the system. Before using this method, the user should have initialised the message extractor by providing the 4MS message to be processed. Subsequent calls to the method without the 4MS message will result in the next message being retrieved should it exist. If no more messages are available then this method will return null.

Returns:
java.lang.String

ExtractNext4MSInstruction

public java.lang.String ExtractNext4MSInstruction(FourMSMessage IncomingMessageData)
This method will return the next instruction to be processed by the system. If no more messages are available then this method should return null.

Parameters:
IncomingMessageData - This will be stored and subsequent calls to this method without this parameter specified will result in the next message being returned.
Returns:
java.lang.String

fetchNextMessage

private java.lang.String fetchNextMessage()
This will be used to return the next 4MS message if there is one. If there is no message then null will be returned

Returns:
String This is the next message to be dispatched.