org.mule.impl
Class MuleEvent

java.lang.Object
  extended byjava.util.EventObject
      extended byorg.mule.impl.MuleEvent
All Implemented Interfaces:
java.io.Serializable, UMOEvent

public class MuleEvent
extends java.util.EventObject
implements UMOEvent

MuleEvent 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 UMOEvent.

The UMOEvent 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.

Version:
$Revision: 1.1.1.1 $
Author:
Ross Mason
See Also:
Serialized Form

Field Summary
protected  java.util.Iterator interceptorIterator
           
 
Fields inherited from class java.util.EventObject
source
 
Fields inherited from interface org.mule.umo.UMOEvent
TIMEOUT_DO_NOT_WAIT, TIMEOUT_WAIT_FOREVER
 
Constructor Summary
MuleEvent(UMOMessage message, UMOEndpoint endpoint, UMOComponent component, UMOEvent previousEvent)
           
MuleEvent(UMOMessage message, UMOEndpoint endpoint, UMOSession session, boolean synchronous)
           
MuleEvent(UMOMessage message, UMOEndpoint endpoint, UMOSession session, boolean synchronous, ResponseOutputStream outputStream)
          Contructor.
MuleEvent(UMOMessage message, UMOEndpoint endpoint, UMOSession session, java.lang.String eventId, boolean synchronous)
          Contructor.
MuleEvent(UMOMessage message, UMOEvent rewriteEvent)
          A helper constructor used to rewrite an event payload
 
Method Summary
 boolean equals(java.lang.Object o)
           
protected  java.lang.String generateEventId()
           
 boolean getBooleanProperty(java.lang.String name, boolean defaultValue)
          Gets a Boolean property associated with the current event.
 UMOComponent getComponent()
          Gets the recipient component of this event
 double getDoubleProperty(java.lang.String name, double defaultValue)
          Gets a Double property associated with the current event.
 UMOEndpoint getEndpoint()
          Gets the endpoint associated with this event
 java.lang.String getId()
          Every event in the system is assigned a universally unique id (UUID).
 int getIntProperty(java.lang.String name, int defaultValue)
          Gets an Integer property associated with the current event.
 long getLongProperty(java.lang.String name, long defaultValue)
          Gets a Long property associated with the current event.
 UMOMessage getMessage()
          Returns the message payload for this event
 byte[] getMessageAsBytes()
          Reterns the conents of the message as a byte array.
 java.lang.String getMessageAsString()
          Returns the message contents as a string
 java.io.OutputStream getOutputStream()
          An outputstream the can optionally be used write response data to an incoming message.
 java.util.Map getProperties()
          Returns a map of properties associated with the event
 java.lang.Object getProperty(java.lang.String name)
          Gets a property associated with the current event.
 java.lang.Object getProperty(java.lang.String name, java.lang.Object defaultValue)
          Gets a property associated with the current event.
 UMOSession getSession()
          Retrieves the component session for the current event
 int getTimeout()
          The number of milliseconds to wait for a return event when running synchronously.
 java.lang.Object getTransformedMessage()
          Returns the message transformed into it's recognised or expected format.
 byte[] getTransformedMessageAsBytes()
          Returns the message transformed into it's recognised or expected format and then into an array of bytes.
 java.lang.String getTransformedMessageAsString()
          Returns the message transformed into it's recognised or expected format and then into a String.
 int hashCode()
           
 boolean isStopFurtherProcessing()
          Determines whether the default processing for this event will be executed
 boolean isSynchronous()
          Determines whether the was sent synchrounously or not
 java.lang.Object removeProperty(java.lang.Object key)
          Removes a property from the event
 void setBooleanProperty(java.lang.String name, boolean value)
          Sets a Boolean property associated with the current event.
 void setDoubleProperty(java.lang.String name, double value)
          Sets a Double property associated with the current event.
 void setIntProperty(java.lang.String name, int value)
          Sets an Integer property associated with the current event.
 void setLongProperty(java.lang.String name, long value)
          Sets a Long property associated with the current event.
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a property associated with the current event.
 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.
 java.lang.String toString()
           
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

interceptorIterator

protected transient java.util.Iterator interceptorIterator
Constructor Detail

MuleEvent

public MuleEvent(UMOMessage message,
                 UMOEndpoint endpoint,
                 UMOComponent component,
                 UMOEvent previousEvent)

MuleEvent

public MuleEvent(UMOMessage message,
                 UMOEndpoint endpoint,
                 UMOSession session,
                 boolean synchronous)

MuleEvent

public MuleEvent(UMOMessage message,
                 UMOEndpoint endpoint,
                 UMOSession session,
                 boolean synchronous,
                 ResponseOutputStream outputStream)
Contructor.

Parameters:
message - the event payload
endpoint - the endpoint to associate with the event
session - the previous event if any
See Also:
UMOMessageAdapter

