InitializableRule
public class PluginCreateRule extends Rule implements InitializableRule
Modifier and Type | Field | Description |
---|---|---|
private java.lang.Class |
baseClass |
A base class that any plugin must derive from.
|
private Declaration |
defaultPlugin |
Info about optional default plugin to be used if no plugin-id is
specified in the input data.
|
private PluginConfigurationException |
initException |
Currently, none of the Rules methods allow exceptions to be thrown.
|
private java.lang.String |
pattern |
In order to invoke the addRules method on the plugin class correctly,
we need to know the pattern which this rule is matched by.
|
private java.lang.String |
pluginClassAttr |
|
private java.lang.String |
pluginClassAttrNs |
|
private java.lang.String |
pluginIdAttr |
|
private java.lang.String |
pluginIdAttrNs |
digester, namespaceURI
Constructor | Description |
---|---|
PluginCreateRule(java.lang.Class baseClass) |
Create a plugin rule where the user must specify a plugin-class
or plugin-id.
|
PluginCreateRule(java.lang.Class baseClass,
java.lang.Class dfltPluginClass) |
Create a plugin rule where the user may specify a plugin.
|
PluginCreateRule(java.lang.Class baseClass,
java.lang.Class dfltPluginClass,
RuleLoader dfltPluginRuleLoader) |
Create a plugin rule where the user may specify a plugin.
|
Modifier and Type | Method | Description |
---|---|---|
void |
begin(java.lang.String namespace,
java.lang.String name,
org.xml.sax.Attributes attributes) |
Invoked when the Digester matches this rule against an xml element.
|
void |
body(java.lang.String namespace,
java.lang.String name,
java.lang.String text) |
Process the body text of this element.
|
void |
end(java.lang.String namespace,
java.lang.String name) |
Invoked by the digester when the closing tag matching this Rule's
pattern is encountered.
|
void |
fireBeginMethods(java.util.List rules,
java.lang.String namespace,
java.lang.String name,
org.xml.sax.Attributes list) |
Duplicate the processing that the Digester does when firing the
begin methods of rules.
|
private void |
fireBodyMethods(java.util.List rules,
java.lang.String namespaceURI,
java.lang.String name,
java.lang.String text) |
Duplicate the processing that the Digester does when firing the
body methods of rules.
|
void |
fireEndMethods(java.util.List rules,
java.lang.String namespaceURI,
java.lang.String name) |
Duplicate the processing that the Digester does when firing the
end methods of rules.
|
java.lang.String |
getPattern() |
Return the pattern that this Rule is associated with.
|
void |
postRegisterInit(java.lang.String matchPattern) |
Invoked after this rule has been added to the set of digester rules,
associated with the specified pattern.
|
void |
setPluginClassAttribute(java.lang.String namespaceUri,
java.lang.String attrName) |
Sets the xml attribute which the input xml uses to indicate to a
PluginCreateRule which class should be instantiated.
|
void |
setPluginIdAttribute(java.lang.String namespaceUri,
java.lang.String attrName) |
Sets the xml attribute which the input xml uses to indicate to a
PluginCreateRule which plugin declaration is being referenced.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
begin, body, end, finish, getDigester, getNamespaceURI, setDigester, setNamespaceURI
private java.lang.String pluginClassAttrNs
private java.lang.String pluginClassAttr
private java.lang.String pluginIdAttrNs
private java.lang.String pluginIdAttr
private java.lang.String pattern
private java.lang.Class baseClass
private Declaration defaultPlugin
private PluginConfigurationException initException
public PluginCreateRule(java.lang.Class baseClass)
baseClass
- is the class which any specified plugin must be
descended from.public PluginCreateRule(java.lang.Class baseClass, java.lang.Class dfltPluginClass)
baseClass
- is the class which any specified plugin must be
descended from.dfltPluginClass
- is the class which will be used if the user
doesn't specify any plugin-class or plugin-id. This class will have
custom rules installed for it just like a declared plugin.public PluginCreateRule(java.lang.Class baseClass, java.lang.Class dfltPluginClass, RuleLoader dfltPluginRuleLoader)
baseClass
- is the class which any specified plugin must be
descended from.dfltPluginClass
- is the class which will be used if the user
doesn't specify any plugin-class or plugin-id. This class will have
custom rules installed for it just like a declared plugin.dfltPluginRuleLoader
- is a RuleLoader instance which knows how
to load the custom rules associated with this default plugin.public void setPluginClassAttribute(java.lang.String namespaceUri, java.lang.String attrName)
See PluginRules.setPluginClassAttribute(java.lang.String, java.lang.String)
for more info.
public void setPluginIdAttribute(java.lang.String namespaceUri, java.lang.String attrName)
See PluginRules.setPluginIdAttribute(java.lang.String, java.lang.String)
for more info.
public void postRegisterInit(java.lang.String matchPattern) throws PluginConfigurationException
postRegisterInit
in interface InitializableRule
matchPattern
- is the digester match pattern that is associated
with this rule instance, eg "root/widget".PluginConfigurationException
public void begin(java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes attributes) throws java.lang.Exception
A new instance of the target class is created, and pushed onto the stack. A new "private" PluginRules object is then created and set as the digester's default Rules object. Any custom rules associated with the plugin class are then loaded into that new Rules object. Finally, any custom rules that are associated with the current pattern (such as SetPropertiesRules) have their begin methods executed.
begin
in class Rule
namespace
- name
- attributes
- java.lang.ClassNotFoundException
PluginInvalidInputException
PluginConfigurationException
java.lang.Exception
public void body(java.lang.String namespace, java.lang.String name, java.lang.String text) throws java.lang.Exception
body
in class Rule
text
- The body text of this elementnamespace
- the namespace URI of the matching element, or an
empty string if the parser is not namespace aware or the element has
no namespacename
- the local name if the parser is namespace aware, or just
the element name otherwisejava.lang.Exception
public void end(java.lang.String namespace, java.lang.String name) throws java.lang.Exception
end
in class Rule
namespace
- Description of the Parametername
- Description of the Parameterjava.lang.Exception
- Description of the Exceptionbegin(java.lang.String, java.lang.String, org.xml.sax.Attributes)
public java.lang.String getPattern()
In general, Rule instances can be associated with multiple patterns. A PluginCreateRule, however, will only function correctly when associated with a single pattern. It is possible to fix this, but I can't be bothered just now because this feature is unlikely to be used.
public void fireBeginMethods(java.util.List rules, java.lang.String namespace, java.lang.String name, org.xml.sax.Attributes list) throws java.lang.Exception
java.lang.Exception
private void fireBodyMethods(java.util.List rules, java.lang.String namespaceURI, java.lang.String name, java.lang.String text) throws java.lang.Exception
java.lang.Exception
public void fireEndMethods(java.util.List rules, java.lang.String namespaceURI, java.lang.String name) throws java.lang.Exception
java.lang.Exception
Copyright 2001-2005 The Apache Software Foundation.