FileDocCategorySizeDatePackage
AbstractRulesImpl.javaAPI DocApache Tomcat 6.0.146110Fri Jul 20 04:20:36 BST 2007org.apache.tomcat.util.digester

AbstractRulesImpl

public abstract class AbstractRulesImpl extends Object implements Rules

AbstractRuleImpl provides basic services for Rules implementations. Extending this class should make it easier to create a Rules implementation.

AbstractRuleImpl manages the Digester and namespaceUri properties. If the subclass overrides {@link #registerRule} (rather than {@link #add}), then the Digester and namespaceURI of the Rule will be set correctly before it is passed to registerRule. The subclass can then perform whatever it needs to do to register the rule.

since
1.5

Fields Summary
private Digester
digester
Digester using this Rules implementation
private String
namespaceURI
Namespace uri to assoicate with subsequent Rule's
Constructors Summary
Methods Summary
public voidadd(java.lang.String pattern, Rule rule)
Registers a new Rule instance matching the specified pattern. This implementation sets the Digester and the namespaceURI on the Rule before calling {@link #registerRule}.

param
pattern Nesting pattern to be matched for this Rule
param
rule Rule instance to be registered

        // set up rule
        if (this.digester != null) {
            rule.setDigester(this.digester);
        }
        
        if (this.namespaceURI != null) {
            rule.setNamespaceURI(this.namespaceURI);
        }
        
        registerRule(pattern, rule);
        
    
public abstract voidclear()
Clear all existing Rule instance registrations.

public DigestergetDigester()
Return the Digester instance with which this Rules instance is associated.

        return digester;
    
public java.lang.StringgetNamespaceURI()
Return the namespace URI that will be applied to all subsequently added Rule objects.

        return namespaceURI;
    
public java.util.Listmatch(java.lang.String pattern)
Return a List of all registered Rule instances that match the specified nesting pattern, or a zero-length List if there are no matches. If more than one Rule instance matches, they must be returned in the order originally registered through the add() method.

param
pattern Nesting pattern to be matched
deprecated
Call match(namespaceURI,pattern) instead.

        return match(namespaceURI, pattern);
    
public abstract java.util.Listmatch(java.lang.String namespaceURI, java.lang.String pattern)
Return a List of all registered Rule instances that match the specified nesting pattern, or a zero-length List if there are no matches. If more than one Rule instance matches, they must be returned in the order originally registered through the add() method.

param
namespaceURI Namespace URI for which to select matching rules, or null to match regardless of namespace URI
param
pattern Nesting pattern to be matched

protected abstract voidregisterRule(java.lang.String pattern, Rule rule)
Register rule at given pattern. The the Digester and namespaceURI properties of the given Rule can be assumed to have been set properly before this method is called.

param
pattern Nesting pattern to be matched for this Rule
param
rule Rule instance to be registered

public abstract java.util.Listrules()
Return a List of all registered Rule instances, or a zero-length List if there are no registered Rule instances. If more than one Rule instance has been registered, they must be returned in the order originally registered through the add() method.

public voidsetDigester(Digester digester)
Set the Digester instance with which this Rules instance is associated.

param
digester The newly associated Digester instance

        this.digester = digester;
    
public voidsetNamespaceURI(java.lang.String namespaceURI)
Set the namespace URI that will be applied to all subsequently added Rule objects.

param
namespaceURI Namespace URI that must match on all subsequently added rules, or null for matching regardless of the current namespace URI

        this.namespaceURI = namespaceURI;