Example #1
0
 protected UMOMessage aggregateEvents(EventGroup events) throws RoutingException {
   StringBuffer newPayload = new StringBuffer();
   UMOEvent event = null;
   for (Iterator iterator = events.getEvents().iterator(); iterator.hasNext(); ) {
     event = (UMOEvent) iterator.next();
     try {
       newPayload.append(event.getMessageAsString()).append(" ");
     } catch (UMOException e) {
       throw new RoutingException(event.getMessage(), event.getEndpoint(), e);
     }
   }
   return new MuleMessage(newPayload.toString(), event.getProperties());
 }
Example #2
0
 /**
  * Sets a property associated with the current event. Calling this method is equivilent to calling
  * <code>event.getMessage().setProperty(..., ...)</code>
  *
  * @param name the property name or key
  * @param value the property value
  */
 public void setProperty(String name, Object value) {
   event.setProperty(name, value);
 }
Example #3
0
 /**
  * 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.
  *
  * @return the message transformed into it's recognised or expected format as a Strings.
  * @throws org.mule.umo.transformer.TransformerException if a failure occurs in the transformer
  * @see org.mule.umo.transformer.UMOTransformer
  */
 public String getTransformedMessageAsString() throws TransformerException {
   return event.getTransformedMessageAsString();
 }
Example #4
0
 /**
  * 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.
  *
  * @return the message transformed into it's recognised or expected format.
  * @throws org.mule.umo.transformer.TransformerException if a failure occurs in the transformer
  * @see org.mule.umo.transformer.UMOTransformer
  */
 public Object getTransformedMessage() throws TransformerException {
   return event.getTransformedMessage();
 }
Example #5
0
 public UMOEndpointURI getEndpointURI() {
   return event.getEndpoint().getEndpointURI();
 }
Example #6
0
 /**
  * Reterns the conents of the message as a byte array.
  *
  * @return the conents of the message as a byte array
  * @throws org.mule.umo.UMOException if the message cannot be converted into an array of bytes
  */
 public byte[] getMessageAsBytes() throws UMOException {
   return event.getMessageAsBytes();
 }
Example #7
0
 /**
  * Returns a map of properties associated with the event
  *
  * @return a map of properties on the event
  */
 public Map getProperties() {
   return event.getProperties();
 }
Example #8
0
 /**
  * Sets a Long property associated with the current event. Calling this method is equivilent to
  * calling <code>event.getMessage().setLongProperty(..., ...)</code>
  *
  * @param name the property name or key
  * @param value the property value
  */
 public void setLongProperty(String name, long value) {
   event.setLongProperty(name, value);
 }
Example #9
0
 /**
  * Gets a property associated with the current event. Calling this method is equivilent to calling
  * <code>event.getMessage().getProperty(...)</code>
  *
  * @param name the property name
  * @return the property value or null if the property does not exist
  */
 public Object getProperty(String name) {
   return event.getProperty(name);
 }
Example #10
0
 /** @return the component descriptor of the component that received this event */
 public UMODescriptor getComponentDescriptor() {
   return event.getComponent().getDescriptor();
 }
Example #11
0
 MuleEventContext(UMOEvent event) {
   this.event = event;
   this.session = event.getSession();
 }
Example #12
0
 /**
  * This will dispatch an event asynchronously via the configured outbound endpoint on the
  * component for this session
  *
  * @param message payload to dispatch
  * @throws org.mule.umo.UMOException if there is no outbound endpoint configured on the component
  *     or the events fails during dispatch
  */
 public void dispatchEvent(Object message) throws UMOException {
   session.dispatchEvent(new MuleMessage(message, event.getProperties()));
 }
Example #13
0
 /**
  * Depending on the session state this methods either Passes an event synchronously to the next
  * available Mule UMO in the pool or via the endpoint configured for the event
  *
  * @param message the message payload to send
  * @return the return Message from the call or null if there was no result
  * @throws org.mule.umo.UMOException if the event fails to be processed by the component or the
  *     transport for the endpoint
  */
 public UMOMessage sendEvent(UMOMessage message) throws UMOException {
   // If synchronous receive has not been explicitly set, default it to
   // true
   setRemoteSync(message, event.getEndpoint());
   return session.sendEvent(message);
 }
Example #14
0
 /**
  * This will send an event via the configured outbound router on the component
  *
  * @param message the message to send
  * @return the result of the send if any
  * @throws org.mule.umo.UMOException if there is no outbound endpoint configured on the component
  *     or the events fails during dispatch
  */
 public UMOMessage sendEvent(Object message) throws UMOException {
   return sendEvent(new MuleMessage(message, event.getProperties()));
 }