MuleEvent

public MuleEvent(UMOMessage message,
                 UMOEndpoint endpoint,
                 UMOSession session,
                 java.lang.String eventId,
                 boolean synchronous)
Contructor.

Parameters:
message - the event payload
endpoint - the endpoint to associate with the event
session - the previous event if any
See Also:
UMOMessageAdapter

MuleEvent

public MuleEvent(UMOMessage message,
                 UMOEvent rewriteEvent)
A helper constructor used to rewrite an event payload

Parameters:
message -
rewriteEvent -
Method Detail

getMessage

public UMOMessage getMessage()
Description copied from interface: UMOEvent
Returns the message payload for this event

Specified by:
getMessage in interface UMOEvent
Returns:
the message payload for this event

getMessageAsBytes

public byte[] getMessageAsBytes()
                         throws MuleException
Description copied from interface: UMOEvent
Reterns the conents of the message as a byte array.

Specified by:
getMessageAsBytes in interface UMOEvent
Returns:
the conents of the message as a byte array
Throws:
MuleException

getTransformedMessage

public java.lang.Object getTransformedMessage()
                                       throws TransformerException
Description copied from interface: UMOEvent
Returns the message transformed into it's recognised or expected format. The transformer used is the one configured on the endpoint through which this event was received.

Specified by:
getTransformedMessage in interface UMOEvent
Returns:
the message transformed into it's recognised or expected format.
Throws:
TransformerException - if a failure occurs in the transformer
See Also:
UMOTransformer

getTransformedMessageAsBytes

public byte[] getTransformedMessageAsBytes()
                                    throws TransformerException
Description copied from interface: UMOEvent
Returns the message transformed into it's recognised or expected format and then into an array of bytes. The transformer used is the one configured on the endpoint through which this event was received.

Specified by:
getTransformedMessageAsBytes in interface UMOEvent
Returns:
the message transformed into it's recognised or expected format as an array of bytes.
Throws:
TransformerException - if a failure occurs in the transformer
See Also:
UMOTransformer

getTransformedMessageAsString

public java.lang.String getTransformedMessageAsString()
                                               throws TransformerException
Returns the message transformed into it's recognised or expected format and then into a String. The transformer used is the one configured on the endpoint through which this event was received.

Specified by:
getTransformedMessageAsString in interface UMOEvent
Returns:
the message transformed into it's recognised or expected format as a Strings.
Throws:
TransformerException - if a failure occurs in the transformer
See Also:
UMOTransformer

getMessageAsString

public java.lang.String getMessageAsString()
                                    throws MuleException
Description copied from interface: UMOEvent
Returns the message contents as a string

Specified by:
getMessageAsString in interface UMOEvent
Returns:
the message contents as a string
Throws:
MuleException

getId

public java.lang.String getId()
Description copied from interface: UMOEvent
Every event in the system is assigned a universally unique id (UUID).

Specified by:
getId in interface UMOEvent
Returns:
the unique identifier for the event

getProperty

public java.lang.Object getProperty(java.lang.String name)
Description copied from interface: UMOEvent
Gets a property associated with the current event. Calling this method is equivilent to calling event.getMessage().getProperty(...)

Specified by:
getProperty in interface UMOEvent
Parameters:
name - the property name
Returns:
the property value or null if the property does not exist

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.lang.Object defaultValue)
Description copied from interface: UMOEvent
Gets a property associated with the current event. Calling this method is equivilent to calling event.getMessage().getProperty(..., ...)

Specified by:
getProperty in interface UMOEvent
Parameters:
name - the property name
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

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Description copied from interface: UMOEvent
Sets a property associated with the current event. Calling this method is equivilent to calling event.getMessage().setProperty(..., ...)

Specified by:
setProperty in interface UMOEvent
Parameters:
name - the property name or key
value - the property value

getProperties

public java.util.Map getProperties()
Description copied from interface: UMOEvent
Returns a map of properties associated with the event

Specified by:
getProperties in interface UMOEvent
Returns:
a map of properties on the event

getEndpoint

public UMOEndpoint getEndpoint()
Description copied from interface: UMOEvent
Gets the endpoint associated with this event

Specified by:
getEndpoint in interface UMOEvent
Returns:
the endpoint associated with this event

toString

public java.lang.String toString()

generateEventId

protected java.lang.String generateEventId()

getSession

public UMOSession getSession()
Description copied from interface: UMOEvent
Retrieves the component session for the current event

Specified by:
getSession in interface UMOEvent
Returns:
the component session for the event

getComponent

public UMOComponent getComponent()
Gets the recipient component of this event

Specified by:
getComponent in interface UMOEvent
Returns:
the component for the event

isStopFurtherProcessing

