commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1197978 - in /commons/proper/digester/trunk: ./ src/changes/ src/main/java/org/apache/commons/digester3/xmlrules/
Date Sat, 05 Nov 2011 16:07:12 GMT
Author: simonetripodi
Date: Sat Nov  5 16:07:12 2011
New Revision: 1197978

URL: http://svn.apache.org/viewvc?rev=1197978&view=rev
Log:
[DIGESTER-157] Improve Set(Nested)PropertiesRuleAlias performances in the XML ruleset while
binding rules

Modified:
    commons/proper/digester/trunk/RELEASE-NOTES.txt
    commons/proper/digester/trunk/src/changes/changes.xml
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesAliasRule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesIgnoreRule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesRule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesAliasRule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesIgnoreRule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesRule.java
    commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java

Modified: commons/proper/digester/trunk/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/RELEASE-NOTES.txt?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/RELEASE-NOTES.txt (original)
+++ commons/proper/digester/trunk/RELEASE-NOTES.txt Sat Nov  5 16:07:12 2011
@@ -60,6 +60,7 @@ BUGS FIXED SINCE PREVIOUS RELEASE
 IMPROVEMENTS OVER PREVIOUS RELEASE
 ===================================
 
+ * [DIGESTER-157] Improve Set(Nested)PropertiesRuleAlias performances in the XML ruleset
while binding rules
  * [DIGESTER-156] Make (Nested|Set)PropertiesBuilder#addAlias() fluent.
  * [DIGESTER-152] The DigesterLoader doesn't allow binding a default Locator
  * [DIGESTER-151] The DigesterLoader doesn't allow binding a default ErrorHandler.

Modified: commons/proper/digester/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/changes/changes.xml?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/changes/changes.xml (original)
+++ commons/proper/digester/trunk/src/changes/changes.xml Sat Nov  5 16:07:12 2011
@@ -23,6 +23,9 @@
   </properties>
   <body>
   <release version="3.2" date="201?-??-??" description="Maintenance release.">
+    <action dev="simonetripodi" type="fix" issue="DIGESTER-157">
+      Improve Set(Nested)PropertiesRuleAlias performances in the XML ruleset while binding
rules.
+    </action>
     <action dev="simonetripodi" type="fix" issue="DIGESTER-156">
       Make (Nested|Set)PropertiesBuilder#addAlias() fluent.
     </action>

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesAliasRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesAliasRule.java?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesAliasRule.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesAliasRule.java
Sat Nov  5 16:07:12 2011
@@ -19,33 +19,29 @@ package org.apache.commons.digester3.xml
  * under the License.
  */
 
-import org.apache.commons.digester3.binder.LinkedRuleBuilder;
-import org.apache.commons.digester3.binder.RulesBinder;
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.binder.NestedPropertiesBuilder;
 import org.xml.sax.Attributes;
 
 /**
  *
  */
 final class SetNestedPropertiesAliasRule
-    extends AbstractXmlRule
+    extends Rule
 {
 
-    public SetNestedPropertiesAliasRule( RulesBinder targetRulesBinder, PatternStack patternStack
)
-    {
-        super( targetRulesBinder, patternStack );
-    }
-
     /**
      * {@inheritDoc}
      */
     @Override
-    protected void bindRule( LinkedRuleBuilder linkedRuleBuilder, Attributes attributes )
+    public void begin( String namespace, String name, Attributes attributes )
         throws Exception
     {
         String elementName = attributes.getValue( "attr-name" );
         String propertyName = attributes.getValue( "prop-name" );
 
-        linkedRuleBuilder.setNestedProperties().addAlias( elementName ).forProperty( propertyName
);
+        NestedPropertiesBuilder builder = getDigester().peek();
+        builder.addAlias( elementName ).forProperty( propertyName );
     }
 
 }

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesIgnoreRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesIgnoreRule.java?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesIgnoreRule.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesIgnoreRule.java
Sat Nov  5 16:07:12 2011
@@ -19,32 +19,28 @@ package org.apache.commons.digester3.xml
  * under the License.
  */
 
