View Javadoc

1   /*
2    * $Id: EventObjectTransformer.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.extras.client;
12  
13  import org.mule.impl.MuleMessage;
14  import org.mule.umo.transformer.TransformerException;
15  
16  import java.util.EventObject;
17  
18  /**
19   * <code>EventObjectTransformer</code> converts a
20   * <code>java.util.EventObject</code> into a <code>MuleMessage</code>. This
21   * transformer is used by the MuleProxyListener to marshall events into something
22   * that Mule understands.
23   * 
24   * @see MuleProxyListener
25   * @see MuleMessage
26   * @see EventObject
27   */
28  
29  public class EventObjectTransformer extends AbstractEventTransformer
30  {
31  
32      public EventObjectTransformer()
33      {
34          registerSourceType(EventObject.class);
35      }
36  
37      public Object doTransform(Object src, String encoding) throws TransformerException
38      {
39          return new MuleMessage(((EventObject)src).getSource());
40      }
41  
42  }