skitching 2004/06/10 20:47:25
Modified: digester/src/java/org/apache/commons/digester/plugins
PluginCreateRule.java
Log:
PluginRules constructor now has an extra param: the class being plugged in.
Rearranged code order so this param is available at the necessary time.
Revision Changes Path
1.20 +24 -23
jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java
Index: PluginCreateRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/digester/src/java/org/apache/commons/digester/plugins/PluginCreateRule.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- PluginCreateRule.java 10 May 2004 06:44:13 -0000 1.19
+++ PluginCreateRule.java 11 Jun 2004 03:47:25 -0000 1.20
@@ -319,27 +319,11 @@
throw initException;
}
- String path = digester.getMatch();
-
- // create a new Rules object and effectively push it onto a stack of
- // rules objects. The stack is actually a linked list; using the
- // PluginRules constructor below causes the new instance to link
- // to the previous head-of-stack, then the Digester.setRules() makes
- // the new instance the new head-of-stack.
- PluginRules oldRules = (PluginRules) digester.getRules();
- PluginRules newRules = new PluginRules(path, oldRules);
- digester.setRules(newRules);
-
// load any custom rules associated with the plugin
- PluginManager pluginManager = newRules.getPluginManager();
+ PluginRules oldRules = (PluginRules) digester.getRules();
+ PluginManager pluginManager = oldRules.getPluginManager();
Declaration currDeclaration = null;
- if (debug) {
- log.debug("PluginCreateRule.begin: installing new plugin: " +
- "oldrules=" + oldRules.toString() +
- ", newrules=" + newRules.toString());
- }
-
String pluginClassName;
if (pluginClassAttrNs == null) {
// Yep, this is ugly.
@@ -398,12 +382,29 @@
pattern);
}
- // now load up the custom rules
- currDeclaration.configure(digester, pattern);
-
- // and now create an instance of the plugin class
+ // get the class of the user plugged-in type
Class pluginClass = currDeclaration.getPluginClass();
+ String path = digester.getMatch();
+
+ // create a new Rules object and effectively push it onto a stack of
+ // rules objects. The stack is actually a linked list; using the
+ // PluginRules constructor below causes the new instance to link
+ // to the previous head-of-stack, then the Digester.setRules() makes
+ // the new instance the new head-of-stack.
+ PluginRules newRules = new PluginRules(path, oldRules, pluginClass);
+ digester.setRules(newRules);
+
+ if (debug) {
+ log.debug("PluginCreateRule.begin: installing new plugin: " +
+ "oldrules=" + oldRules.toString() +
+ ", newrules=" + newRules.toString());
+ }
+
+ // load up the custom rules
+ currDeclaration.configure(digester, pattern);
+
+ // create an instance of the plugin class
Object instance = pluginClass.newInstance();
getDigester().push(instance);
if (debug) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]