Package org.apache.commons.chain.config
Class ConfigParser
java.lang.Object
org.apache.commons.chain.config.ConfigParser
Class to parse the contents of an XML configuration file (using
Commons Digester) that defines and configures commands and command chains
to be registered in a
Catalog. Advanced users can configure the
detailed parsing behavior by configuring the properties of an instance
of this class prior to calling the parse() method. It
is legal to call the parse() method more than once, in order
to parse more than one configuration document.- Version:
- $Revision$ $Date$
- Author:
- Craig R. McClanahan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.commons.digester.DigesterReturn theDigesterinstance to be used for parsing, creating one if necessary.org.apache.commons.digester.RuleSetReturn theRuleSetto be used for configuring ourDigesterparsing rules, creating one if necessary.booleanReturn the "use context class loader" flag.voidParse the XML document at the specified URL using the configuredRuleSet, registering catalogs with nested chains and commands as they are encountered.voidDeprecated.Use parse(URL) on a configuration resource with "factory" element(s) embeddedvoidsetRuleSet(org.apache.commons.digester.RuleSet ruleSet) Set theRuleSetto be used for configuring ourDigesterparsing rules.voidsetUseContextClassLoader(boolean useContextClassLoader) Set the "use context class loader" flag.
-
Constructor Details
-
ConfigParser
public ConfigParser()The Default-Constructor for this class.
-
-
Method Details
-
getDigester
Return theDigesterinstance to be used for parsing, creating one if necessary.- Returns:
- A Digester instance.
-
getRuleSet
Return theRuleSetto be used for configuring ourDigesterparsing rules, creating one if necessary.- Returns:
- The RuleSet for configuring a Digester instance.
-
setRuleSet
Set theRuleSetto be used for configuring ourDigesterparsing rules.- Parameters:
ruleSet- The new RuleSet to use
-
getUseContextClassLoader
Return the "use context class loader" flag. If set totrue, Digester will attempt to instantiate new command and chain instances from the context class loader.- Returns:
trueif Digester should use the context class loader.
-
setUseContextClassLoader
Set the "use context class loader" flag.- Parameters:
useContextClassLoader- The new flag value
-
parse
Deprecated.Use parse(URL) on a configuration resource with "factory" element(s) embeddedParse the XML document at the specified URL, using the configuredRuleSet, registering top level commands into the specifiedCatalog. Use this method only if you have NOT included anyfactoryelement in your configuration resource, and wish to supply the catalog explicitly. -
parse
Parse the XML document at the specified URL using the configuredRuleSet, registering catalogs with nested chains and commands as they are encountered. Use this method only if you have included one or morefactoryelements in your configuration resource.- Parameters:
url-URLof the XML document to be parsed- Throws:
Exception- if a parsing error occurs
-