View Javadoc

1   /*
2    * $Id: MuleSetPropertiesRule.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.config.builders;
12  
13  import org.apache.commons.digester.SetPropertiesRule;
14  import org.xml.sax.Attributes;
15  
16  /**
17   * this rule Allows for template parameters to be parse on the configuration file
18   * attributes in the form of ${param-name}. These will get resolved against
19   * properties set in the mule-properites element.
20   */
21  public class MuleSetPropertiesRule extends SetPropertiesRule
22  {
23      protected PlaceholderProcessor processor;
24  
25      public MuleSetPropertiesRule()
26      {
27          processor = new PlaceholderProcessor();
28      }
29  
30      public MuleSetPropertiesRule(PlaceholderProcessor processor)
31      {
32          this.processor = processor;
33      }
34  
35      public MuleSetPropertiesRule(String[] strings, String[] strings1)
36      {
37          super(strings, strings1);
38          processor = new PlaceholderProcessor();
39      }
40  
41      public MuleSetPropertiesRule(String[] strings, String[] strings1, PlaceholderProcessor processor)
42      {
43          super(strings, strings1);
44          this.processor = processor;
45      }
46  
47      public void begin(String s1, String s2, Attributes attributes) throws Exception
48      {
49          attributes = processor.processAttributes(attributes, s2);
50          super.begin(attributes);
51      }
52  }