message
Interface MessageCentre

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
MessageCentreImpl

public interface MessageCentre
extends java.io.Serializable

Storage and retrieval of portlet message mappings, and the messages.

See Also:
MessageCentreImpl

Method Summary
 void addInputMapping(MessageBoxKey key, MessageBoxKey source)
           
 void addInputMapping(java.lang.String portletID, java.lang.String name, MessageBoxKey source)
          Set a portlet message key => message box mapping.
 void addOutputMapping(MessageBoxKey key, MessageBoxKey target)
           
 void addOutputMapping(java.lang.String portletID, java.lang.String name, MessageBoxKey target)
          Add a portlet message key => message box mapping.
 MessageBoxKey findInputSource(MessageBoxKey key)
           
 MessageBoxKey findInputSource(java.lang.String portletID, java.lang.String name)
          Get the key of the source message box for this portletID+name combination.
 java.util.Set findOutputTargets(MessageBoxKey key)
           
 java.util.Set findOutputTargets(java.lang.String portletID, java.lang.String name)
          This will always return a Set which contains at least a key for a message box corresponding to the provided portletID+name (it always outputs to itself as well as any other registered mappings)
 java.lang.Object get(MessageBoxKey boxKey)
          Get message from this message box.
 java.lang.Object get(java.lang.String portletID, java.lang.String name)
          Get message for this portletID+name combination.
 java.util.Set getAllInputKeys()
           
 java.util.Set getAllOutputKeys()
           
 java.util.Map getBoxes()
           
 java.util.Set getInputKeys(java.lang.String portletID)
           
 java.util.Set getOutputKeys(java.lang.String portletID)
           
 java.util.Set getPublicBoxKeys()
           
 void removeAllOutputMappings(MessageBoxKey key)
           
 void removeInputMapping(java.lang.String portletID, java.lang.String name)
          Remove a message key => message box mapping.
 void send(java.util.Set targetKeys, java.lang.Object message)
          Send message to these message boxes.
 void send(java.lang.String portletID, java.lang.String name, java.lang.Object message)
          Send message to this portletID+name combination.
 

Method Detail

addInputMapping

public void addInputMapping(java.lang.String portletID,
                            java.lang.String name,
                            MessageBoxKey source)
Set a portlet message key => message box mapping. This will overwrite any existing input mapping.

Parameters:
portletID - ID of the portlet which is receiving the input
name - (local) name of the portlet input, referred to in the portlet's code
source - the message box from which the portlet's input will read.

addInputMapping

public void addInputMapping(MessageBoxKey key,
                            MessageBoxKey source)

removeInputMapping

public void removeInputMapping(java.lang.String portletID,
                               java.lang.String name)
Remove a message key => message box mapping. As there can only be 1 mapping for each input, this will result in the default mapping: looking for a local portlet message of the same name.


addOutputMapping

public void addOutputMapping(java.lang.String portletID,
                             java.lang.String name,
                             MessageBoxKey target)
Add a portlet message key => message box mapping. This will be in addition to any existing output mappings; the message will be copied to all mapped output targets.

Parameters:
portletID - ID of the portlet which is sending the output
name - (local) name of the portlet output, referred to in the portlet's code
target - the message box to which the portlet's output will copy its message.

addOutputMapping

public void addOutputMapping(MessageBoxKey key,
                             MessageBoxKey target)

removeAllOutputMappings

public void removeAllOutputMappings(MessageBoxKey key)

findOutputTargets

public java.util.Set findOutputTargets(java.lang.String portletID,
                                       java.lang.String name)
This will always return a Set which contains at least a key for a message box corresponding to the provided portletID+name (it always outputs to itself as well as any other registered mappings)

Returns:
Set of MessageBoxKey's: the output keys registered for this portletID+name

findOutputTargets

public java.util.Set findOutputTargets(MessageBoxKey key)

findInputSource

public MessageBoxKey findInputSource(java.lang.String portletID,
                                     java.lang.String name)
Get the key of the source message box for this portletID+name combination. If no mapping is found, returns a MessageBoxKey for this portletID+name.


findInputSource

public MessageBoxKey findInputSource(MessageBoxKey key)

get

public java.lang.Object get(java.lang.String portletID,
                            java.lang.String name)
Get message for this portletID+name combination. If there is no mapping to a message box defined for the specified portletID+name, it tries to find a local message box of the same name. If there is no message, returns null.


get

public java.lang.Object get(MessageBoxKey boxKey)
Get message from this message box. If there is no message, returns null.


send

public void send(java.lang.String portletID,
                 java.lang.String name,
                 java.lang.Object message)
Send message to this portletID+name combination. It will be delivered to a local message box with this name. It will also be delivered to all message boxes for which mappings have been registered for this portletID+name using addMapping. It will replace any message already in the boxes.


send

public void send(java.util.Set targetKeys,
                 java.lang.Object message)
Send message to these message boxes. It will replace any message already in the boxes, or remove the box if 'message' is null.

Parameters:
targetKeys - Set of MessageBoxKeys to which the message should be sent

getInputKeys

public java.util.Set getInputKeys(java.lang.String portletID)

getOutputKeys

public java.util.Set getOutputKeys(java.lang.String portletID)

getPublicBoxKeys

public java.util.Set getPublicBoxKeys()

getBoxes

public java.util.Map getBoxes()

getAllInputKeys

public java.util.Set getAllInputKeys()

getAllOutputKeys

public java.util.Set getAllOutputKeys()