org.mule.umo
Interface UMOEvent

All Known Implementing Classes:
MuleEvent

public interface UMOEvent

UMOEvent 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 a UMOMessage payload 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: 3798 $
Author:
Ross Mason
See Also:
UMOMessage

Field Summary
static int TIMEOUT_DO_NOT_WAIT
           
static int TIMEOUT_NOT_SET_VALUE
           
static int TIMEOUT_WAIT_FOREVER
           
 
Method Summary
 boolean getBooleanProperty(String name, boolean defaultValue)
          Deprecated. use event.getMessage().getProperty()
 UMOComponent getComponent()
          Retrieves the component for the current event
 UMOCredentials getCredentials()
           
 double getDoubleProperty(String name, double defaultValue)
          Deprecated. use event.getMessage().getProperty()
 String getEncoding()
          Gets the encoding for this message.
 UMOImmutableEndpoint getEndpoint()
          Gets the endpoint associated with this event
 String getId()
          Every event in the system is assigned a universally unique id (UUID).
 int getIntProperty(String name, int defaultValue)
          Deprecated. use event.getMessage().getProperty()
 long getLongProperty(String name, long defaultValue)
          Deprecated. use event.getMessage().getProperty()
 UMOMessage 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
 OutputStream getOutputStream()
          An outputstream the can optionally be used write response data to an incoming message.
 Object getProperty(String name)
          Deprecated. use event.getMessage().getProperty()
 Object getProperty(String name, boolean exhaustiveSearch)
          Gets a property associated with the current event.
 Object getProperty(String name, Object defaultValue)
          Deprecated. use event.getMessage().getProperty()
 Object getProperty(String name, Object defaultValue, boolean exhaustiveSearch)
          Gets a property associated with the current event.
 UMOSession getSession()
          Retrieves the component session for the current event
 String getStringProperty(String name, String defaultValue)
          Deprecated. use event.getMessage().getStringProperty()
 int getTimeout()
          The number of milliseconds to wait for a return event when running synchronously.
 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.
 String getTransformedMessageAsString()
          Returns the message transformed into it's recognised or expected format and then into a String.
 String getTransformedMessageAsString(String encoding)
          Returns the message transformed into it's recognised or expected format and then into a String.
 boolean isStopFurtherProcessing()
          Determines whether the default processing for this event will be executed.
 boolean isStreaming()
          Determines whether the event flow is being streamed
 boolean isSynchronous()
          Determines whether the was sent synchrounously or not
 Object removeProperty(String key)
          Deprecated. use event.getMessage().removeProperty()
 void setBooleanProperty(String name, boolean value)
          Deprecated. use event.getMessage().setBooleanProperty()
 void setDoubleProperty(String name, double value)
          Deprecated. use event.getMessage().setDoubleProperty()
 void setIntProperty(String name, int value)
          Deprecated. use event.getMessage().setIntProperty()
 void setLongProperty(String name, long value)
          Deprecated. use event.getMessage().setLongProperty()
 void setProperty(String name, Object value)
          Deprecated. use event.getMessage().setProperty()
 void setStopFurtherProcessing(boolean stopFurtherProcessing)
          Determines whether the default processing for this event will be executed.
 void setStringProperty(String name, String value)
          Deprecated. use event.getMessage().setStringProperty()
 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.
 

Field Detail

TIMEOUT_WAIT_FOREVER

public static final int TIMEOUT_WAIT_FOREVER
See Also:
Constant Field Values

TIMEOUT_DO_NOT_WAIT

public static final int TIMEOUT_DO_NOT_WAIT
See Also:
Constant Field Values

TIMEOUT_NOT_SET_VALUE

public static final int TIMEOUT_NOT_SET_VALUE
See Also:
Constant Field Values
Method Detail

getMessage

public UMOMessage getMessage()
Returns the message payload for this event

Returns:
the message payload for this event

getCredentials

public UMOCredentials getCredentials()

getMessageAsBytes

public byte[] getMessageAsBytes()
                         throws UMOException
Reterns the conents of the message as a byte array.

Returns:
the conents of the message as a byte array
Throws:
UMOException - if the message cannot be converted into an array of bytes

getTransformedMessage

public Object getTransformedMessage()
                             throws TransformerException
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.

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

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 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. If necessary this will use the encoding set on the event

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 String getMessageAsString()
                          throws UMOException
Returns the message contents as a string If necessary this will use the encoding set on the event

Returns:
the message contents as a string
Throws:
UMOException - if the message cannot be converted into a string

getTransformedMessageAsString

public String getTransformedMessageAsString(String encoding)
                                     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.

Parameters:
encoding - the encoding to use when converting the message to string
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 String getMessageAsString(String encoding)
                          throws UMOException
Returns the message contents as a string

Parameters:
encoding - the encoding to use when converting the message to string
Returns:
the message contents as a string
Throws:
UMOException - if the message cannot be converted into a string

getId

public String getId()
Every event in the system is assigned a universally unique id (UUID).

Returns:
the unique identifier for the event

getProperty

public Object getProperty(String name)
Deprecated. use event.getMessage().getProperty()

Gets a property associated with the current event. Calling this method is equivilent to calling event.getMessage().getProperty(...)

Parameters:
name - the property name
Returns:
the property value or null if the property does not exist

getProperty

public Object getProperty(String name,
                          boolean exhaustiveSearch)
Gets a property associated with the current event. If exhaustiveSearch is true, the endpoint and connector associated with the event will also be searched for the property.

Parameters:
name - the property name
exhaustiveSearch - also search the endpoint and connector for the property
Returns:
the property value or null if the property does not exist

