001    package org.apache.commons.digester3;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    /**
023     * <p>
024     * Public interface defining a shorthand means of configuring a complete set of related <code>Rule</code> definitions,
025     * possibly associated with a particular namespace URI, in one operation. To use an instance of a class that imlements
026     * this interface:
027     * </p>
028     * <ul>
029     * <li>Create a concrete implementation of this interface.</li>
030     * <li>Optionally, you can configure a <code>RuleSet</code> to be relevant only for a particular namespace URI by
031     * configuring the value to be returned by <code>getNamespaceURI()</code>.</li>
032     * <li>As you are configuring your Digester instance, call <code>digester.addRuleSet()</code> and pass the RuleSet
033     * instance.</li>
034     * <li>Digester will call the <code>addRuleInstances()</code> method of your RuleSet to configure the
035     * necessary rules.</li>
036     * </ul>
037     */
038    public interface RuleSet
039    {
040    
041        // ------------------------------------------------------------- Properties
042    
043        /**
044         * Return the namespace URI that will be applied to all Rule instances created from this RuleSet.
045         *
046         * @return the namespace URI that will be applied to all Rule instances created from this RuleSet
047         */
048        String getNamespaceURI();
049    
050        // --------------------------------------------------------- Public Methods
051    
052        /**
053         * Add the set of Rule instances defined in this RuleSet to the specified <code>Digester</code> instance,
054         * associating them with our namespace URI (if any). This method should only be called by a Digester instance.
055         * 
056         * @param digester Digester instance to which the new Rule instances should be added.
057         */
058        void addRuleInstances( Digester digester );
059    
060    }