public class DigestingPlugIn extends java.lang.Object implements PlugIn
An implementation of PlugIn which can be configured to
instantiate a graph of objects using the Commons Digester and place the
root object of that graph into the Application context.
PlugIn| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
configPath |
protected java.lang.String |
configSource |
protected java.lang.String |
digesterPath |
protected java.lang.String |
digesterSource |
protected java.lang.String |
key |
protected ModuleConfig |
moduleConfig |
protected boolean |
push |
protected java.lang.String |
rulesets |
protected ActionServlet |
servlet |
protected static java.lang.String |
SOURCE_CLASSPATH |
protected static java.lang.String |
SOURCE_FILE |
protected static java.lang.String |
SOURCE_SERVLET |
| Constructor and Description |
|---|
DigestingPlugIn()
Constructor for DigestingPlugIn.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
applyRuleSets(org.apache.commons.digester.Digester digester)
Instantiate any
RuleSet classes defined in the
rulesets property and use them to add rules to our
Digester. |
void |
destroy()
Receive notification that our owning module is being shut down.
|
protected org.apache.commons.digester.Digester |
digesterFromXml(java.lang.String path,
java.lang.String source)
Instantiate a Digester from an XML input stream using the Commons
DigesterLoader. |
protected java.net.URL |
getClassPathURL(java.lang.String path)
Given a string, return a URL to a classpath resource of that name.
|
java.lang.String |
getConfigPath() |
java.lang.String |
getConfigSource() |
protected java.net.URL |
getConfigURL(java.lang.String path,
java.lang.String source)
Look up a resource path using one of a set of known path resolution
mechanisms and return a URL to the resource.
|
java.lang.String |
getDigesterPath() |
java.lang.String |
getDigesterSource() |
protected java.net.URL |
getFileURL(java.lang.String path)
Given a string, return a URL to a Filesystem resource of that name.
|
java.lang.String |
getKey() |
boolean |
getPush() |
java.lang.String |
getRulesets() |
protected java.net.URL |
getServletContextURL(java.lang.String path)
Given a string, return a URL to a Servlet Context resource of that
name.
|
void |
init(ActionServlet servlet,
ModuleConfig config)
Initialize a
Digester and use it to parse a
configuration file, resulting in a root object which will be placed
into the ServletContext. |
protected org.apache.commons.digester.Digester |
initializeDigester()
Initialize the
Digester which will be used to process the
main configuration. |
protected org.apache.commons.digester.Digester |
newDigesterInstance()
Instantiate a
Digester. |
void |
setConfigPath(java.lang.String configPath) |
void |
setConfigSource(java.lang.String configSource)
Set the source of the config file.
|
void |
setDigesterPath(java.lang.String digesterPath)
The path to a Digester XML configuration file, relative to the
digesterSource property. |
void |
setDigesterSource(java.lang.String digesterSource)
The lookup mechanism to be used to resolve
digesterPath
(optional). |
void |
setKey(java.lang.String key) |
void |
setPush(boolean push)
If set to
true, this PlugIn will be pushed onto the
Digester stack before the digester parse method is
called. |
void |
setRulesets(java.lang.String ruleSets)
A comma-delimited list of one or more classes which implement
org.apache.commons.digester.RuleSet. |
protected void |
storeGeneratedObject(java.lang.Object obj)
This method is called after the Digester runs to store the generated
object somewhere.
|
protected static final java.lang.String SOURCE_CLASSPATH
protected static final java.lang.String SOURCE_FILE
protected static final java.lang.String SOURCE_SERVLET
protected java.lang.String configPath
protected java.lang.String configSource
protected java.lang.String digesterPath
protected java.lang.String digesterSource
protected java.lang.String key
protected ModuleConfig moduleConfig
protected java.lang.String rulesets
protected ActionServlet servlet
protected boolean push
public void destroy()
public void init(ActionServlet servlet, ModuleConfig config) throws javax.servlet.ServletException
Initialize a Digester and use it to parse a
configuration file, resulting in a root object which will be placed
into the ServletContext.
protected org.apache.commons.digester.Digester initializeDigester()
throws javax.servlet.ServletException
Digester which will be used to process the
main configuration.javax.servlet.ServletExceptionprotected org.apache.commons.digester.Digester newDigesterInstance()
Instantiate a Digester.
Subclasses may wish to override this to provide a subclass of Digester, or to configure the Digester using object methods.
org.apache.commons.digester.Digesterprotected org.apache.commons.digester.Digester digesterFromXml(java.lang.String path,
java.lang.String source)
throws java.io.IOException
Instantiate a Digester from an XML input stream using the Commons
DigesterLoader.
path - the path to the digester rules XML to be found using
sourcesource - a string indicating the lookup method to be used with
pathFileNotFoundExceptionMalformedURLExceptionjava.io.IOExceptiongetConfigURL(String, String)protected void applyRuleSets(org.apache.commons.digester.Digester digester)
throws javax.servlet.ServletException
RuleSet classes defined in the
rulesets property and use them to add rules to our
Digester.digester - the Digester instance to add RuleSet objects to.javax.servlet.ServletExceptionprotected java.net.URL getConfigURL(java.lang.String path,
java.lang.String source)
throws java.io.IOException
Look up a resource path using one of a set of known path resolution mechanisms and return a URL to the resource.
path - a String which is meaningful to one of the known
resolution mechanisms.source - one of the known path resolution mechanisms:
java.io.FileNotFoundExceptionjava.net.MalformedURLExceptionjava.io.IOExceptionprotected java.net.URL getClassPathURL(java.lang.String path)
path - a Classpath-relative string identifying a resource.protected java.net.URL getServletContextURL(java.lang.String path)
throws java.io.IOException
path - a Classpath-relative string identifying a resource.MalformedURLExceptionjava.io.IOExceptionprotected java.net.URL getFileURL(java.lang.String path)
throws java.io.IOException
path - a path to a file.MalformedURLExceptionFileNotFoundExceptionjava.io.IOExceptionpublic void setConfigPath(java.lang.String configPath)
configPath - the path to configuration information for this
PlugIn.configSourcepublic java.lang.String getConfigPath()
configSourcepublic void setConfigSource(java.lang.String configSource)
configSource - the source (lookup method) for the config file.configPathpublic java.lang.String getConfigSource()
configPathprotected void storeGeneratedObject(java.lang.Object obj)
key.obj - The object to save.public void setKey(java.lang.String key)
key - The ServletContext attribute name to store the generated
object under.public java.lang.String getKey()
public void setRulesets(java.lang.String ruleSets)
A comma-delimited list of one or more classes which implement
org.apache.commons.digester.RuleSet. (Optional)
public java.lang.String getRulesets()
RuleSet classes.public void setDigesterPath(java.lang.String digesterPath)
The path to a Digester XML configuration file, relative to the
digesterSource property. (Optional)
digesterSource,
getConfigURL(String, String)public java.lang.String getDigesterPath()
digesterSource,
getConfigURL(String, String)public void setDigesterSource(java.lang.String digesterSource)
The lookup mechanism to be used to resolve digesterPath
(optional).
digesterSource - getConfigURL(String, String)public java.lang.String getDigesterSource()
digesterPath.getConfigURL(String, String)public void setPush(boolean push)
If set to true, this PlugIn will be pushed onto the
Digester stack before the digester parse method is
called.
Defaults to false
push - public boolean getPush()
PlugIn instance will be pushed
onto the Digester stack before
digester.parse() is called.Copyright © 2000–2025 Apache Software Foundation. All rights reserved.