org.mule.transport
Class DefaultMessageAdapter

java.lang.Object
  extended by org.mule.transport.AbstractMessageAdapter
      extended by org.mule.transport.DefaultMessageAdapter
All Implemented Interfaces:
Serializable, ThreadSafeAccess, MessageAdapter, MutableMessageAdapter

public final class DefaultMessageAdapter
extends AbstractMessageAdapter
implements MutableMessageAdapter

DefaultMessageAdapter can be used to wrap an arbitary object where no special 'apapting' is needed. The adapter allows for a set of properties to be associated with an object.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.mule.api.ThreadSafeAccess
ThreadSafeAccess.AccessControl
 
Field Summary
protected  Object message
          The message object wrapped by this adapter
 
Fields inherited from class org.mule.transport.AbstractMessageAdapter
attachments, exceptionPayload, id, logger, properties
 
Fields inherited from interface org.mule.api.ThreadSafeAccess
READ, WRITE
 
Constructor Summary
protected DefaultMessageAdapter()
           
  DefaultMessageAdapter(Object message)
          Creates a default message adapter with properties and attachments
  DefaultMessageAdapter(Object message, Map properties, Map attachments)
          Creates a default message adapter with properties and attachments
  DefaultMessageAdapter(Object message, MessageAdapter previous)
           
 
Method Summary
 Object getPayload()
          
 String getUniqueId()
          gets the unique identifier for the message. It's up to the implementation to ensure a unique id
 ThreadSafeAccess newThreadCopy()
          
 void setPayload(Object payload)
          Update the message payload.
 
Methods inherited from class org.mule.transport.AbstractMessageAdapter
addAttachment, addInboundProperties, addProperties, addProperties, assertAccess, clearProperties, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDoubleProperty, getEncoding, getExceptionPayload, getIntProperty, getLongProperty, getProperty, getProperty, getProperty, getPropertyNames, getPropertyNames, getReplyTo, getStringProperty, isDisabled, newException, release, removeAttachment, removeProperty, resetAccessControl, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setLongProperty, setProperty, setProperty, setReplyTo, setStringProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.mule.api.transport.MessageAdapter
addAttachment, addProperties, addProperties, clearProperties, getAttachment, getAttachmentNames, getBooleanProperty, getCorrelationGroupSize, getCorrelationId, getCorrelationSequence, getDoubleProperty, getEncoding, getExceptionPayload, getIntProperty, getLongProperty, getProperty, getProperty, getProperty, getPropertyNames, getPropertyNames, getReplyTo, getStringProperty, release, removeAttachment, removeProperty, setBooleanProperty, setCorrelationGroupSize, setCorrelationId, setCorrelationSequence, setDoubleProperty, setEncoding, setExceptionPayload, setIntProperty, setLongProperty, setProperty, setProperty, setReplyTo, setStringProperty
 

Field Detail

message

protected Object message
The message object wrapped by this adapter

Constructor Detail

DefaultMessageAdapter

protected DefaultMessageAdapter()

DefaultMessageAdapter

public DefaultMessageAdapter(Object message)
Creates a default message adapter with properties and attachments

Parameters:
message - the message to wrap. If this is null and NullPayload object will be used
See Also:
NullPayload

DefaultMessageAdapter

public DefaultMessageAdapter(Object message,
                             MessageAdapter previous)

DefaultMessageAdapter

public DefaultMessageAdapter(Object message,
                             Map properties,
                             Map attachments)
Creates a default message adapter with properties and attachments

Parameters:
message - the message to wrap. If this is null and NullPayload object will be used
properties - a map properties to set on the adapter. Can be null.
attachments - a map attaches (DataHandler objects) to set on the adapter. Can be null.
See Also:
NullPayload, DataHandler
Method Detail

getPayload

public Object getPayload()

Specified by:
getPayload in interface MessageAdapter
Returns:
the current message

setPayload

public void setPayload(Object payload)
Update the message payload. This is typically only called if the payload was originally an InputStream. In which case, if the InputStream is consumed, it needs to be replaced for future access.

Specified by:
setPayload in interface MutableMessageAdapter
Parameters:
payload - the object to assign as the message payload

getUniqueId

public String getUniqueId()
gets the unique identifier for the message. It's up to the implementation to ensure a unique id

Specified by:
getUniqueId in interface MessageAdapter
Overrides:
getUniqueId in class AbstractMessageAdapter
Returns:
a unique message id. The Id should never be null. If the underlying transport does not have the notion of a message Id, one shuold be generated. The generated Id should be a UUID.

newThreadCopy

public ThreadSafeAccess newThreadCopy()

Specified by:
newThreadCopy in interface ThreadSafeAccess
Overrides:
newThreadCopy in class AbstractMessageAdapter
Returns:
A new instance of the implementing class, unbound to any thread and mutable.


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.