| java.lang.Object org.apache.commons.digester.plugins.PluginContext
PluginContext | public class PluginContext (Code) | | Provides data and services which should exist only once per digester.
This class holds a number of useful items which should be shared by all
plugin objects. Such data cannot be stored on the PluginRules or
PluginManager classes, as there can be multiple instances of these at
various times during a parse.
The name "Context" refers to the similarity between this class and a
ServletContext class in a servlet engine. A ServletContext object provides
access to the container's services such as obtaining global configuration
parameters for the container, or getting access to logging services. For
plugins, a Digester instance can be regarded as "the container".
since: 1.6 |
Method Summary | |
public String | getPluginClassAttr() Get the namespace for the xml attribute which indicates to a
PluginCreateRule which class is to be plugged in. | public String | getPluginClassAttrNs() Get the namespace for the xml attribute which indicates to a
PluginCreateRule which class is to be plugged in. | public String | getPluginIdAttr() Get the namespace for the xml attribute which indicates to a
PluginCreateRule which previous plugin declaration should be used. | public String | getPluginIdAttrNs() Get the namespace for the xml attribute which indicates to a
PluginCreateRule which previous plugin declaration should be used. | public List | getRuleFinders() Return the list of RuleFinder objects. | public void | setPluginClassAttribute(String namespaceUri, String attrName) Sets the xml attribute which the input xml uses to indicate to a
PluginCreateRule which class should be instantiated.
Example:
setPluginClassAttribute(null, "class");
will allow this in the input xml:
<root>
<some-plugin class="com.acme.widget"> ......
instead of the default syntax:
<root>
<some-plugin plugin-class="com.acme.widget"> ......
This is particularly useful if the input xml document is not in
English.
Note that the xml attributes used by PluginDeclarationRules are not
affected by this method.
Parameters: namespaceUri - is the namespace uri that the specified attributeis in. | public void | setPluginIdAttribute(String namespaceUri, String attrName) Sets the xml attribute which the input xml uses to indicate to a
PluginCreateRule which plugin declaration is being referenced.
Example:
setPluginIdAttribute(null, "id");
will allow this in the input xml:
<root>
<some-plugin id="widget"> ......
rather than the default behaviour:
<root>
<some-plugin plugin-id="widget"> ......
This is particularly useful if the input xml document is not in
English.
Note that the xml attributes used by PluginDeclarationRules are not
affected by this method.
Parameters: namespaceUri - is the namespace uri that the specified attributeis in. | public void | setRuleFinders(List ruleFinders) Set the list of RuleFinder objects. |
DFLT_PLUGIN_CLASS_ATTR | final public String DFLT_PLUGIN_CLASS_ATTR(Code) | | |
DFLT_PLUGIN_CLASS_ATTR_NS | final public String DFLT_PLUGIN_CLASS_ATTR_NS(Code) | | |
DFLT_PLUGIN_ID_ATTR | final public String DFLT_PLUGIN_ID_ATTR(Code) | | |
DFLT_PLUGIN_ID_ATTR_NS | final public String DFLT_PLUGIN_ID_ATTR_NS(Code) | | |
PluginContext | public PluginContext()(Code) | | |
getPluginClassAttr | public String getPluginClassAttr()(Code) | | Get the namespace for the xml attribute which indicates to a
PluginCreateRule which class is to be plugged in.
The return value is never null.
|
getPluginClassAttrNs | public String getPluginClassAttrNs()(Code) | | Get the namespace for the xml attribute which indicates to a
PluginCreateRule which class is to be plugged in.
May be null (in fact, normally will be).
|
getPluginIdAttr | public String getPluginIdAttr()(Code) | | Get the namespace for the xml attribute which indicates to a
PluginCreateRule which previous plugin declaration should be used.
The return value is never null.
|
getPluginIdAttrNs | public String getPluginIdAttrNs()(Code) | | Get the namespace for the xml attribute which indicates to a
PluginCreateRule which previous plugin declaration should be used.
May be null (in fact, normally will be).
|
getRuleFinders | public List getRuleFinders()(Code) | | Return the list of RuleFinder objects. Under normal circumstances
this method creates a default list of these objects when first called
(ie "on-demand" or "lazy initialization"). However if setRuleFinders
has been called first, then the list specified there is returned.
It is explicitly permitted for the caller to modify this list
by inserting or removing RuleFinder objects.
|
setPluginClassAttribute | public void setPluginClassAttribute(String namespaceUri, String attrName)(Code) | | Sets the xml attribute which the input xml uses to indicate to a
PluginCreateRule which class should be instantiated.
Example:
setPluginClassAttribute(null, "class");
will allow this in the input xml:
<root>
<some-plugin class="com.acme.widget"> ......
instead of the default syntax:
<root>
<some-plugin plugin-class="com.acme.widget"> ......
This is particularly useful if the input xml document is not in
English.
Note that the xml attributes used by PluginDeclarationRules are not
affected by this method.
Parameters: namespaceUri - is the namespace uri that the specified attributeis in. If the attribute is in no namespace, then this should be null.Note that if a namespace is used, the attrName value should notcontain any kind of namespace-prefix. Note also that if you are usinga non-namespace-aware parser, this parameter must be null. Parameters: attrName - is the attribute whose value contains the name of theclass to be instantiated. |
setPluginIdAttribute | public void setPluginIdAttribute(String namespaceUri, String attrName)(Code) | | Sets the xml attribute which the input xml uses to indicate to a
PluginCreateRule which plugin declaration is being referenced.
Example:
setPluginIdAttribute(null, "id");
will allow this in the input xml:
<root>
<some-plugin id="widget"> ......
rather than the default behaviour:
<root>
<some-plugin plugin-id="widget"> ......
This is particularly useful if the input xml document is not in
English.
Note that the xml attributes used by PluginDeclarationRules are not
affected by this method.
Parameters: namespaceUri - is the namespace uri that the specified attributeis in. If the attribute is in no namespace, then this should be null.Note that if a namespace is used, the attrName value should notcontain any kind of namespace-prefix. Note also that if you are usinga non-namespace-aware parser, this parameter must be null. Parameters: attrName - is the attribute whose value contains the id of theplugin declaration to be used when instantiating an object. |
setRuleFinders | public void setRuleFinders(List ruleFinders)(Code) | | Set the list of RuleFinder objects. This may be useful if working
in a non-english language, allowing the application developer to
replace the standard list with a list of objects which look for xml
attributes in the local language.
If the intent is just to add an additional rule-finding algorithm, then
it may be better to call #getRuleFinders, and insert a new object into
the start of the list.
|
|
|