getProperty

public Object getProperty(String name,
                          Object defaultValue)
Deprecated. use event.getMessage().getProperty()

Gets a property associated with the current event. Calling this method is equivilent to calling event.getMessage().getProperty(..., ...)

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

getProperty

public Object getProperty(String name,
                          Object defaultValue,
                          boolean exhaustiveSearch)
Gets a property associated with the current event. If exhaustiveSearch is true, the endpoint and connector associated with the event will also be searched for the property.

Parameters:
name - the property name
defaultValue - a default value if the property doesn't exist in the event
exhaustiveSearch - also search the endpoint and connector for the property
Returns:
the property value or the defaultValue if the property does not exist

getIntProperty

public int getIntProperty(String name,
                          int defaultValue)
Deprecated. use event.getMessage().getProperty()

Gets an Integer property associated with the current event. Calling this method is equivilent to calling event.getMessage().getIntProperty(..., ...)

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(String name,
                            long defaultValue)
Deprecated. use event.getMessage().getProperty()

Gets a Long property associated with the current event. Calling this method is equivilent to calling event.getMessage().getLongProperty(..., ...)

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(String name,
                                double defaultValue)
Deprecated. use event.getMessage().getProperty()

Gets a Double property associated with the current event. Calling this method is equivilent to calling event.getMessage().getDoubleProperty(..., ...)

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(String name,
                                  boolean defaultValue)
Deprecated. use event.getMessage().getProperty()

Gets a Boolean property associated with the current event. Calling this method is equivilent to calling event.getMessage().getbooleanProperty(..., ...)

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

getStringProperty

public String getStringProperty(String name,
                                String defaultValue)
Deprecated. use event.getMessage().getStringProperty()

Gets a String property associated with the current event. Calling this method is equivilent to calling event.getMessage().getStringProperty(..., ...)

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(String name,
                        Object value)
Deprecated. use event.getMessage().setProperty()

Sets a property associated with the current event. Calling this method is equivilent to calling event.getMessage().setProperty(..., ...)

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

setBooleanProperty

public void setBooleanProperty(String name,
                               boolean value)
Deprecated. use event.getMessage().setBooleanProperty()

Sets a Boolean property associated with the current event. Calling this method is equivilent to calling event.getMessage().setBooleanProperty(..., ...)

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

setIntProperty

public void setIntProperty(String name,
                           int value)
Deprecated. use event.getMessage().setIntProperty()

Sets an Integer property associated with the current event. Calling this method is equivilent to calling event.getMessage().setIntProperty(..., ...)

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

setLongProperty

public void setLongProperty(String name,
                            long value)
Deprecated. use event.getMessage().setLongProperty()

Sets a Long property associated with the current event. Calling this method is equivilent to calling event.getMessage().setLongProperty(..., ...)

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

setDoubleProperty

public void setDoubleProperty(String name,
                              double value)
Deprecated. use event.getMessage().setDoubleProperty()

Sets a Double property associated with the current event. Calling this method is equivilent to calling event.getMessage().setDoubleProperty(..., ...)

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

setStringProperty

public void setStringProperty(String name,
                              String value)
Deprecated. use event.getMessage().setStringProperty()

Sets a String property associated with the current event. Calling this method is equivilent to calling event.getMessage().setStringProperty(..., ...)

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

getEndpoint

public UMOImmutableEndpoint getEndpoint()
Gets the endpoint associated with this event

Returns:
the endpoint associated with this event

getSession

public UMOSession getSession()
Retrieves the component session for the current event

Returns:
the component session for the event

getComponent

public UMOComponent getComponent()
Retrieves the component for the current event

Returns:
the component for the event

isStopFurtherProcessing

public boolean isStopFurtherProcessing()
Determines whether the default processing for this event will be executed. By default, the Mule server will route events according to a components configuration. The user can override this behaviour by obtaining a reference to the Event context, either by implementing org.mule.umo.lifecycle.Callable or calling UMOManager.getEventContext to obtain the UMOEventContext for the current thread. The user can programmatically control how events are dispached.

Returns:
Returns true is the user has set stopFurtherProcessing.
See Also:
UMOManager, UMOEventContext, Callable

setStopFurtherProcessing

public void setStopFurtherProcessing(boolean stopFurtherProcessing)
Determines whether the default processing for this event will be executed. By default, the Mule server will route events according to a components configuration. The user can override this behaviour by obtaining a reference to the Event context, either by implementing org.mule.umo.lifecycle.Callable or calling UMOManager.getEventContext to obtain the UMOEventContext for the current thread. The user can programmatically control how events are dispached.

Parameters:
stopFurtherProcessing - the value to set.

isSynchronous

public boolean isSynchronous()
Determines whether the was sent synchrounously or not

Returns:
true if the event is synchronous

setSynchronous

public void setSynchronous(boolean value)
Determines whether the was sent synchrounously or not

Parameters:
value - true if the event is synchronous

getTimeout

public int getTimeout()
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 millisecond value

Returns:
the event timeout in milliseconds

setTimeout

public void setTimeout(int timeout)
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

Parameters:
timeout - the event timeout in milliseconds

getOutputStream

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

Returns:
an output strem if one has been made available by the message receiver that received the message

removeProperty

public Object removeProperty(String key)
Deprecated. use event.getMessage().removeProperty()

Removes a property from the event

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

isStreaming

public boolean isStreaming()
Determines whether the event flow is being streamed

Returns:
true if the request should be streamed

getEncoding

public String getEncoding()
Gets the encoding for this message.

Returns:
the encoding for the event. This must never return null.


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.