Class ConfigDefineRule

java.lang.Object
org.apache.commons.digester.Rule
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: 480477 $ $Date: 2006-11-29 08:34:52 +0000 (Wed, 29 Nov 2006) $
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    The name of the attribute under which we can retrieve the fully qualified class name of the implementation class for this new element.
    private String
    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

    Constructors
    Constructor
    Description
    ConfigDefineRule(String nameAttribute, String classAttribute)
    Construct a new instance of this rule that will in turn dynamically register appropriate rules for a new alias element.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    begin(String namespace, String name, 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 Details

    • classAttribute

      private 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 String nameAttribute

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

  • Constructor Details

    • ConfigDefineRule

      public ConfigDefineRule(String nameAttribute, 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 Details

    • begin

      public void begin(String namespace, String name, Attributes attributes) throws 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:
      Exception