Class ConfigParser
- java.lang.Object
-
- org.apache.commons.chain.config.ConfigParser
-
public class ConfigParser extends java.lang.ObjectClass 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 theparse()method. It is legal to call theparse()method more than once, in order to parse more than one configuration document.- Version:
- $Revision: 482967 $ $Date: 2006-12-06 08:43:48 +0000 (Wed, 06 Dec 2006) $
- Author:
- Craig R. McClanahan
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.commons.digester.DigesterdigesterTheDigesterto be used for parsing.private org.apache.commons.digester.RuleSetruleSetTheRuleSetto be used for configuring our Digester parsing rules.private booleanuseContextClassLoaderShould Digester use the context class loader?
-
Constructor Summary
Constructors Constructor Description ConfigParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.apache.commons.digester.DigestergetDigester()Return theDigesterinstance to be used for parsing, creating one if necessary.org.apache.commons.digester.RuleSetgetRuleSet()Return theRuleSetto be used for configuring ourDigesterparsing rules, creating one if necessary.booleangetUseContextClassLoader()Return the "use context class loader" flag.voidparse(java.net.URL url)Parse the XML document at the specified URL using the configuredRuleSet, registering catalogs with nested chains and commands as they are encountered.voidparse(Catalog catalog, java.net.URL url)Deprecated.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.
-
-
-
Field Detail
-
digester
private org.apache.commons.digester.Digester digester
The
Digesterto be used for parsing.
-
ruleSet
private org.apache.commons.digester.RuleSet ruleSet
The
RuleSetto be used for configuring our Digester parsing rules.
-
useContextClassLoader
private boolean useContextClassLoader
Should Digester use the context class loader?
-
-
Method Detail
-
getDigester
public org.apache.commons.digester.Digester getDigester()
Return the
Digesterinstance to be used for parsing, creating one if necessary.- Returns:
- A Digester instance.
-
getRuleSet
public org.apache.commons.digester.RuleSet getRuleSet()
Return the
RuleSetto be used for configuring ourDigesterparsing rules, creating one if necessary.- Returns:
- The RuleSet for configuring a Digester instance.
-
setRuleSet
public void setRuleSet(org.apache.commons.digester.RuleSet ruleSet)
Set the
RuleSetto be used for configuring ourDigesterparsing rules.- Parameters:
ruleSet- The new RuleSet to use
-
getUseContextClassLoader
public boolean getUseContextClassLoader()
Return the "use context class loader" flag. If set to
true, 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
public void setUseContextClassLoader(boolean useContextClassLoader)
Set the "use context class loader" flag.
- Parameters:
useContextClassLoader- The new flag value
-
parse
public void parse(Catalog catalog, java.net.URL url) throws java.lang.Exception
Deprecated.Use parse(URL) on a configuration resource with "factory" element(s) embeddedParse the XML document at the specified URL, using the configured
RuleSet, 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 explictly.- Parameters:
catalog-Cataloginto which configured chains are to be registeredurl-URLof the XML document to be parsed- Throws:
java.lang.Exception- if a parsing error occurs
-
parse
public void parse(java.net.URL url) throws java.lang.ExceptionParse the XML document at the specified URL using the configured
RuleSet, 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:
java.lang.Exception- if a parsing error occurs
-
-