public boolean isStopFurtherProcessing()
Determines whether the default processing for this event will be executed

Specified by:
isStopFurtherProcessing in interface UMOEvent
Returns:
Returns the stopFurtherProcessing.
See Also:
UMOManager, UMOEventContext, Callable

setStopFurtherProcessing

public void setStopFurtherProcessing(boolean stopFurtherProcessing)
Setting this parameter will stop the Mule framework from processing this event in the standard way. This allow for client code to override default behaviour. The common reasons for doing this are - 1. The UMO has more than one send endpoint configured; the component must dispatch to other prviders programatically by using the component on the current event 2. The UMO doesn't send the current event out through a endpoint. i.e. the processing of the event stops in the uMO.

Specified by:
setStopFurtherProcessing in interface UMOEvent
Parameters:
stopFurtherProcessing - The stopFurtherProcessing to set.

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

isSynchronous

public boolean isSynchronous()
Description copied from interface: UMOEvent
Determines whether the was sent synchrounously or not

Specified by:
isSynchronous in interface UMOEvent
Returns:
true if the event is synchronous

setSynchronous

public void setSynchronous(boolean value)
Description copied from interface: UMOEvent
Determines whether the was sent synchrounously or not

Specified by:
setSynchronous in interface UMOEvent
Parameters:
value - true if the event is synchronous

getTimeout

public int getTimeout()
Description copied from interface: UMOEvent
The number of milliseconds to wait for a return event when running synchronously. 0 wait forever -1 try and receive, but do not wait or a positive millisecod value

Specified by:
getTimeout in interface UMOEvent
Returns:
the event timeout in milliseconds

setTimeout

public void setTimeout(int timeout)
Description copied from interface: UMOEvent
The number of milliseconds to wait for a return event when running synchronously. 0 wait forever -1 try and receive, but do not wait or a positive millisecod value

Specified by:
setTimeout in interface UMOEvent
Parameters:
timeout - the event timeout in milliseconds

getIntProperty

public int getIntProperty(java.lang.String name,
                          int defaultValue)
Description copied from interface: UMOEvent
Gets an Integer property associated with the current event. Calling this method is equivilent to calling event.getMessage().getIntProperty(..., ...)

Specified by:
getIntProperty in interface UMOEvent
Parameters:
name - the property name
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)
Description copied from interface: UMOEvent
Gets a Long property associated with the current event. Calling this method is equivilent to calling event.getMessage().getLongProperty(..., ...)

Specified by:
getLongProperty in interface UMOEvent
Parameters:
name - the property name
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)
Description copied from interface: UMOEvent
Gets a Double property associated with the current event. Calling this method is equivilent to calling event.getMessage().getDoubleProperty(..., ...)

Specified by:
getDoubleProperty in interface UMOEvent
Parameters:
name - the property name
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)
Description copied from interface: UMOEvent
Gets a Boolean property associated with the current event. Calling this method is equivilent to calling event.getMessage().getbooleanProperty(..., ...)

Specified by:
getBooleanProperty in interface UMOEvent
Parameters:
name - the property name
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)
Description copied from interface: UMOEvent
Sets a Boolean property associated with the current event. Calling this method is equivilent to calling event.getMessage().setBooleanProperty(..., ...)

Specified by:
setBooleanProperty in interface UMOEvent
Parameters:
name - the property name or key
value - the property value

setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
Description copied from interface: UMOEvent
Sets an Integer property associated with the current event. Calling this method is equivilent to calling event.getMessage().setIntProperty(..., ...)

Specified by:
setIntProperty in interface UMOEvent
Parameters:
name - the property name or key
value - the property value

setLongProperty

public void setLongProperty(java.lang.String name,
                            long value)
Description copied from interface: UMOEvent
Sets a Long property associated with the current event. Calling this method is equivilent to calling event.getMessage().setLongProperty(..., ...)

Specified by:
setLongProperty in interface UMOEvent
Parameters:
name - the property name or key
value - the property value

setDoubleProperty

public void setDoubleProperty(java.lang.String name,
                              double value)
Description copied from interface: UMOEvent
Sets a Double property associated with the current event. Calling this method is equivilent to calling event.getMessage().setDoubleProperty(..., ...)

Specified by:
setDoubleProperty in interface UMOEvent
Parameters:
name - the property name or key
value - the property value

getOutputStream

public java.io.OutputStream getOutputStream()
An outputstream the can optionally be used write response data to an incoming message.

Specified by:
getOutputStream in interface UMOEvent
Returns:
an output strem if one has been made available by the message receiver that received the message

removeProperty

public java.lang.Object removeProperty(java.lang.Object key)
Removes a property from the event

Specified by:
removeProperty in interface UMOEvent
Parameters:
key - the property key to remove
Returns:
the removed property or null if the property was not found or if the underlying message does not return the removed property


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