View Javadoc

1   /*
2    * $Id: TransformerEditor.java 7976 2007-08-21 14:26:13Z 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.spring.config;
12  
13  import org.mule.MuleException;
14  import org.mule.util.MuleObjectHelper;
15  
16  import java.beans.PropertyEditorSupport;
17  
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  
21  /**
22   * <code>TransformerEditor</code> is used to convert Transformer names into
23   * transformer Objects
24   */
25  public class TransformerEditor extends PropertyEditorSupport
26  {
27      /**
28       * logger used by this class
29       */
30      protected static final Log logger = LogFactory.getLog(TransformerEditor.class);
31  
32      public void setAsText(String text)
33      {
34          try
35          {
36              setValue(MuleObjectHelper.getTransformer(text, (text.indexOf(",") > -1 ? "," : " ")));
37          }
38          catch (MuleException e)
39          {
40              logger.error(e.getMessage(), e);
41          }
42      }
43  }