com.aelitis.azureus.core.peermanager.messaging
Class MessageManager

java.lang.Object
  extended by com.aelitis.azureus.core.peermanager.messaging.MessageManager

public class MessageManager
extends java.lang.Object


Field Summary
protected  AEMonitor this_mon
           
 
Method Summary
 Message createMessage(byte[] id_bytes, DirectByteBuffer message_data, byte version)
          Construct a new message instance from the given message information.
 void deregisterMessageType(Message message)
          Remove registration of given message type from manager.
 Message[] getRegisteredMessages()
          Get a list of the registered messages.
static MessageManager getSingleton()
           
 void initialize()
          Perform manager initialization.
 Message lookupMessage(byte[] id_bytes)
           
 Message lookupMessage(java.lang.String id)
          Lookup a registered message type via id and version.
 void registerMessageType(Message message)
          Register the given message type with the manager for processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

this_mon

protected final AEMonitor this_mon
Method Detail

getSingleton

public static MessageManager getSingleton()

initialize

public void initialize()
Perform manager initialization.


registerMessageType

public void registerMessageType(Message message)
                         throws MessageException
Register the given message type with the manager for processing.

Parameters:
message - instance to use for decoding
Throws:
MessageException - if this message type has already been registered

deregisterMessageType

public void deregisterMessageType(Message message)
Remove registration of given message type from manager.

Parameters:
message - type to remove

createMessage

public Message createMessage(byte[] id_bytes,
                             DirectByteBuffer message_data,
                             byte version)
                      throws MessageException
Construct a new message instance from the given message information.

Parameters:
id - of message
message_data - payload
Returns:
decoded/deserialized message
Throws:
MessageException - if message creation failed

lookupMessage

public Message lookupMessage(java.lang.String id)
Lookup a registered message type via id and version.

Parameters:
id - to look for
Returns:
the default registered message instance if found, otherwise returns null if this message type is not registered

lookupMessage

public Message lookupMessage(byte[] id_bytes)

getRegisteredMessages

public Message[] getRegisteredMessages()
Get a list of the registered messages.

Returns:
messages