org.apache.commons.chain.config
Class ConfigDefineRule

java.lang.Object
  extended by org.apache.commons.digester.Rule
      extended by org.apache.commons.chain.config.ConfigDefineRule

 class ConfigDefineRule
extends org.apache.commons.digester.Rule

Digester rule that will dynamically register a new set of rules for a specified element name and default implementation class. This allows "alias" elements to be created for Chain and Command implementation classes that are commonly used. Besides factoring out the class names to make changes easier, this also makes configuration files much easier to read and write.

Version:
$Revision: 1.2 $ $Date: 2004/11/30 05:52:23 $

Field Summary
private  java.lang.String classAttribute
          The name of the attribute under which we can retrieve the fully qualified class name of the implementation class for this new element.
private  java.lang.String nameAttribute
          The name of the attribute under which we can retrieve the name this element for which rules should be created.
 
Fields inherited from class org.apache.commons.digester.Rule
digester, namespaceURI
 
Constructor Summary
ConfigDefineRule(java.lang.String nameAttribute, java.lang.String classAttribute)
          Construct a new instance of this rule that will in turn dynamically register appropriate rules for a new alias element.
 
Method Summary
 void begin(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes)
          Register new rules for the specified name and class.
 
Methods inherited from class org.apache.commons.digester.Rule
begin, body, body, end, end, finish, getDigester, getNamespaceURI, setDigester, setNamespaceURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classAttribute

private java.lang.String classAttribute

The name of the attribute under which we can retrieve the fully qualified class name of the implementation class for this new element.


nameAttribute

private java.lang.String nameAttribute

The name of the attribute under which we can retrieve the name this element for which rules should be created.

Constructor Detail

ConfigDefineRule

public ConfigDefineRule(java.lang.String nameAttribute,
                        java.lang.String classAttribute)

Construct a new instance of this rule that will in turn dynamically register appropriate rules for a new alias element.

Parameters:
nameAttribute - Name of the attribute containing the name of the new element for which rules should generated
classAttribute - Name of the attribute containing the implementation class for the new chain or command
Method Detail

begin

public void begin(java.lang.String namespace,
                  java.lang.String name,
                  org.xml.sax.Attributes attributes)
           throws java.lang.Exception

Register new rules for the specified name and class.

Overrides:
begin in class org.apache.commons.digester.Rule
Parameters:
namespace - the namespace URI of the matching element, or an empty string if the parser is not namespace aware or the element has no namespace
name - the local name if the parser is namespace aware, or just the element name otherwise
attributes - The attribute list of this element
Throws:
java.lang.Exception