com.cafesoft.core.message
Class MessageTranslatorRegistry

java.lang.Object
  |
  +--com.cafesoft.core.message.MessageTranslatorRegistry
All Implemented Interfaces:
Recyclable

public class MessageTranslatorRegistry
extends Object
implements Recyclable

Registers MessageTranslator objects that are responsible for encoding and decoding Message content. It provides methods to lookup a translator by content type.

Since:
2/6/02

Field Summary
protected  Map translatorMap
          The translator map.
 
Constructor Summary
MessageTranslatorRegistry()
          Construct a new MessageTranslatorRegistry.
 
Method Summary
 void addMessageTranslator(String contentType, MessageTranslator translator)
          Add a message translator to the registry
 Collection getContentTypes()
          Returns all message translator descriptors from the registry.
 MessageTranslator getMessageTranslator(String contentType)
          Returns a message translator from the registry.
 Collection getMessageTranslators()
          Returns all message translators from the registry.
 void recycle()
          Recycle the resources of this object
 void removeMessageTranslator(String contentType, MessageTranslator translator)
          Remove a message translator from the registry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

translatorMap

protected Map translatorMap
The translator map.

Constructor Detail

MessageTranslatorRegistry

public MessageTranslatorRegistry()
Construct a new MessageTranslatorRegistry.

Method Detail

recycle

public void recycle()
Recycle the resources of this object

Specified by:
recycle in interface Recyclable

addMessageTranslator

public void addMessageTranslator(String contentType,
                                 MessageTranslator translator)
                          throws MessageTranslatorException
Add a message translator to the registry

Parameters:
contentType - describes a type of Message that can be translated
translator - the MessageTranslator to add
MessageTranslatorException

removeMessageTranslator

public void removeMessageTranslator(String contentType,
                                    MessageTranslator translator)
                             throws MessageTranslatorException
Remove a message translator from the registry

Parameters:
contentType - describes a type of Message that can be translated
translator - the MessageTranslator to remove
MessageTranslatorException

getMessageTranslator

public MessageTranslator getMessageTranslator(String contentType)
                                       throws MessageTranslatorException
Returns a message translator from the registry.

Parameters:
contentType - the contentType of the MessageTranslator
MessageTranslatorException

getContentTypes

public Collection getContentTypes()
Returns all message translator descriptors from the registry.

Returns:
a Collection of all registered message translator descriptors

getMessageTranslators

public Collection getMessageTranslators()
Returns all message translators from the registry.

Returns:
a Collection of all unique registered message translators


Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.