001 /* $Id: RulesFactory.java 471661 2006-11-06 08:09:25Z skitching $ 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 */ 018 019 package org.apache.commons.digester.plugins; 020 021 import org.apache.commons.digester.Digester; 022 import org.apache.commons.digester.Rules; 023 024 /** 025 * Whenever the scope of a plugin tag is entered, the PluginRules class 026 * creates a new Rules instance and configures it with the appropriate 027 * parsing rules for the plugged-in class. 028 * <p> 029 * Users of the plugins module can specify a subclass of this one to 030 * control the creation of that Rules object. In particular, it can 031 * set up default rules within the returned instance which are applicable 032 * to all plugged-in classes. 033 * 034 * @since 1.6 035 */ 036 037 public abstract class RulesFactory { 038 039 /** 040 * Return an instance of some Rules implementation that the plugged-in 041 * class shall use to match its private parsing rules. 042 * <p> 043 * @param d is the digester that the returned rules object will be 044 * associated with. 045 * 046 * @param pluginClass is the class that is to be configured using rules 047 * added to the returnedobject. 048 * 049 * @throws PluginException if the algorithm finds a source 050 * of rules, but there is something invalid about that source. 051 */ 052 053 public abstract Rules newRules(Digester d, Class pluginClass) 054 throws PluginException; 055 } 056