You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2005/02/20 01:45:03 UTC

svn commit: r154461 - in jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2: AbstractRuleManager.java DefaultRuleManager.java RuleManager.java

Author: skitching
Date: Sat Feb 19 16:45:02 2005
New Revision: 154461

URL: http://svn.apache.org/viewcvs?view=rev&rev=154461
Log:
startParse and finishParse methods on the RuleManager are now required to
invoke the startParse/finishParse methods on the contained Actions. This
was formerly done by the SAXHandler class, but is tidier here.

Modified:
    jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/AbstractRuleManager.java
    jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/DefaultRuleManager.java
    jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/RuleManager.java

Modified: jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/AbstractRuleManager.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/AbstractRuleManager.java?view=diff&r1=154460&r2=154461
==============================================================================
--- jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/AbstractRuleManager.java (original)
+++ jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/AbstractRuleManager.java Sat Feb 19 16:45:02 2005
@@ -44,6 +44,9 @@
     /**
      * Invoked before parsing each input document, this method gives the
      * RuleManager the opportunity to do per-parse initialisation if required.
+     * <p>
+     * This method must call the startParse method on each action that has
+     * been added to this rulemanager, in the order that they were added. 
      */
     public void startParse(Context context) throws DigestionException {}
 
@@ -51,6 +54,9 @@
      * Invoked after parsing each input document, this method gives the
      * RuleManager and the managed Action objects the opportunity to do
      * per-parse cleanup if required.
+     * <p>
+     * This method must call the finishParse method on each action that has
+     * been added to this rulemanager, in the order that they were added. 
      */
      public void finishParse(Context context) throws DigestionException {}
 

Modified: jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/DefaultRuleManager.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/DefaultRuleManager.java?view=diff&r1=154460&r2=154461
==============================================================================
--- jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/DefaultRuleManager.java (original)
+++ jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/DefaultRuleManager.java Sat Feb 19 16:45:02 2005
@@ -137,6 +137,9 @@
     /**
      * This method is called at the start of parsing a new input document.
      * <p>
+     * The startParse method is called on each action that has been added
+     * to this rulemanager, in the order that they were added. 
+     * <p>
      * TODO: build a mapping from element-name to "list of patterns ending
      * in that element name". When we have to do leading-wildcard-matching,
      * therefore, we can omit all the patterns that don't match the last
@@ -144,16 +147,28 @@
      * list of patterns. And we only need to compute this first time, or if
      * new rules have been added in the meantime.
      */
-    public void startParse(Context context) {
+    public void startParse(Context context) throws DigestionException {
+        for(Iterator i = actions.iterator(); i.hasNext(); ) {
+            Action action = (Action) i.next();
+            action.startParse(context);
+        }
     }
 
     /**
      * This method is called after parsing of a new input document has completed.
      * <p>
+     * The finishParse method is called on each action that has been added
+     * to this rulemanager, in reverse of the order that they were added. 
+     * <p>
      * Note that if an error has occurred during parsing, then this method
      * might not be called.
      */
-    public void finishParse(Context context) {
+    public void finishParse(Context context) throws DigestionException {
+        // Fire "finish" events for all defined actions
+        for(int i = actions.size()-1; i>=0; --i) {
+            Action action = (Action) actions.get(i);
+            action.finishParse(context);
+        }
     }
 
     /**

Modified: jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/RuleManager.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/RuleManager.java?view=diff&r1=154460&r2=154461
==============================================================================
--- jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/RuleManager.java (original)
+++ jakarta/commons/proper/digester/branches/digester2/src/java/org/apache/commons/digester2/RuleManager.java Sat Feb 19 16:45:02 2005
@@ -58,12 +58,19 @@
     /**
      * Invoked before parsing each input document, this method gives the
      * RuleManager opportunity to do per-parse initialisation if required.
+     * <p>
+     * This method must call the startParse method on each action that has
+     * been added to this rulemanager, in the order that they were added. 
      */
     public void startParse(Context context) throws DigestionException;
 
     /**
      * Invoked after parsing each input document, this method gives the
      * RuleManager the opportunity to do per-parse cleanup if required.
+     * <p>
+     * This method must call the finishParse method on each action that has
+     * been added to this rulemanager, in reverse of the order that they were
+     * added. 
      */
      public void finishParse(Context context) throws DigestionException;
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org