View Javadoc

1   /**
2    * Copyright 2005-2006 the original author or authors.
3    *
4    * Licensed under the Gnu General Pubic License, Version 2.0 (the
5    * "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    *
8    *      http://www.opensource.org/licenses/gpl-license.php
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13   * See the Gnu General Public License for more details.
14   */
15  package org.figure8.join.core.setup;
16  
17  import org.apache.commons.digester.Digester;
18  import org.apache.commons.digester.RuleSetBase;
19  /**
20   * The set of Digester rules required to parse a Join application configuration
21   * file (<code>join.cfg.xml</code>).
22   * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
23   * @version $Revision: 1.2 $
24   */
25  public class ApplicationConfigRuleSet extends RuleSetBase{
26     
27     // Override of RuleSetBase --------------------------------------------------
28     
29     /** 
30      * Add the set of Rule instances defined in this RuleSet to the
31      * specified <code>Digester</code> instance. This method should only
32      * be called by a Digester instance. These rules assume that an instance of
33      * <code>org.figure8.join.core.setup.ApplicationConfig</code> is pushed
34      * onto the evaluation stack before parsing begins.
35      * @param digester Digester instance to which the new Rule instances should be added.
36      */
37     public void addRuleInstances(Digester digester){
38        // Create, set and add a ConfigProperty.
39        digester.addObjectCreate(
40           "join-configuration/properties/property",
41           "org.figure8.join.core.setup.ConfigProperty");
42        digester.addSetProperties("join-configuration/properties/property");
43        digester.addSetNext(
44           "join-configuration/properties/property",
45           "addConfigProperty",
46           "org.figure8.join.core.setup.ConfigProperty");
47     }
48  }