org.mule.umo.provider
Interface UMOMessageAdapter

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
UMOMessage
All Known Implementing Classes:
AbstractMessageAdapter, BaseMessage, HttpRequestMessageAdapter, MuleMessage

public interface UMOMessageAdapter
extends java.io.Serializable

UMOMessageAdapter provides a common abstraction of different message implementations provided by different underlying technologies

Version:
$Revision: 1.2 $
Author:
Ross Mason

Method Summary
 boolean getBooleanProperty(java.lang.String name, boolean defaultValue)
          Gets a boolean property from the event
 int getCorrelationGroupSize()
          Determines how many messages are in the correlation group
 java.lang.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(java.lang.String name, double defaultValue)
          Gets a double property from the event
 int getErrorCode()
          If an error occurred during the processing of this message this will return a value greater than zero
 int getIntProperty(java.lang.String name, int defaultValue)
          Gets an integer property from the event
 long getLongProperty(java.lang.String name, long defaultValue)
          Gets a long property from the event
 java.lang.Object getPayload()
           
 byte[] getPayloadAsBytes()
          Converts the message implementation into a String representation
 java.lang.String getPayloadAsString()
          Converts the message implementation into a String representation
 java.lang.Object getProperty(java.lang.Object key)
          Gets a property of the message implementation
 java.lang.Object getProperty(java.lang.String name, java.lang.Object defaultValue)
          Gets a property from the event
 java.util.Iterator getPropertyNames()
           
 java.lang.Object getReplyTo()
          Sets a replyTo address for this message.
 java.lang.String getUniqueId()
          gets the unique identifier for the message.
 java.lang.Object removeProperty(java.lang.Object key)
          Removes a property on this message
 void setBooleanProperty(java.lang.String name, boolean value)
          Sets a boolean property on the event
 void setCorrelationGroupSize(int size)
          Determines how many messages are in the correlation group
 void setCorrelationId(java.lang.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(java.lang.String name, double value)
          Sets a double property on the event
 void setErrorCode(int code)
          If an error occurs while processing this message, this error code should be set to a value greater than zero and the palyoad of the this message should contain the error details
 void setIntProperty(java.lang.String name, int value)
          Sets a integerproperty on the event
 void setLongProperty(java.lang.String name, long value)
          Sets a long property on the event
 void setProperty(java.lang.Object key, java.lang.Object value)
          Set a property on the message
 void setReplyTo(java.lang.Object replyTo)
          Sets a replyTo address for this message.
 

Method Detail

getProperty

public java.lang.Object getProperty(java.lang.Object key)
Gets a property of the message implementation

Parameters:
key - the key on which to lookup the property value
Returns:
the property value or null if the property does not exist

setProperty

public void setProperty(java.lang.Object key,
                        java.lang.Object value)
Set a property on the message

Parameters:
key - the key on which to associate the value
value - the property value

removeProperty

public java.lang.Object removeProperty(java.lang.Object key)
Removes a property on this message

Parameters:
key - the property key to remove
Returns:
the removed property value or null if the property did not exist

getPayloadAsString

public java.lang.String getPayloadAsString()
                                    throws java.lang.Exception
Converts the message implementation into a String representation

Returns:
String representation of the message payload
Throws:
java.lang.Exception - Implementation may throw an endpoint specific exception

getPropertyNames

public java.util.Iterator getPropertyNames()
Returns:
all properties on this message

getPayloadAsBytes

public byte[] getPayloadAsBytes()
                         throws java.lang.Exception
Converts the message implementation into a String representation

Returns:
String representation of the message
Throws:
java.lang.Exception - Implemetation may throw an endpoint specific exception

getPayload

public java.lang.Object getPayload()
Returns:
the current message

getUniqueId

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

Returns:
a unique message id
Throws:
UniqueIdNotSupportedException - if the message does not support a unique identifier

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.lang.Object defaultValue)
Gets a property from the event

Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

getIntProperty

public int getIntProperty(java.lang.String name,
                          int defaultValue)
Gets an integer property from the event

Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

getLongProperty

public long getLongProperty(java.lang.String name,
                            long defaultValue)
Gets a long property from the event

Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

getDoubleProperty

public double getDoubleProperty(java.lang.String name,
                                double defaultValue)
Gets a double property from the event

Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name,
                                  boolean defaultValue)
Gets a boolean property from the event

Parameters:
name - the name or key of the property
defaultValue - a default value if the property doesn't exist in the event
Returns:
the property value or the defaultValue if the property does not exist

setBooleanProperty

public void setBooleanProperty(java.lang.String name,
                               boolean value)
Sets a boolean property on the event

Parameters:
name - the property name or key
value - the property value

setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
Sets a integerproperty on the event

Parameters:
name - the property name or key
value - the property value

setLongProperty

public void setLongProperty(java.lang.String name,
                            long value)
Sets a long property on the event

Parameters:
name - the property name or key
value - the property value

setDoubleProperty

public void setDoubleProperty(java.lang.String name,
                              double value)
Sets a double property on the event

Parameters:
name - the property name or key
value - the property value

setCorrelationId

public void setCorrelationId(java.lang.String id)
Sets a correlationId for this message. The correlation Id can be used by components in the system to manage message relations transport protocol. As such not all messages will support the notion of a correlationId i.e. tcp or file. In this situation the correlation Id is set as a property of the message where it's up to developer to keep the association with the message. For example if the message is serialised to xml the correlationId will be available in the message.

Parameters:
id - the Id reference for this relationship

getCorrelationId

public java.lang.String getCorrelationId()
Sets a correlationId for this message. The correlation Id can be used by components in the system to manage message relations. The correlationId is associated with the message using the underlying transport protocol. As such not all messages will support the notion of a correlationId i.e. tcp or file. In this situation the correlation Id is set as a property of the message where it's up to developer to keep the association with the message. For example if the message is serialised to xml the correlationId will be available in the message.

Returns:
the correlationId for this message or null if one hasn't been set

getCorrelationSequence

public int getCorrelationSequence()
Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)

Returns:
the sequence number or -1 if the sequence is not important

setCorrelationSequence

public void setCorrelationSequence(int sequence)
Gets the sequence or ordering number for this message in the the correlation group (as defined by the correlationId)

Parameters:
sequence - the sequence number or -1 if the sequence is not important

getCorrelationGroupSize

public int getCorrelationGroupSize()
Determines how many messages are in the correlation group

Returns:
total messages in this group or -1 if the size is not known

setCorrelationGroupSize

public void setCorrelationGroupSize(int size)
Determines how many messages are in the correlation group

Parameters:
size - the total messages in this group or -1 if the size is not known

setReplyTo

public void setReplyTo(java.lang.Object replyTo)
Sets a replyTo address for this message. This is useful in an asynchronous environment where the caller doesn't wait for a response and the response needs to be routed somewhere for further processing. The value of this field can be any valid endpointUri url.

Parameters:
replyTo - the endpointUri url to reply to

getReplyTo

public java.lang.Object getReplyTo()
Sets a replyTo address for this message. This is useful in an asynchronous environment where the caller doesn't wait for a response and the response needs to be routed somewhere for further processing. The value of this field can be any valid endpointUri url.

Returns:
the endpointUri url to reply to or null if one has not been set

getErrorCode

public int getErrorCode()
If an error occurred during the processing of this message this will return a value greater than zero

Returns:

setErrorCode

public void setErrorCode(int code)
If an error occurs while processing this message, this error code should be set to a value greater than zero and the palyoad of the this message should contain the error details

Parameters:
code -


Copyright © 2003-2005 SymphonySoft Limited. All Rights Reserved.