ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1734172 - in /webservices/axiom/trunk/aspects: core-aspects/src/main/java/org/apache/axiom/core/ core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/ om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/ om-aspects/src/...
Date Tue, 08 Mar 2016 22:06:52 GMT
Author: veithen
Date: Tue Mar  8 22:06:52 2016
New Revision: 1734172

URL: http://svn.apache.org/viewvc?rev=1734172&view=rev
Log:
Remove the old discard code.

Modified:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Builder.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Builder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Builder.java?rev=1734172&r1=1734171&r2=1734172&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Builder.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Builder.java
Tue Mar  8 22:06:52 2016
@@ -23,6 +23,4 @@ public interface Builder {
     boolean isCompleted();
     void close();
     boolean isClosed();
-
-    void discard(CoreParentNode container);
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj?rev=1734172&r1=1734171&r2=1734172&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreChildNodeSupport.aj
Tue Mar  8 22:06:52 2016
@@ -117,16 +117,18 @@ public aspect CoreChildNodeSupport {
         CoreChildNode nextSibling = coreGetNextSiblingIfAvailable();
         if (nextSibling == null) {
             CoreParentNode parent = coreGetParent();
-            if (parent != null && parent.coreGetBuilder() != null) {
+            if (parent != null) {
                 switch (parent.getState()) {
                     case CoreParentNode.DISCARDING:
                     case CoreParentNode.DISCARDED:
                         throw new NodeConsumedException();
                     case CoreParentNode.INCOMPLETE:
-                        do {
-                            parent.buildNext();
-                        } while (parent.getState() == CoreParentNode.INCOMPLETE
-                                && (nextSibling = coreGetNextSiblingIfAvailable())
== null);
+                        if (parent.coreGetBuilder() != null) {
+                            do {
+                                parent.buildNext();
+                            } while (parent.getState() == CoreParentNode.INCOMPLETE
+                                    && (nextSibling = coreGetNextSiblingIfAvailable())
== null);
+                        }
                 }
             }
         }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj?rev=1734172&r1=1734171&r2=1734172&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
Tue Mar  8 22:06:52 2016
@@ -227,6 +227,29 @@ public aspect CoreParentNodeSupport {
         fragmentContent.lastChild = null;
     }
 
+    public final void CoreParentNode.coreDiscard(boolean consumeInput) {
+        if (!isExpanded()) {
+            return;
+        }
+        CoreChildNode child = coreGetFirstChildIfAvailable();
+        while (child != null) {
+            if (child instanceof CoreParentNode) {
+                ((CoreParentNode)child).coreDiscard(consumeInput);
+            }
+            child = child.coreGetNextSiblingIfAvailable();
+        }
+        InputContext context = coreGetInputContext();
+        if (context != null) {
+            context.discard();
+            if (consumeInput) {
+                Builder builder = context.getBuilder();
+                do {
+                    builder.next();
+                } while (getState() != DISCARDED);
+            }
+        }
+    }
+
     public final void CoreParentNode.coreRemoveChildren(Semantics semantics) {
         if (getState() == COMPACT) {
             coreSetState(COMPLETE);
@@ -257,7 +280,6 @@ public aspect CoreParentNodeSupport {
             }
             content = null;
             if (updateState) {
-                // TODO: need to check that the builder will not modify the state to DISCARDED
later
                 coreSetState(COMPLETE);
             }
         }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java?rev=1734172&r1=1734171&r2=1734172&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Context.java
Tue Mar  8 22:06:52 2016
@@ -119,8 +119,12 @@ public final class Context implements In
             if (passThroughHandler != NullXmlHandler.INSTANCE) {
                 builderHandler.decrementActiveContextCount();
             }
+            // TODO: handle this in a better way
+            boolean updateState = target.getState() == CoreParentNode.DISCARDING;
             target.coreSetInputContext(null);
-            target.coreSetState(CoreParentNode.DISCARDED);
+            if (updateState) {
+                target.coreSetState(CoreParentNode.DISCARDED);
+            }
             passThroughHandler = null;
             target = null;
             return parentContext;

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushBuilder.java?rev=1734172&r1=1734171&r2=1734172&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PushBuilder.java
Tue Mar  8 22:06:52 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.axiom.om.impl.common.builder;
 
-import org.apache.axiom.core.CoreParentNode;
 import org.apache.axiom.core.NodeFactory;
 import org.apache.axiom.core.stream.StreamException;
 import org.apache.axiom.core.stream.XmlInput;
@@ -89,9 +88,4 @@ public final class PushBuilder extends A
     public final Object getReaderProperty(String name) throws IllegalArgumentException {
         return null;
     }
-
-    @Override
-    public final void discard(CoreParentNode container) {
-        throw new UnsupportedOperationException();
-    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java?rev=1734172&r1=1734171&r2=1734172&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
Tue Mar  8 22:06:52 2016
@@ -19,7 +19,6 @@
 
 package org.apache.axiom.om.impl.common.builder;
 
-import org.apache.axiom.core.CoreParentNode;
 import org.apache.axiom.core.NodeFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
@@ -27,7 +26,6 @@ import org.apache.axiom.om.ds.custombuil
 import org.apache.axiom.om.ds.custombuilder.CustomBuilderSupport;
 import org.apache.axiom.om.ds.custombuilder.CustomBuilder.Selector;
 import org.apache.axiom.om.impl.builder.Detachable;
-import org.apache.axiom.om.impl.intf.AxiomContainer;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.AxiomSourcedElement;
 
@@ -74,63 +72,6 @@ public class StAXOMBuilder extends Abstr
         this(nodeFactory, parser, true, null, null, PlainXMLModel.INSTANCE, element);
     }
     
-    private void discarded(CoreParentNode container) {
-        ((AxiomContainer)container).discarded();
-    }
-    
-    public final void discard(CoreParentNode container) {
-        int targetElementLevel = builderHandler.depth;
-        Context current = builderHandler.context;
-        while (current.target != container) {
-            targetElementLevel--;
-            current = current.parentContext;
-        }
-        if (targetElementLevel == 0 || targetElementLevel == 1 && builderHandler.document
== null) {
-            close();
-            current = builderHandler.context;
-            while (true) {
-                discarded(current.target);
-                if (current.target == container) {
-                    break;
-                }
-                current = current.parentContext;
-            }
-            return;
-        }
-        int skipDepth = 0;
-        loop: while (true) {
-            switch (helper.parserNext()) {
-                case XMLStreamReader.START_ELEMENT:
-                    skipDepth++;
-                    break;
-                case XMLStreamReader.END_ELEMENT:
-                    if (skipDepth > 0) {
-                        skipDepth--;
-                    } else {
-                        discarded(builderHandler.context.target);
-                        boolean found = container == builderHandler.context.target;
-                        builderHandler.context = builderHandler.context.parentContext;
-                        builderHandler.depth--;
-                        if (found) {
-                            break loop;
-                        }
-                    }
-                    break;
-                case XMLStreamReader.END_DOCUMENT:
-                    if (skipDepth != 0 || builderHandler.depth != 0) {
-                        throw new OMException("Unexpected END_DOCUMENT");
-                    }
-                    if (builderHandler.context.target != builderHandler.document) {
-                        throw new OMException("Called discard for an element that is not
being built by this builder");
-                    }
-                    discarded(builderHandler.context.target);
-                    builderHandler.context = null;
-                    builderHandler.done = true;
-                    break loop;
-            }
-        }
-    }
-
     public final String getNamespaceURI() {
         return helper.parser.getNamespaceURI();
     }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj?rev=1734172&r1=1734171&r2=1734172&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
Tue Mar  8 22:06:52 2016
@@ -244,9 +244,7 @@ public aspect AxiomElementSupport {
     }
 
     public final void AxiomElement.discard() {
-        if (getState() == CoreParentNode.INCOMPLETE && coreGetBuilder() != null)
{
-            coreGetBuilder().discard(this);
-        }
+        coreDiscard(true);
         detach();
     }
     



Mime
View raw message