|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mule.DefaultMuleMessage
public class DefaultMuleMessage
DefaultMuleMessage is a wrapper that contains a payload and properties
associated with the payload.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.mule.api.ThreadSafeAccess |
|---|
ThreadSafeAccess.AccessControl |
| Nested classes/interfaces inherited from interface org.mule.util.store.DeserializationPostInitialisable |
|---|
DeserializationPostInitialisable.Implementation |
| Field Summary | |
|---|---|
protected MuleContext |
muleContext
|
| Fields inherited from interface org.mule.api.ThreadSafeAccess |
|---|
READ, WRITE |
| Constructor Summary | |
|---|---|
protected |
DefaultMuleMessage(DefaultMuleMessage message)
|
|
DefaultMuleMessage(Object message,
Map properties,
MuleContext muleContext)
|
|
DefaultMuleMessage(Object message,
MessageAdapter previous,
MuleContext muleContext)
|
|
DefaultMuleMessage(Object message,
MuleContext muleContext)
|
| Method Summary | ||
|---|---|---|
void |
addAttachment(String name,
DataHandler dataHandler)
Allows for arbitary data attachments to be associated with the Message. |
|
void |
addProperties(Map<String,Object> properties)
Adds a map of properties to be associated with this message |
|
void |
addProperties(Map<String,Object> properties,
PropertyScope scope)
Adds a map of properties to be associated with this message |
|
protected void |
applyAllTransformers(List transformers)
|
|
void |
applyTransformers(List<? extends Transformer> transformers)
Will apply a list of transformers to the payload of the message. |
|
void |
applyTransformers(List<? extends Transformer> transformers,
Class outputType)
Will apply a list of transformers to the payload of the message. |
|
void |
applyTransformers(Transformer... transformers)
Will apply a list of transformers to the payload of the message. |
|
void |
assertAccess(boolean write)
This method may be called before data in the object are accessed. |
|
void |
clearProperties()
Removes all properties on this message |
|
static MuleMessage |
copy(MuleMessage message)
|
|
MessageAdapter |
getAdapter()
Returns the currently edited Message adapter for this message. |
|
DataHandler |
getAttachment(String name)
Retrieve an attachment with the given name. |
|
Set<String> |
getAttachmentNames()
Returns a set of the names of the attachments on this message. |
|
boolean |
getBooleanProperty(String name,
boolean defaultValue)
Gets a boolean property from the message |
|
int |
getCorrelationGroupSize()
Determines how many messages are in the correlation group |
|
String |
getCorrelationId()
Sets a correlationId for this message. |
|
int |
getCorrelationSequence()
Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId) |
|
double |
getDoubleProperty(String name,
double defaultValue)
Gets a double property from the message |
|
String |
getEncoding()
Gets the encoding for the current message. |
|
ExceptionPayload |
getExceptionPayload()
If an error occurred during the processing of this message this will return a ErrorPayload that contains the root exception and Mule error code, plus any other releated info |
|
int |
getIntProperty(String name,
int defaultValue)
Gets an integer property from the message |
|
long |
getLongProperty(String name,
long defaultValue)
Gets a long property from the message |
|
Object |
getOrginalPayload()
Returns the original payload used to create this message. |
|
MessageAdapter |
getOriginalAdapter()
Returns the original payload used to create this message. |
|
Object |
getPayload()
|
|
|
getPayload(Class<T> outputType)
Will attempt to obtain the payload of this message with the desired Class type. |
|
protected
|
getPayload(Class<T> outputType,
String encoding)
Will attempt to obtain the payload of this message with the desired Class type. |
|
protected
|
getPayload(DataType<T> resultType,
String encoding)
Will attempt to obtain the payload of this message with the desired Class type. |
|
byte[] |
getPayloadAsBytes()
Converts the message implementation into a byte array representation |
|
String |
getPayloadAsString()
Converts the message implementation into a String representation. |
|
String |
getPayloadAsString(String encoding)
Converts the message implementation into a String representation |
|
Object |
getProperty(String key)
Gets a property of the message implementation |
|
Object |
getProperty(String name,
Object defaultValue)
Gets a property from the message |
|
Object |
getProperty(String name,
PropertyScope scope)
Gets a property from the message with a given scope |
|
Set<String> |
getPropertyNames()
|
|
Set<String> |
getPropertyNames(PropertyScope scope)
Gets all property names in a given scope |
|
Object |
getReplyTo()
Returns a replyTo address for this message. |
|
String |
getStringProperty(String name,
String defaultValue)
Gets a String property from the message |
|
String |
getUniqueId()
gets the unique identifier for the message. |
|
boolean |
isConsumable()
Determines if the payload of this message is consumable i.e. |
|
protected boolean |
isPayloadConsumed(Class inputCls)
Checks if the payload has been consumed for this message. |
|
ThreadSafeAccess |
newThreadCopy()
|
|
void |
release()
Perform any clean up operations on the message resource. |
|
void |
removeAttachment(String name)
Remove an attahcment form this message with the specifed name |
|
Object |
removeProperty(String key)
Removes a property on this message |
|
Object |
removeProperty(String key,
PropertyScope scope)
Removes a property on this message from the specified scope only. |
|
void |
resetAccessControl()
This method should ONLY be used in the construction of composite ThreadSafeAccess instances. |
|
void |
setBooleanProperty(String name,
boolean value)
Sets a boolean property on the message |
|
void |
setCorrelationGroupSize(int size)
Determines how many messages are in the correlation group |
|
void |
setCorrelationId(String id)
Sets a correlationId for this message. |
|
void |
setCorrelationSequence(int sequence)
Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId) |
|
void |
setDoubleProperty(String name,
double value)
Sets a double property on the message |
|
void |
setEncoding(String encoding)
Sets the encoding for this message |
|
void |
setExceptionPayload(ExceptionPayload exceptionPayload)
If an error occurs while processing this message, a ErrorPayload is attached which contains the root exception and Mule error code, plus any other releated info. |
|
void |
setIntProperty(String name,
int value)
Sets a integerproperty on the message |
|
void |
setLongProperty(String name,
long value)
Sets a long property on the message |
|
void |
setPayload(Object payload)
Update the message payload. |
|
void |
setProperty(String key,
Object value)
Set a property on the message |
|
void |
setProperty(String key,
Object value,
PropertyScope scope)
Set a property on the message |
|
void |
setReplyTo(Object replyTo)
Sets a replyTo address for this message. |
|
void |
setStringProperty(String name,
String value)
Sets a String property on the message |
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected transient MuleContext muleContext
| Constructor Detail |
|---|
public DefaultMuleMessage(Object message,
MuleContext muleContext)
public DefaultMuleMessage(Object message,
Map properties,
MuleContext muleContext)
public DefaultMuleMessage(Object message,
MessageAdapter previous,
MuleContext muleContext)
protected DefaultMuleMessage(DefaultMuleMessage message)
| Method Detail |
|---|
public <T> T getPayload(Class<T> outputType)
throws TransformerException
getPayload in interface MuleMessageoutputType - the desired return type
TransformerException - if a transformer cannot be found or there is an error during transformation of the
payload
protected <T> T getPayload(DataType<T> resultType,
String encoding)
throws TransformerException
outputType - the desired return typeencoding - the encoding to use if required
InputStream in which
case the stream will be read and the payload will become the fully read stream.
TransformerException - if a transformer cannot be found or there is an error during
transformation of the payload.
protected <T> T getPayload(Class<T> outputType,
String encoding)
throws TransformerException
outputType - the desired return typeencoding - the encoding to use if required
TransformerException - if a transformer cannot be found or there is an error during transformation of the
payloadprotected boolean isPayloadConsumed(Class inputCls)
inputCls - the input type of the message payload
public MessageAdapter getAdapter()
MuleMessage.getOriginalAdapter()
getAdapter in interface MuleMessagepublic Object getOrginalPayload()
MuleMessage.applyTransformers(java.util.List) or
MuleMessage.applyTransformers(java.util.List, Class) is called.
getOrginalPayload in interface MuleMessagepublic MessageAdapter getOriginalAdapter()
MuleMessage.applyTransformers(java.util.List) or
MuleMessage.applyTransformers(java.util.List, Class) is called.
getOriginalAdapter in interface MuleMessage
public void setProperty(String key,
Object value,
PropertyScope scope)
setProperty in interface MessageAdapterkey - the key on which to associate the valuevalue - the property valuescope - The scope at which to set the property atPropertyScopepublic Object getProperty(String key)
getProperty in interface MessageAdapterkey - the key on which to lookup the property value
public Object removeProperty(String key)
removeProperty in interface MessageAdapterkey - the property key to remove
public Object removeProperty(String key,
PropertyScope scope)
removeProperty in interface MessageAdapterkey - the property key to removescope - The scope at which to set the property at
public void setProperty(String key,
Object value)
setProperty in interface MessageAdapterkey - the key on which to associate the valuevalue - the property value
public final String getPayloadAsString()
throws Exception
getPayloadAsString in interface MuleMessageException - Implementation may throw an endpoint specific exception
public byte[] getPayloadAsBytes()
throws Exception
getPayloadAsBytes in interface MuleMessageException - Implemetation may throw an endpoint specific exception
public String getPayloadAsString(String encoding)
throws Exception
getPayloadAsString in interface MuleMessageencoding - The encoding to use when transforming the message (if
necessary). The parameter is used when converting from a byte array
Exception - Implementation may throw an endpoint specific exceptionpublic Set<String> getPropertyNames()
getPropertyNames in interface MessageAdapterpublic Set<String> getPropertyNames(PropertyScope scope)
getPropertyNames in interface MessageAdapterscope - the scope of property names
public double getDoubleProperty(String name,
double defaultValue)
MessageAdapter
getDoubleProperty in interface MessageAdaptername - the name or key of the propertydefaultValue - a default value if the property doesn't exist in the event
public void setDoubleProperty(String name,
double value)
setDoubleProperty in interface MessageAdaptername - the property name or keyvalue - the property valuepublic String getUniqueId()
getUniqueId in interface MessageAdapter
public Object getProperty(String name,
Object defaultValue)
getProperty in interface MessageAdaptername - the name or key of the propertydefaultValue - a default value if the property doesn't exist in the event
public Object getProperty(String name,
PropertyScope scope)
getProperty in interface MessageAdaptername - the name or key of the propertyscope - The scope of the property to retrieve
public int getIntProperty(String name,
int defaultValue)
getIntProperty in interface MessageAdaptername - the name or key of the propertydefaultValue - a default value if the property doesn't exist in the event
public long getLongProperty(String name,
long defaultValue)
getLongProperty in interface MessageAdaptername - the name or key of the propertydefaultValue - a default value if the property doesn't exist in the event
public boolean getBooleanProperty(String name,
boolean defaultValue)
getBooleanProperty in interface MessageAdaptername - the name or key of the propertydefaultValue - a default value if the property doesn't exist in the event
public void setBooleanProperty(String name,
boolean value)
setBooleanProperty in interface MessageAdaptername - the property name or keyvalue - the property value
public void setIntProperty(String name,
int value)
setIntProperty in interface MessageAdaptername - the property name or keyvalue - the property value
public void setLongProperty(String name,
long value)
setLongProperty in interface MessageAdaptername - the property name or keyvalue - the property valuepublic void setCorrelationId(String id)
setCorrelationId in interface MessageAdapterid - the Id reference for this relationshippublic String getCorrelationId()
getCorrelationId in interface MessageAdapterpublic void setReplyTo(Object replyTo)
setReplyTo in interface MessageAdapterreplyTo - the endpointUri url to reply topublic Object getReplyTo()
getReplyTo in interface MessageAdapterpublic int getCorrelationSequence()
getCorrelationSequence in interface MessageAdapterpublic void setCorrelationSequence(int sequence)
setCorrelationSequence in interface MessageAdaptersequence - the sequence number or -1 if the sequence is not importantpublic int getCorrelationGroupSize()
getCorrelationGroupSize in interface MessageAdapterpublic void setCorrelationGroupSize(int size)
MessageAdapter
setCorrelationGroupSize in interface MessageAdaptersize - the total messages in this group or -1 if the size is not knownpublic ExceptionPayload getExceptionPayload()
getExceptionPayload in interface MessageAdapterpublic void setExceptionPayload(ExceptionPayload exceptionPayload)
setExceptionPayload in interface MessageAdapterexceptionPayload - The exception payload to attach to this messagepublic String toString()
toString in class Object
public void addAttachment(String name,
DataHandler dataHandler)
throws Exception
addAttachment in interface MessageAdaptername - the name to associate with the attachmentdataHandler - The attachment datahandler to use. This will be used to interract with the attachment data
ExceptionDataHandler
public void removeAttachment(String name)
throws Exception
removeAttachment in interface MessageAdaptername - the name of the attachment to remove. If the attachment does not exist, the request may be ignorred
Exception - different messaging systems handle attachments differnetly, as such some will throw an exception
if an attahcment does dot exist.public DataHandler getAttachment(String name)
getAttachment in interface MessageAdaptername - the name of the attachment to retrieve
DataHandlerpublic Set<String> getAttachmentNames()
getAttachmentNames in interface MessageAdapterpublic String getEncoding()
getEncoding in interface MessageAdapterpublic void setEncoding(String encoding)
setEncoding in interface MessageAdapterencoding - the encoding to use
public String getStringProperty(String name,
String defaultValue)
getStringProperty in interface MessageAdaptername - the name or key of the propertydefaultValue - a default value if the property doesn't exist in the event
public void setStringProperty(String name,
String value)
setStringProperty in interface MessageAdaptername - the property name or keyvalue - the property valuepublic void addProperties(Map<String,Object> properties)
addProperties in interface MessageAdapterproperties - the properties add to this message
public void addProperties(Map<String,Object> properties,
PropertyScope scope)
addProperties in interface MessageAdapterproperties - the properties add to this messagescope - the scope in which the proeprties should be addedpublic void clearProperties()
clearProperties in interface MessageAdapterpublic Object getPayload()
getPayload in interface MessageAdapterpublic void setPayload(Object payload)
setPayload in interface MuleMessagepayload - the object to assign as the message payloadpublic void release()
release in interface MessageAdapter
public void applyTransformers(List<? extends Transformer> transformers)
throws TransformerException
applyTransformers in interface MuleMessagetransformers - the transformers to apply to the message payload
TransformerException - if a transformation error occurs or one or more of the transformers passed in a
are incompatible with the message payload
public void applyTransformers(Transformer... transformers)
throws TransformerException
applyTransformers in interface MuleMessagetransformers - the transformers to apply to the message payload
TransformerException - if a transformation error occurs or one or more of the transformers passed in a
are incompatible with the message payload
public void applyTransformers(List<? extends Transformer> transformers,
Class outputType)
throws TransformerException
MuleMessage
applyTransformers in interface MuleMessagetransformers - the transformers to apply to the message payloadoutputType - the required output type for this transformation. by adding this parameter some additional
transformations will occur on the message payload to ensure that the final payload is of the specified type.
If no transformers can be found in the registry that can transform from the return type of the transformation
list to the outputType and exception will be thrown
TransformerException - if a transformation error occurs or one or more of the transformers passed in a
are incompatible with the message payload
protected void applyAllTransformers(List transformers)
throws TransformerException
TransformerExceptionpublic ThreadSafeAccess newThreadCopy()
newThreadCopy in interface ThreadSafeAccesspublic void resetAccessControl()
resetAccessControl in interface ThreadSafeAccesspublic void assertAccess(boolean write)
assertAccess in interface ThreadSafeAccesswrite - True if the access will mutate values.public boolean isConsumable()
public static MuleMessage copy(MuleMessage message)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||