View Javadoc

1   /** ------------------------------------
2    * SweetDEV RIA library
3    * Copyright [2006 - 2010] [Ideo Technologies]
4    * ------------------------------------
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   * 		http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   *
18   *
19   * For more information, please contact us at:
20   *         Ideo Technologies S.A
21   *        124 rue de Verdun
22   *        92800 Puteaux - France
23   *
24   *      France & Europe Phone : +33 1.46.25.09.60
25   *
26   *
27   *        web : http://www.ideotechnologies.com
28   *        email : SweetDEV-RIA@ideotechnologies.com
29   *
30   *
31   * @version ${pom.version}
32   * @author Ideo Technologies
33   */
34  package com.ideo.sweetdevria.config;
35  
36  
37  import org.apache.commons.digester.Digester;
38  import org.apache.commons.digester.RuleSetBase;
39  
40  import com.ideo.sweetdevria.config.factories.BuilderMappingFactory;
41  import com.ideo.sweetdevria.config.factories.DrawerMappingFactory;
42  
43  
44  /**
45   * Rules in order to parse configuration file.
46   */
47  public class ConfigRuleSet extends RuleSetBase {
48  
49  	/**
50       * Add the set of Rule instances defined in this RuleSet to the
51       * specified <code>Digester</code> instance, associating them with
52       * our namespace URI (if any).  This method should only be called
53       * by a Digester instance.
54       *
55       * @param digester Digester instance to which the new Rule instances
56       * should be added.
57       */
58      public void addRuleInstances(Digester digester) {
59          digester.addObjectCreate(	"ria-config/property", "com.ideo.sweetdevria.config.elements.PropertyConfig");
60          digester.addSetProperties(	"ria-config/property");
61          digester.addSetNext(		"ria-config/property", "addPropertyConfig", "com.ideo.sweetdevria.config.elements.PropertyConfig");
62      	
63      	digester.addFactoryCreate(	"ria-config/builders/builder", new BuilderMappingFactory());
64      	digester.addSetProperties(	"ria-config/builders/builder");
65      	digester.addSetNext(		"ria-config/builders/builder","addBuilderConfig","com.ideo.sweetdevria.config.elements.BuilderConfig");
66  
67      	digester.addFactoryCreate(	"ria-config/drawers/drawer", new DrawerMappingFactory());
68      	digester.addSetProperties(	"ria-config/drawers/drawer");
69      	digester.addSetNext(		"ria-config/drawers/drawer","addDrawerConfig","com.ideo.sweetdevria.config.elements.DrawerConfig");
70      	digester.addSetProperty(	"ria-config/drawers/drawer/set-property", "property", "value");
71  
72          digester.addObjectCreate(	"ria-config/message-resources", "com.ideo.sweetdevria.config.elements.MessageResourcesConfig", "className");
73          digester.addSetProperties(	"ria-config/message-resources");
74          digester.addSetNext(		"ria-config/message-resources", "addMessageResourcesConfig", "com.ideo.sweetdevria.config.elements.MessageResourcesConfig");
75          digester.addSetProperty(	"ria-config/message-resources/set-property", "property", "value");
76  
77          digester.addObjectCreate(	"ria-config/plug-in", "com.ideo.sweetdevria.config.elements.PlugInConfig");
78          digester.addSetProperties(	"ria-config/plug-in");
79          digester.addSetNext(		"ria-config/plug-in", "addPlugInConfig", "com.ideo.sweetdevria.config.elements.PlugInConfig");
80  
81      }
82  
83  }
84