-import org.apache.commons.digester3.binder.LinkedRuleBuilder;
-import org.apache.commons.digester3.binder.RulesBinder;
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.binder.NestedPropertiesBuilder;
 import org.xml.sax.Attributes;
 
 /**
- * 
+ *
  */
 final class SetNestedPropertiesIgnoreRule
-    extends AbstractXmlRule
+    extends Rule
 {
 
-    public SetNestedPropertiesIgnoreRule( RulesBinder targetRulesBinder, PatternStack patternStack
)
-    {
-        super( targetRulesBinder, patternStack );
-    }
-
     /**
      * {@inheritDoc}
      */
     @Override
-    protected void bindRule( LinkedRuleBuilder linkedRuleBuilder, Attributes attributes )
+    public void begin( String namespace, String name, Attributes attributes )
         throws Exception
     {
         String elementName = attributes.getValue( "elem-name" );
 
-        linkedRuleBuilder.setNestedProperties().ignoreElement( elementName );
+        NestedPropertiesBuilder builder = getDigester().peek();
+        builder.ignoreElement( elementName );
     }
 
 }

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesRule.java?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesRule.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetNestedPropertiesRule.java
Sat Nov  5 16:07:12 2011
@@ -20,11 +20,12 @@ package org.apache.commons.digester3.xml
  */
 
 import org.apache.commons.digester3.binder.LinkedRuleBuilder;
+import org.apache.commons.digester3.binder.NestedPropertiesBuilder;
 import org.apache.commons.digester3.binder.RulesBinder;
 import org.xml.sax.Attributes;
 
 /**
- * 
+ *
  */
 final class SetNestedPropertiesRule
     extends AbstractXmlRule
@@ -44,7 +45,20 @@ final class SetNestedPropertiesRule
     {
         boolean allowUnknownChildElements =
             "true".equalsIgnoreCase( attributes.getValue( "allow-unknown-child-elements"
) );
-        linkedRuleBuilder.setNestedProperties().allowUnknownChildElements( allowUnknownChildElements
);
+        NestedPropertiesBuilder builder = linkedRuleBuilder
+                                            .setNestedProperties()
+                                            .allowUnknownChildElements( allowUnknownChildElements
);
+        getDigester().push( builder );
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void end( String namespace, String name )
+        throws Exception
+    {
+        getDigester().pop();
     }
 
 }

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesAliasRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesAliasRule.java?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesAliasRule.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesAliasRule.java
Sat Nov  5 16:07:12 2011
@@ -19,33 +19,29 @@ package org.apache.commons.digester3.xml
  * under the License.
  */
 
-import org.apache.commons.digester3.binder.LinkedRuleBuilder;
-import org.apache.commons.digester3.binder.RulesBinder;
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.binder.SetPropertiesBuilder;
 import org.xml.sax.Attributes;
 
 /**
  *
  */
 final class SetPropertiesAliasRule
-    extends AbstractXmlRule
+    extends Rule
 {
 
-    public SetPropertiesAliasRule( RulesBinder targetRulesBinder, PatternStack patternStack
)
-    {
-        super( targetRulesBinder, patternStack );
-    }
-
     /**
      * {@inheritDoc}
      */
     @Override
-    protected void bindRule( LinkedRuleBuilder linkedRuleBuilder, Attributes attributes )
+    public void begin( String namespace, String name, Attributes attributes )
         throws Exception
     {
         String attributeName = attributes.getValue( "attr-name" );
         String propertyName = attributes.getValue( "prop-name" );
 
-        linkedRuleBuilder.setProperties().addAlias( attributeName ).forProperty( propertyName
);
+        SetPropertiesBuilder builder = getDigester().peek();
+        builder.addAlias( attributeName ).forProperty( propertyName );
     }
 
 }

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesIgnoreRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesIgnoreRule.java?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesIgnoreRule.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesIgnoreRule.java
Sat Nov  5 16:07:12 2011
@@ -19,32 +19,27 @@ package org.apache.commons.digester3.xml
  * under the License.
  */
 
