org.planx.xmlstore.routing.operation
Class MessageFactoryImpl

java.lang.Object
  extended by org.planx.xmlstore.routing.operation.MessageFactoryImpl
All Implemented Interfaces:
MessageFactory

public class MessageFactoryImpl
extends Object
implements MessageFactory

Essentially this class translates numbers into classes. Given a message code it can create a Message object or a Receiver.

Author:
Thomas Ambus

Field Summary
static byte CODE_ACKNOWLEDGE
           
static byte CODE_CONNECT
           
static byte CODE_DATA
           
static byte CODE_DATA_LOOKUP
           
static byte CODE_HASH
           
static byte CODE_HASH_REQUEST
           
static byte CODE_NODE_LOOKUP
           
static byte CODE_NODE_REPLY
           
static byte CODE_REMOVE
           
static byte CODE_STORE
           
static byte CODE_STORE_REQUEST
           
 
Constructor Summary
MessageFactoryImpl(Map localMap, Node local, Space space)
           
 
Method Summary
 Message createMessage(byte code, DataInput in)
          Creates a Message of type code from the specified stream.
 Receiver createReceiver(byte code, MessageServer server)
          Creates a Receiver for handling a Message of type code.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CODE_CONNECT

public static final byte CODE_CONNECT
See Also:
Constant Field Values

CODE_ACKNOWLEDGE

public static final byte CODE_ACKNOWLEDGE
See Also:
Constant Field Values

CODE_NODE_LOOKUP

public static final byte CODE_NODE_LOOKUP
See Also:
Constant Field Values

CODE_NODE_REPLY

public static final byte CODE_NODE_REPLY
See Also:
Constant Field Values

CODE_DATA_LOOKUP

public static final byte CODE_DATA_LOOKUP
See Also:
Constant Field Values

CODE_DATA

public static final byte CODE_DATA
See Also:
Constant Field Values

CODE_STORE

public static final byte CODE_STORE
See Also:
Constant Field Values

CODE_STORE_REQUEST

public static final byte CODE_STORE_REQUEST
See Also:
Constant Field Values

CODE_HASH

public static final byte CODE_HASH
See Also:
Constant Field Values

CODE_HASH_REQUEST

public static final byte CODE_HASH_REQUEST
See Also:
Constant Field Values

CODE_REMOVE

public static final byte CODE_REMOVE
See Also:
Constant Field Values
Constructor Detail

MessageFactoryImpl

public MessageFactoryImpl(Map localMap,
                          Node local,
                          Space space)
Method Detail

createMessage

public Message createMessage(byte code,
                             DataInput in)
                      throws IOException,
                             UnknownMessageException
Description copied from interface: MessageFactory
Creates a Message of type code from the specified stream.

Specified by:
createMessage in interface MessageFactory
Throws:
UnknownMessageException - if the message code type is not supported
IOException

createReceiver

public Receiver createReceiver(byte code,
                               MessageServer server)
Description copied from interface: MessageFactory
Creates a Receiver for handling a Message of type code. If no standard Receiver should handle the message null is returned. In this case, an application specific receiver will be used if one is registered.

Specified by:
createReceiver in interface MessageFactory


Copyright © 2010. All Rights Reserved.