public class DefaultMuleEvent extends EventObject implements MuleEvent, ThreadSafeAccess
DefaultMuleEvent represents any data event occuring in the Mule
environment. All data sent or received within the Mule environment will be passed
between components as an MuleEvent. The MuleEvent holds some data and provides
helper methods for obtaining the data in a format that the receiving Mule UMO
understands. The event can also maintain any number of properties that can be set
and retrieved by Mule UMO components.ThreadSafeAccess.AccessControl| Modifier and Type | Field and Description |
|---|---|
protected String[] |
ignoredPropertyOverrides |
protected org.apache.commons.logging.Log |
logger
logger used by this class
|
sourceTIMEOUT_DO_NOT_WAIT, TIMEOUT_NOT_SET_VALUE, TIMEOUT_WAIT_FOREVERREAD, WRITE| Constructor and Description |
|---|
DefaultMuleEvent(MuleMessage message,
ImmutableEndpoint endpoint,
MuleSession session,
boolean synchronous) |
DefaultMuleEvent(MuleMessage message,
ImmutableEndpoint endpoint,
MuleSession session,
boolean synchronous,
ResponseOutputStream outputStream)
Contructor.
|
DefaultMuleEvent(MuleMessage message,
ImmutableEndpoint endpoint,
MuleSession session,
String eventId,
boolean synchronous)
Contructor.
|
DefaultMuleEvent(MuleMessage message,
ImmutableEndpoint endpoint,
Service service,
MuleEvent previousEvent)
Properties cache that only reads properties once from the inbound message and
merges them with any properties on the endpoint.
|
DefaultMuleEvent(MuleMessage message,
MuleEvent rewriteEvent)
A helper constructor used to rewrite an event payload
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertAccess(boolean write)
This method may be called before data in the object are accessed.
|
boolean |
equals(Object o) |
protected void |
fillProperties(MuleEvent previousEvent) |
protected String |
generateEventId() |
Credentials |
getCredentials() |
String |
getEncoding()
Gets the encoding for this message.
|
ImmutableEndpoint |
getEndpoint()
Gets the endpoint associated with this event
|
String |
getId()
Every event in the system is assigned a universally unique id (UUID).
|
MuleMessage |
getMessage()
Returns the message payload for this event
|
byte[] |
getMessageAsBytes()
Reterns the conents of the message as a byte array.
|
String |
getMessageAsString()
Returns the message contents as a string If necessary this will use the
encoding set on the event
|
String |
getMessageAsString(String encoding)
Returns the message contents as a string
|
MuleContext |
getMuleContext()
Returns the muleContext for the Mule node that this event was received in
|
OutputStream |
getOutputStream()
An outputstream can optionally be used to write response data to an incoming
message.
|
Object |
getProperty(String name,
boolean exhaustiveSearch)
Gets a property associated with the current event.
|
Object |
getProperty(String name,
Object defaultValue,
boolean exhaustiveSearch)
Gets a property associated with the current event.
|
Service |
getService()
Gets the recipient service of this event
|
MuleSession |
getSession()
Retrieves the service session for the current event
|
int |
getTimeout()
The number of milliseconds to wait for a return event when running
synchronously.
|
int |
hashCode() |
protected boolean |
ignoreProperty(String key)
This method is used to determine if a property on the previous event should be
ignorred for the next event.
|
boolean |
isStopFurtherProcessing()
Determines whether the default processing for this event will be executed
|
boolean |
isSynchronous()
Determines whether the was sent synchrounously or not
|
ThreadSafeAccess |
newThreadCopy() |
void |
resetAccessControl()
This method should ONLY be used in the construction of composite ThreadSafeAccess instances.
|
protected void |
setCredentials() |
void |
setStopFurtherProcessing(boolean stopFurtherProcessing)
Setting this parameter will stop the Mule framework from processing this event
in the standard way.
|
void |
setSynchronous(boolean value)
Determines whether the was sent synchrounously or not
|
void |
setTimeout(int timeout)
The number of milliseconds to wait for a return event when running
synchronously.
|
String |
toString() |
Object |
transformMessage()
Transforms the message into it's recognised or expected format.
|
Object |
transformMessage(Class outputType)
Transforms the message into the requested format.
|
byte[] |
transformMessageToBytes()
This method will attempt to convert the transformed message into an array of
bytes It will first check if the result of the transformation is a byte array
and return that.
|
String |
transformMessageToString()
Returns the message transformed into it's recognised or expected format and
then into a String.
|
getSourceprotected org.apache.commons.logging.Log logger
protected String[] ignoredPropertyOverrides
public DefaultMuleEvent(MuleMessage message, ImmutableEndpoint endpoint, Service service, MuleEvent previousEvent)
public DefaultMuleEvent(MuleMessage message, ImmutableEndpoint endpoint, MuleSession session, boolean synchronous)
public DefaultMuleEvent(MuleMessage message, ImmutableEndpoint endpoint, MuleSession session, boolean synchronous, ResponseOutputStream outputStream)
message - the event payloadendpoint - the endpoint to associate with the eventsession - the previous event if anyMessageAdapterpublic DefaultMuleEvent(MuleMessage message, ImmutableEndpoint endpoint, MuleSession session, String eventId, boolean synchronous)
message - the event payloadendpoint - the endpoint to associate with the eventsession - the previous event if anyMessageAdapterpublic DefaultMuleEvent(MuleMessage message, MuleEvent rewriteEvent)
message - rewriteEvent - protected void fillProperties(MuleEvent previousEvent)
protected boolean ignoreProperty(String key)
key - protected void setCredentials()
public Credentials getCredentials()
getCredentials in interface MuleEventpublic MuleMessage getMessage()
MuleEventgetMessage in interface MuleEventpublic byte[] getMessageAsBytes()
throws DefaultMuleException
MuleEventgetMessageAsBytes in interface MuleEventDefaultMuleExceptionpublic Object transformMessage() throws TransformerException
MuleEventtransformMessage in interface MuleEventTransformerException - if a failure occurs in the transformerTransformerpublic Object transformMessage(Class outputType) throws TransformerException
MuleEventtransformMessage in interface MuleEventoutputType - The requested output type.TransformerException - if a failure occurs in the transformerTransformerpublic byte[] transformMessageToBytes()
throws TransformerException
transformMessageToBytes in interface MuleEventTransformerException - if an unsupported encoding is being used or if
the result message is not a String byte[] or Seializable objectTransformerpublic String transformMessageToString() throws TransformerException
transformMessageToString in interface MuleEventTransformerException - if a failure occurs in
the transformerTransformerpublic String getMessageAsString() throws MuleException
MuleEventgetMessageAsString in interface MuleEventMuleException - if the message cannot be converted into a stringpublic String getMessageAsString(String encoding) throws MuleException
getMessageAsString in interface MuleEventencoding - the encoding to use when converting the message to stringMuleException - if the message cannot be converted into a
stringpublic String getId()
MuleEventpublic Object getProperty(String name, boolean exhaustiveSearch)
MuleEventexhaustiveSearch is true, the endpoint and connector associated
with the event will also be searched for the property.getProperty in interface MuleEventname - the property nameexhaustiveSearch - also search the endpoint and connector for the
propertyMuleEvent.getProperty(java.lang.String, boolean)public Object getProperty(String name, Object defaultValue, boolean exhaustiveSearch)
MuleEventexhaustiveSearch is true, the endpoint and connector associated
with the event will also be searched for the property.getProperty in interface MuleEventname - the property namedefaultValue - a default value if the property doesn't exist in the eventexhaustiveSearch - also search the endpoint and connector for the
propertypublic ImmutableEndpoint getEndpoint()
MuleEventgetEndpoint in interface MuleEventpublic String toString()
toString in class EventObjectprotected String generateEventId()
public MuleSession getSession()
MuleEventgetSession in interface MuleEventpublic Service getService()
getService in interface MuleEventpublic boolean isStopFurtherProcessing()
isStopFurtherProcessing in interface MuleEventorg.mule.api.context.UMOManager,
MuleEventContext,
Callablepublic void setStopFurtherProcessing(boolean stopFurtherProcessing)
setStopFurtherProcessing in interface MuleEventstopFurtherProcessing - The stopFurtherProcessing to set.public boolean isSynchronous()
MuleEventisSynchronous in interface MuleEventpublic void setSynchronous(boolean value)
MuleEventsetSynchronous in interface MuleEventvalue - true if the event is synchronouspublic int getTimeout()
MuleEventgetTimeout in interface MuleEventpublic void setTimeout(int timeout)
MuleEventsetTimeout in interface MuleEventtimeout - the event timeout in millisecondspublic OutputStream getOutputStream()
getOutputStream in interface MuleEventpublic String getEncoding()
getEncoding in interface MuleEventpublic MuleContext getMuleContext()
MuleEventgetMuleContext in interface MuleEventpublic ThreadSafeAccess newThreadCopy()
newThreadCopy in interface ThreadSafeAccesspublic void resetAccessControl()
ThreadSafeAccessresetAccessControl in interface ThreadSafeAccesspublic void assertAccess(boolean write)
ThreadSafeAccessassertAccess in interface ThreadSafeAccesswrite - True if the access will mutate values.Copyright © 2003-2012 MuleSource, Inc.. All Rights Reserved.