org.jboss.soa.esb.listeners.message
Class AbstractMessageComposer

java.lang.Object
  extended by org.jboss.soa.esb.listeners.message.AbstractMessageComposer
All Implemented Interfaces:
MessageComposer
Direct Known Subclasses:
BasicMessageComposer, JBossRemotingGatewayListener.JBossRemotingMessageComposer

public abstract class AbstractMessageComposer
extends java.lang.Object
implements MessageComposer

An abstract MessageComposer implementation, containing a useful default implementation.

Implementations should be threadsafe (stateless) and must contain a public default constructor.

Author:
tom.fennelly@jboss.com

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.soa.esb.listeners.message.MessageComposer
MessageComposer.Factory
 
Constructor Summary
AbstractMessageComposer()
           
 
Method Summary
 Message compose(java.lang.Object messagePayload)
          Compose the message.
 java.lang.Object decompose(Message message)
          Decompose the message.
protected abstract  void populateMessage(Message message, java.lang.Object messagePayload)
          Populate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.soa.esb.listeners.message.MessageComposer
setConfiguration
 

Constructor Detail

AbstractMessageComposer

public AbstractMessageComposer()
Method Detail

compose

public Message compose(java.lang.Object messagePayload)
                throws MessageDeliverException
Compose the message.

Override to implement alternative Message construction strategy.

Specified by:
compose in interface MessageComposer
Parameters:
messagePayload - Message payload to be packaged, or a channel specific container class for the message payload (e.g. a JMS message).
Returns:
ESB aware message instance.
Throws:
MessageDeliverException - Failed to compose message payload for delivery.

decompose

public java.lang.Object decompose(Message message)
                           throws MessageDeliverException
Decompose the message.

This implementation simple calls ActionUtils.getTaskObject(org.jboss.soa.esb.message.Message). Override to implement an alternative Message decomposition strategy.

Specified by:
decompose in interface MessageComposer
Parameters:
message - The message to be decomposed.
Returns:
The message "task object".
Throws:
MessageDeliverException

populateMessage

protected abstract void populateMessage(Message message,
                                        java.lang.Object messagePayload)
                                 throws MessageDeliverException
Populate

Parameters:
message - The message instance to be populated.
messagePayload - The message payload to to be populated into the message.
Throws:
MessageDeliverException - Unable to populate message with payload.