|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.struts.plugins.DigestingPlugIn
public class DigestingPlugIn
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
Field Summary | |
---|---|
protected String |
configPath
|
protected String |
configSource
|
protected String |
digesterPath
|
protected String |
digesterSource
|
protected String |
key
|
protected ModuleConfig |
moduleConfig
|
protected boolean |
push
|
protected String |
rulesets
|
protected ActionServlet |
servlet
|
protected static String |
SOURCE_CLASSPATH
|
protected static String |
SOURCE_FILE
|
protected static String |
SOURCE_SERVLET
|
Constructor Summary | |
---|---|
DigestingPlugIn()
Constructor for DigestingPlugIn. |
Method Summary | |
---|---|
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(String path,
String source)
Instantiate a Digester from an XML input stream using the Commons DigesterLoader . |
protected URL |
getClassPathURL(String path)
Given a string, return a URL to a classpath resource of that name. |
String |
getConfigPath()
|
String |
getConfigSource()
|
protected URL |
getConfigURL(String path,
String source)
Look up a resource path using one of a set of known path resolution mechanisms and return a URL to the resource. |
String |
getDigesterPath()
|
String |
getDigesterSource()
|
protected URL |
getFileURL(String path)
Given a string, return a URL to a Filesystem resource of that name. |
String |
getKey()
|
boolean |
getPush()
|
String |
getRulesets()
|
protected URL |
getServletContextURL(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(String configPath)
|
void |
setConfigSource(String configSource)
Set the source of the config file. |
void |
setDigesterPath(String digesterPath)
The path to a Digester XML configuration file, relative to the digesterSource property. |
void |
setDigesterSource(String digesterSource)
The lookup mechanism to be used to resolve digesterPath
(optional). |
void |
setKey(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(String ruleSets)
A comma-delimited list of one or more classes which implement org.apache.commons.digester.RuleSet . |
protected void |
storeGeneratedObject(Object obj)
This method is called after the Digester runs to store the generated object somewhere. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String SOURCE_CLASSPATH
protected static final String SOURCE_FILE
protected static final String SOURCE_SERVLET
protected String configPath
protected String configSource
protected String digesterPath
protected String digesterSource
protected String key
protected ModuleConfig moduleConfig
protected String rulesets
protected ActionServlet servlet
protected boolean push
Constructor Detail |
---|
public DigestingPlugIn()
Method Detail |
---|
public void destroy()
destroy
in interface PlugIn
public void init(ActionServlet servlet, ModuleConfig config) throws ServletException
Initialize a Digester
and use it to parse a
configuration file, resulting in a root object which will be placed
into the ServletContext.
init
in interface PlugIn
servlet
- ActionServlet that is managing all the modules in this
web applicationconfig
- ModuleConfig for the module with which this plug-in is
associated
ServletException
- if this PlugIn
cannot be
successfully initializedprotected org.apache.commons.digester.Digester initializeDigester() throws ServletException
Digester
which will be used to process the
main configuration.
ServletException
protected 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.Digester
protected org.apache.commons.digester.Digester digesterFromXml(String path, String source) throws 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
source
source
- a string indicating the lookup method to be used with
path
FileNotFoundException
MalformedURLException
IOException
getConfigURL(String, String)
protected void applyRuleSets(org.apache.commons.digester.Digester digester) throws 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.
ServletException
protected URL getConfigURL(String path, String source) throws 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:
FileNotFoundException
MalformedURLException
IOException
protected URL getClassPathURL(String path)
path
- a Classpath-relative string identifying a resource.
protected URL getServletContextURL(String path) throws IOException
path
- a Classpath-relative string identifying a resource.
MalformedURLException
IOException
protected URL getFileURL(String path) throws IOException
path
- a path to a file.
MalformedURLException
FileNotFoundException
IOException
public void setConfigPath(String configPath)
configPath
- the path to configuration information for this
PlugIn.configSource
public String getConfigPath()
configSource
public void setConfigSource(String configSource)
configSource
- the source (lookup method) for the config file.configPath
public String getConfigSource()
configPath
protected void storeGeneratedObject(Object obj)
key
.
obj
- The object to save.public void setKey(String key)
key
- The ServletContext attribute name to store the generated
object under.public String getKey()
public void setRulesets(String ruleSets)
A comma-delimited list of one or more classes which implement
org.apache.commons.digester.RuleSet
. (Optional)
public String getRulesets()
RuleSet
classes.public void setDigesterPath(String digesterPath)
The path to a Digester XML configuration file, relative to the
digesterSource
property. (Optional)
digesterSource
,
getConfigURL(String, String)
public String getDigesterPath()
digesterSource
,
getConfigURL(String, String)
public void setDigesterSource(String digesterSource)
The lookup mechanism to be used to resolve digesterPath
(optional).
digesterSource
- getConfigURL(String, String)
public 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |