org.gudy.azureus2.pluginsimpl.local.messaging
Class MessageManagerImpl

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.messaging.MessageManagerImpl
All Implemented Interfaces:
NATTraversalHandler, MessageManager

public class MessageManagerImpl
extends Object
implements MessageManager, NATTraversalHandler


Field Summary
 
Fields inherited from interface org.gudy.azureus2.plugins.messaging.MessageManager
STREAM_ENCRYPTION_NONE, STREAM_ENCRYPTION_RC4_PREFERRED, STREAM_ENCRYPTION_RC4_REQUIRED
 
Method Summary
 void cancelCompatiblePeersLocation(MessageManagerListener orig_listener)
          Cancel registration for compatible-peer notification.
 void deregisterMessageType(Message message)
          Remove registration of given message type from manager.
protected  GenericMessageHandler getHandler(String type)
           
 String getName()
           
 NATTraverser getNATTraverser()
           
static MessageManagerImpl getSingleton(AzureusCore core)
           
 int getType()
           
 void locateCompatiblePeers(PluginInterface plug_interface, Message message, MessageManagerListener listener)
          Globally register for notification of peers that support the given message type.
 Map process(InetSocketAddress originator, Map message)
           
 GenericMessageRegistration registerGenericMessageType(String _type, String description, int stream_crypto, GenericMessageHandler handler)
          Register a peer-independent message handler
 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
 

Method Detail

getSingleton

public static MessageManagerImpl getSingleton(AzureusCore core)

getNATTraverser

public NATTraverser getNATTraverser()

registerMessageType

public void registerMessageType(Message message)
                         throws MessageException
Description copied from interface: MessageManager
Register the given message type with the manager for processing. NOTE: A message type needs to be registered in order for support to be advertised to other peers.

Specified by:
registerMessageType in interface MessageManager
Parameters:
message - instance to use for decoding
Throws:
MessageException - if this message type has already been registered

deregisterMessageType

public void deregisterMessageType(Message message)
Description copied from interface: MessageManager
Remove registration of given message type from manager.

Specified by:
deregisterMessageType in interface MessageManager
Parameters:
message - type to remove

locateCompatiblePeers

public void locateCompatiblePeers(PluginInterface plug_interface,
                                  Message message,
                                  MessageManagerListener listener)
Description copied from interface: MessageManager
Globally register for notification of peers that support the given message type.

Specified by:
locateCompatiblePeers in interface MessageManager
Parameters:
plug_interface - to get the download manager
message - to match
listener - to notify

cancelCompatiblePeersLocation

public void cancelCompatiblePeersLocation(MessageManagerListener orig_listener)
Description copied from interface: MessageManager
Cancel registration for compatible-peer notification.

Specified by:
cancelCompatiblePeersLocation in interface MessageManager
Parameters:
orig_listener - listener used for registration

registerGenericMessageType

public GenericMessageRegistration registerGenericMessageType(String _type,
                                                             String description,
                                                             int stream_crypto,
                                                             GenericMessageHandler handler)
                                                      throws MessageException
Description copied from interface: MessageManager
Register a peer-independent message handler

Specified by:
registerGenericMessageType in interface MessageManager
Returns:
Throws:
MessageException

getHandler

protected GenericMessageHandler getHandler(String type)

getType

public int getType()
Specified by:
getType in interface NATTraversalHandler

getName

public String getName()
Specified by:
getName in interface NATTraversalHandler

process

public Map process(InetSocketAddress originator,
                   Map message)
Specified by:
process in interface NATTraversalHandler