org.apache.commons.digester.plugins
Class PluginManager

java.lang.Object
  extended by org.apache.commons.digester.plugins.PluginManager

public class PluginManager
extends Object

Coordinates between PluginDeclarationRule and PluginCreateRule objects, providing a place to share data between instances of these rules.

One instance of this class exists per PluginRules instance.

Since:
1.6

Constructor Summary
PluginManager(PluginContext r)
          Construct a "root" PluginManager, ie one with no parent.
PluginManager(PluginManager parent)
          Construct a "child" PluginManager.
 
Method Summary
 void addDeclaration(Declaration decl)
          Add the declaration to the set of known declarations.
 RuleLoader findLoader(Digester digester, String id, Class<?> pluginClass, Properties props)
          Given a plugin class and some associated properties, scan the list of known RuleFinder instances until one detects a source of custom rules for this plugin (aka a RuleLoader).
 Declaration getDeclarationByClass(String className)
          Return the declaration object with the specified class.
 Declaration getDeclarationById(String id)
          Return the declaration object with the specified id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginManager

public PluginManager(PluginContext r)
Construct a "root" PluginManager, ie one with no parent.


PluginManager

public PluginManager(PluginManager parent)
Construct a "child" PluginManager. When declarations are added to a "child", they are stored within the child and do not modify the parent, so when the child goes out of scope, those declarations disappear. When asking a "child" to retrieve a declaration, it delegates the search to its parent if it does not hold a matching entry itself.

Parameters:
parent - must be non-null.
Method Detail

addDeclaration

public void addDeclaration(Declaration decl)
Add the declaration to the set of known declarations.

TODO: somehow get a reference to a Digester object so that we can really log here. Currently, all logging is disabled from this method.

Parameters:
decl - an object representing a plugin class.

getDeclarationByClass

public Declaration getDeclarationByClass(String className)
Return the declaration object with the specified class. If no such plugin is known, null is returned.


getDeclarationById

public Declaration getDeclarationById(String id)
Return the declaration object with the specified id. If no such plugin is known, null is returned.

Parameters:
id - Description of the Parameter
Returns:
The declaration value

findLoader

public RuleLoader findLoader(Digester digester,
                             String id,
                             Class<?> pluginClass,
                             Properties props)
                      throws PluginException
Given a plugin class and some associated properties, scan the list of known RuleFinder instances until one detects a source of custom rules for this plugin (aka a RuleLoader).

If no source of custom rules can be found, null is returned.

Throws:
PluginException


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.