Example #15
0
 /**
  * Returns the message contents as a string
  *
  * @return the message contents as a string
  * @throws org.mule.umo.UMOException if the message cannot be converted into a string
  */
 public String getMessageAsString() throws UMOException {
   return event.getMessageAsString();
 }
Example #16
0
 /**
  * Sets a Boolean property associated with the current event. Calling this method is equivilent to
  * calling <code>event.getMessage().setBooleanProperty(..., ...)</code>
  *
  * @param name the property name or key
  * @param value the property value
  */
 public void setBooleanProperty(String name, boolean value) {
   event.setBooleanProperty(name, value);
 }
Example #17
0
 /**
  * Sets an Integer property associated with the current event. Calling this method is equivilent
  * to calling <code>event.getMessage().setIntProperty(..., ...)</code>
  *
  * @param name the property name or key
  * @param value the property value
  */
 public void setIntProperty(String name, int value) {
   event.setIntProperty(name, value);
 }
Example #18
0
 /**
  * Gets a property associated with the current event. Calling this method is equivilent to calling
  * <code>event.getMessage().getProperty(..., ...)</code>
  *
  * @param name the property name
  * @param defaultValue a default value if the property doesn't exist in the event
  * @return the property value or the defaultValue if the property does not exist
  */
 public Object getProperty(String name, Object defaultValue) {
   return event.getProperty(name, defaultValue);
 }
Example #19
0
 /**
  * Sets a Double property associated with the current event. Calling this method is equivilent to
  * calling <code>event.getMessage().setDoubleProperty(..., ...)</code>
  *
  * @param name the property name or key
  * @param value the property value
  */
 public void setDoubleProperty(String name, double value) {
   event.setDoubleProperty(name, value);
 }
Example #20
0
 /**
  * Gets an Integer property associated with the current event. Calling this method is equivilent
  * to calling <code>event.getMessage().getIntProperty(..., ...)</code>
  *
  * @param name the property name
  * @param defaultValue a default value if the property doesn't exist in the event
  * @return the property value or the defaultValue if the property does not exist
  */
 public int getIntProperty(String name, int defaultValue) {
   return event.getIntProperty(name, defaultValue);
 }
Example #21
0
 /**
  * An outputstream the can optionally be used write response data to an incoming message.
  *
  * @return an output strem if one has been made available by the message receiver that received
  *     the message
  */
 public OutputStream getOutputStream() {
   return event.getOutputStream();
 }
Example #22
0
 /**
  * Gets a Long property associated with the current event. Calling this method is equivilent to
  * calling <code>event.getMessage().getLongProperty(..., ...)</code>
  *
  * @param name the property name
  * @param defaultValue a default value if the property doesn't exist in the event
  * @return the property value or the defaultValue if the property does not exist
  */
 public long getLongProperty(String name, long defaultValue) {
   return event.getLongProperty(name, defaultValue);
 }
Example #23
0
 /**
  * Determines whether the was sent synchrounously or not
  *
  * @return true if the event is synchronous
  */
 public boolean isSynchronous() {
   return event.isSynchronous();
 }
Example #24
0
 /**
  * Gets a Double property associated with the current event. Calling this method is equivilent to
  * calling <code>event.getMessage().getDoubleProperty(..., ...)</code>
  *
  * @param name the property name
  * @param defaultValue a default value if the property doesn't exist in the event
  * @return the property value or the defaultValue if the property does not exist
  */
 public double getDoubleProperty(String name, double defaultValue) {
   return event.getDoubleProperty(name, defaultValue);
 }
Example #25
0
 /**
  * Get the timeout value associated with the event
  *
  * @return the timeout for the event
  */
 public int getTimeout() {
   return event.getTimeout();
 }
Example #26
0
 /**
  * Gets a Boolean property associated with the current event. Calling this method is equivilent to
  * calling <code>event.getMessage().getbooleanProperty(..., ...)</code>
  *
  * @param name the property name
  * @param defaultValue a default value if the property doesn't exist in the event
  * @return the property value or the defaultValue if the property does not exist
  */
 public boolean getBooleanProperty(String name, boolean defaultValue) {
   return event.getBooleanProperty(name, defaultValue);
 }
Example #27
0
 /**
  * Returns the message payload for this event
  *
  * @return the message payload for this event
  */
 public UMOMessage getMessage() {
   return event.getMessage();
 }
Example #28
0
 /**
  * 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.
  *
  * @return the message transformed into it's recognised or expected format as an array of bytes.
  * @throws org.mule.umo.transformer.TransformerException if a failure occurs in the transformer
  * @see org.mule.umo.transformer.UMOTransformer
  */
 public byte[] getTransformedMessageAsBytes() throws TransformerException {
   return event.getTransformedMessageAsBytes();
 }