001/* $Id: RulesFactory.java 992060 2010-09-02 19:09:47Z simonetripodi $
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one or more
004 * contributor license agreements.  See the NOTICE file distributed with
005 * this work for additional information regarding copyright ownership.
006 * The ASF licenses this file to You under the Apache License, Version 2.0
007 * (the "License"); you may not use this file except in compliance with
008 * the License.  You may obtain a copy of the License at
009 *
010 *      http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.commons.digester.plugins;
019
020import org.apache.commons.digester.Digester;
021import org.apache.commons.digester.Rules;
022
023/**
024 * Whenever the scope of a plugin tag is entered, the PluginRules class
025 * creates a new Rules instance and configures it with the appropriate
026 * parsing rules for the plugged-in class.
027 * <p>
028 * Users of the plugins module can specify a subclass of this one to
029 * control the creation of that Rules object. In particular, it can
030 * set up default rules within the returned instance which are applicable
031 * to all plugged-in classes.
032 *
033 * @since 1.6
034 */
035
036public abstract class RulesFactory {
037
038    /**
039     * Return an instance of some Rules implementation that the plugged-in
040     * class shall use to match its private parsing rules.
041     * <p>
042     * @param d is the digester that the returned rules object will be 
043     * associated with.
044     *
045     * @param pluginClass is the class that is to be configured using rules
046     * added to the returnedobject.
047     * 
048     * @throws PluginException if the algorithm finds a source
049     * of rules, but there is something invalid about that source.
050     */
051
052     public abstract Rules newRules(Digester d, Class<?> pluginClass) 
053                        throws PluginException;
054}
055