org.apache.commons.chain.config
Class ConfigCatalogRule

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

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

Digester rule that will cause the top-most element on the Digester stack (if it is a Catalog to be registered with the CatalogFactory instance for our application. If the attribute specified to our constructor has a value, that will be used as the name under which to register this Catalog. Otherwise, this will become the default Catalog for this application.

Version:
$Revision: 155403 $ $Date: 2005-02-26 12:52:46 +0000 (Sat, 26 Feb 2005) $
Author:
Craig R. McClanahan

Field Summary
private  java.lang.String catalogClass
          The fully qualified class name of a Catalog class to use for instantiating new instances.
private  java.lang.String nameAttribute
          The name of the attribute under which we can retrieve the name this catalog should be registered with (if any).
 
Fields inherited from class org.apache.commons.digester.Rule
digester, namespaceURI
 
Constructor Summary
ConfigCatalogRule(java.lang.String nameAttribute, java.lang.String catalogClass)
          Construct a new instance of this rule that looks for an attribute with the specified name.
 
Method Summary
 void begin(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes)
          Retrieve or create a Catalog with the name specified by the nameAttribute attribute, or the default Catalog if there is no such attribute defined.
 
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

catalogClass

private java.lang.String catalogClass

The fully qualified class name of a Catalog class to use for instantiating new instances.


nameAttribute

private java.lang.String nameAttribute

The name of the attribute under which we can retrieve the name this catalog should be registered with (if any).

Constructor Detail

ConfigCatalogRule

public ConfigCatalogRule(java.lang.String nameAttribute,
                         java.lang.String catalogClass)

Construct a new instance of this rule that looks for an attribute with the specified name.

Parameters:
nameAttribute - Name of the attribute containing the name under which this command should be registered
catalogClass - Name of the implementation class for newly created Catalog instances
Method Detail

begin

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

Retrieve or create a Catalog with the name specified by the nameAttribute attribute, or the default Catalog if there is no such attribute defined. Push it onto the top of the stack.

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