-import org.apache.commons.digester3.binder.LinkedRuleBuilder;
-import org.apache.commons.digester3.binder.RulesBinder;
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.binder.SetPropertiesBuilder;
 import org.xml.sax.Attributes;
 
 /**
- * 
+ *
  */
 final class SetPropertiesIgnoreRule
-    extends AbstractXmlRule
+    extends Rule
 {
 
-    public SetPropertiesIgnoreRule( RulesBinder targetRulesBinder, PatternStack patternStack
)
-    {
-        super( targetRulesBinder, patternStack );
-    }
-
     /**
      * {@inheritDoc}
      */
-    @Override
-    protected void bindRule( LinkedRuleBuilder linkedRuleBuilder, Attributes attributes )
+    public void begin(String namespace, String name, Attributes attributes)
         throws Exception
     {
         String attributeName = attributes.getValue( "attr-name" );
 
-        linkedRuleBuilder.setProperties().ignoreAttribute( attributeName );
+        SetPropertiesBuilder builder = getDigester().peek();
+        builder.ignoreAttribute( attributeName );
     }
 
 }

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesRule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesRule.java?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesRule.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/SetPropertiesRule.java
Sat Nov  5 16:07:12 2011
@@ -21,10 +21,11 @@ package org.apache.commons.digester3.xml
 
 import org.apache.commons.digester3.binder.LinkedRuleBuilder;
 import org.apache.commons.digester3.binder.RulesBinder;
+import org.apache.commons.digester3.binder.SetPropertiesBuilder;
 import org.xml.sax.Attributes;
 
 /**
- * 
+ *
  */
 final class SetPropertiesRule
     extends AbstractXmlRule
@@ -43,7 +44,19 @@ final class SetPropertiesRule
         throws Exception
     {
         boolean ignoreMissingProperty = "true".equalsIgnoreCase( attributes.getValue( "ignore-missing-property"
) );
-        linkedRuleBuilder.setProperties().ignoreMissingProperty( ignoreMissingProperty );
+
+        SetPropertiesBuilder builder = linkedRuleBuilder.setProperties().ignoreMissingProperty(
ignoreMissingProperty );
+        getDigester().push( builder );
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void end( String namespace, String name )
+        throws Exception
+    {
+        getDigester().pop();
     }
 
 }

Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java?rev=1197978&r1=1197977&r2=1197978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java
(original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/xmlrules/XmlRulesModule.java
Sat Nov  5 16:07:12 2011
@@ -94,18 +94,18 @@ final class XmlRulesModule
 
             forPattern( "*/set-properties-rule" ).addRule( new SetPropertiesRule( targetRulesBinder,
patternStack ) );
             forPattern( "*/set-properties-rule/alias" )
-                .addRule( new SetPropertiesAliasRule( targetRulesBinder, patternStack ) );
+                .addRule( new SetPropertiesAliasRule() );
             forPattern( "*/set-properties-rule/ignore" )
-                .addRule( new SetPropertiesIgnoreRule( targetRulesBinder, patternStack )
);
+                .addRule( new SetPropertiesIgnoreRule() );
 
             forPattern( "*/set-property-rule" ).addRule( new SetPropertyRule( targetRulesBinder,
patternStack ) );
 
             forPattern( "*/set-nested-properties-rule" )
                 .addRule( new SetNestedPropertiesRule( targetRulesBinder, patternStack )
);
             forPattern( "*/set-nested-properties-rule/alias" )
-                .addRule( new SetNestedPropertiesAliasRule( targetRulesBinder, patternStack
) );
+                .addRule( new SetNestedPropertiesAliasRule() );
             forPattern( "*/set-nested-properties-rule/ignore" )
-                .addRule( new SetPropertiesIgnoreRule( targetRulesBinder, patternStack )
);
+                .addRule( new SetNestedPropertiesIgnoreRule() );
 
             forPattern( "*/set-top-rule" ).addRule( new SetTopRule( targetRulesBinder, patternStack
) );
             forPattern( "*/set-next-rule" ).addRule( new SetNextRule( targetRulesBinder,
patternStack ) );



Mime
View raw message