ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1608290 - in /webservices/axiom/trunk/modules: axiom-api/src/main/java/org/apache/axiom/om/impl/ axiom-api/src/main/java/org/apache/axiom/om/impl/builder/ axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/ axiom-dom/src/main/...
Date Sun, 06 Jul 2014 20:28:08 GMT
Author: veithen
Date: Sun Jul  6 20:28:07 2014
New Revision: 1608290

URL: http://svn.apache.org/r1608290
Log:
Reduce the coupling between the builder and the OM implementation.

Modified:
    webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java
    webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java
    webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/INode.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java

Modified: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java
(original)
+++ webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMElementEx.java
Sun Jul  6 20:28:07 2014
@@ -41,4 +41,6 @@ public interface OMElementEx extends OME
      * @return the created namespace information item
      */
     OMNamespace addNamespaceDeclaration(String uri, String prefix);
+    
+    void detachAndDiscardParent();
 }

Modified: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java
(original)
+++ webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/OMNodeEx.java
Sun Jul  6 20:28:07 2014
@@ -19,7 +19,6 @@
 
 package org.apache.axiom.om.impl;
 
-import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMNode;
 
 /**
@@ -27,12 +26,6 @@ import org.apache.axiom.om.OMNode;
  * public API.
  */
 public interface OMNodeEx extends OMNode {
-    public void setNextOMSibling(OMNode node);
-
-    public void setPreviousOMSibling(OMNode previousSibling);
-
-    public void setParent(OMContainer element);
-
     public void setComplete(boolean state);
 
     /**

Modified: webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
Sun Jul  6 20:28:07 2014
@@ -31,7 +31,6 @@ import org.apache.axiom.om.OMHierarchyEx
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMElementEx;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.util.stax.XMLEventUtils;
 import org.apache.commons.logging.Log;
@@ -572,10 +571,7 @@ public class StAXOMBuilder extends StAXB
     public OMElement getDocumentElement(boolean discardDocument) {
         OMElement element = getDocument().getOMDocumentElement();
         if (discardDocument) {
-            OMNodeEx nodeEx = (OMNodeEx)element;
-            nodeEx.setParent(null);
-            nodeEx.setPreviousOMSibling(null);
-            nodeEx.setNextOMSibling(null);
+            ((OMElementEx)element).detachAndDiscardParent();
             document = null;
         }
         return element;

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/INode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/INode.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/INode.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/INode.java
Sun Jul  6 20:28:07 2014
@@ -18,8 +18,14 @@
  */
 package org.apache.axiom.om.impl.common;
 
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.impl.OMNodeEx;
 
 public interface INode extends OMNodeEx, CoreChildNode {
+    public void setNextOMSibling(OMNode node);
 
+    public void setPreviousOMSibling(OMNode previousSibling);
+
+    public void setParent(OMContainer element);
 }

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMContainerSupport.aj
Sun Jul  6 20:28:07 2014
@@ -33,7 +33,6 @@ import org.apache.axiom.om.OMSourcedElem
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.OMXMLStreamReader;
 import org.apache.axiom.om.OMXMLStreamReaderConfiguration;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.builder.OMFactoryEx;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
@@ -92,18 +91,18 @@ public aspect OMContainerSupport {
     }
 
     public void IContainer.addChild(OMNode omNode, boolean fromBuilder) {
-        OMNodeEx child;
+        INode child;
         if (fromBuilder) {
             // If the new child was provided by the builder, we know that it was created
by
             // the same factory
-            child = (OMNodeEx)omNode;
+            child = (INode)omNode;
         } else {
             // Careful here: if the child was created by another Axiom implementation, it
doesn't
-            // necessarily implement OMNodeEx
+            // necessarily implement INode
             if (omNode.getOMFactory().getMetaFactory().equals(getOMFactory().getMetaFactory()))
{
-                child = (OMNodeEx)omNode;
+                child = (INode)omNode;
             } else {
-                child = (OMNodeEx)((OMFactoryEx)getOMFactory()).importNode(omNode);
+                child = (INode)((OMFactoryEx)getOMFactory()).importNode(omNode);
             }
             if (!isComplete()) {
                 build();
@@ -126,7 +125,7 @@ public aspect OMContainerSupport {
         } else {
             OMNode lastChild = getLastKnownOMChild();
             child.setPreviousOMSibling(lastChild);
-            ((OMNodeEx)lastChild).setNextOMSibling(child);
+            ((INode)lastChild).setNextOMSibling(child);
         }
         setLastChild(child);
 
@@ -186,9 +185,9 @@ public aspect OMContainerSupport {
         CoreChildNode child = coreGetFirstChildIfAvailable();
         while (child != null) {
             CoreChildNode nextSibling = (CoreChildNode)child.getNextOMSiblingIfAvailable();
-            child.setPreviousOMSibling(null);
-            child.setNextOMSibling(null);
-            child.setParent(null);
+            ((INode)child).setPreviousOMSibling(null);
+            ((INode)child).setNextOMSibling(null);
+            ((INode)child).setParent(null);
             child = nextSibling;
         }
         setFirstChild(null);

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/OMElementSupport.aj
Sun Jul  6 20:28:07 2014
@@ -37,6 +37,7 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.util.namespace.MapBasedNamespaceContext;
 import org.apache.axiom.util.stax.XMLStreamReaderUtils;
@@ -154,6 +155,12 @@ public aspect OMElementSupport {
         detach();
     }
     
+    public void IElement.detachAndDiscardParent() {
+        setParent(null);
+        setPreviousOMSibling(null);
+        setNextOMSibling(null);
+    }
+    
     public static void insertChild(OMElement parent, Class[] sequence, int pos, OMNode newChild)
{
         if (!sequence[pos].isInstance(newChild)) {
             throw new IllegalArgumentException();

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/NodeImpl.java
Sun Jul  6 20:28:07 2014
@@ -29,8 +29,8 @@ import org.apache.axiom.om.OMOutputForma
 import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.om.impl.common.INode;
 import org.apache.axiom.om.impl.common.InformationItem;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
 import org.apache.axiom.om.impl.common.serializer.push.Serializer;
@@ -599,7 +599,7 @@ public abstract class NodeImpl extends I
         if (sibling.getParent() != null) {
             sibling.detach();
         }
-        ((OMNodeEx) sibling).setParent((OMContainer)parentNode);
+        ((INode)sibling).setParent((OMContainer)parentNode);
         if (sibling instanceof NodeImpl) {
             NodeImpl domSibling = (NodeImpl) sibling;
             domSibling.internalSetPreviousSibling(this);

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
Sun Jul  6 20:28:07 2014
@@ -24,10 +24,10 @@ import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMSourcedElement;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.common.CoreChildNode;
 import org.apache.axiom.om.impl.common.IContainer;
 import org.apache.axiom.om.impl.common.CoreParentNode;
+import org.apache.axiom.om.impl.common.INode;
 import org.apache.axiom.om.impl.common.serializer.push.sax.XMLReaderImpl;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
@@ -65,7 +65,7 @@ public abstract class ParentNode extends
 
     public void setFirstChild(OMNode firstChild) {
         if (firstChild != null) {
-            ((OMNodeEx) firstChild).setParent((OMContainer)this);
+            ((INode)firstChild).setParent((OMContainer)this);
         }
         this.firstChild = (NodeImpl) firstChild;
     }

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMElementImpl.java
Sun Jul  6 20:28:07 2014
@@ -30,10 +30,10 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.common.CoreChildNode;
 import org.apache.axiom.om.impl.common.IContainer;
 import org.apache.axiom.om.impl.common.IElement;
+import org.apache.axiom.om.impl.common.INode;
 import org.apache.axiom.om.impl.common.NamespaceIterator;
 import org.apache.axiom.om.impl.common.OMChildElementIterator;
 import org.apache.axiom.om.impl.common.OMNamedInformationItemHelper;
@@ -526,7 +526,7 @@ public class OMElementImpl extends OMNod
     /** Method setFirstChild. */
     public void setFirstChild(OMNode firstChild) {
         if (firstChild != null) {
-            ((OMNodeEx) firstChild).setParent(this);
+            ((INode)firstChild).setParent(this);
         }
         this.firstChild = firstChild;
     }

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMNodeImpl.java
Sun Jul  6 20:28:07 2014
@@ -25,11 +25,11 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMInformationItem;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.builder.OMFactoryEx;
 import org.apache.axiom.om.impl.common.CoreChildNode;
 import org.apache.axiom.om.impl.common.IContainer;
 import org.apache.axiom.om.impl.common.CoreParentNode;
+import org.apache.axiom.om.impl.common.INode;
 import org.apache.axiom.om.impl.llom.factory.OMLinkedListImplFactory;
 
 /** Class OMNodeImpl */
@@ -122,7 +122,7 @@ public abstract class OMNodeImpl extends
         // Note that we don't need to force creation of the next sibling because the
         // builder will always add new nodes to the end of list of children of the
         // document or element being built.
-        OMNodeImpl nextSibling = (OMNodeImpl) getNextOMSiblingIfAvailable();
+        INode nextSibling = (INode)getNextOMSiblingIfAvailable();
         if (previousSibling == null) {
             parent.setFirstChild(nextSibling);
         } else {
@@ -155,7 +155,7 @@ public abstract class OMNodeImpl extends
         if (sibling.getParent() != null) {
             sibling.detach();
         }
-        ((OMNodeEx) sibling).setParent(parent);
+        ((INode)sibling).setParent(parent);
         if (sibling instanceof OMNodeImpl) {
             OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
             if (nextSibling == null) {
@@ -167,7 +167,7 @@ public abstract class OMNodeImpl extends
             } else {
                 nextSibling.setPreviousOMSibling(sibling);
             }
-            ((OMNodeEx) sibling).setNextOMSibling(nextSibling);
+            ((INode)sibling).setNextOMSibling(nextSibling);
             nextSibling = siblingImpl;
         }
     }

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java?rev=1608290&r1=1608289&r2=1608290&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMSourcedElementImpl.java
Sun Jul  6 20:28:07 2014
@@ -1143,4 +1143,8 @@ public class OMSourcedElementImpl extend
     public CoreChildNode coreGetFirstChildIfAvailable() {
         return super.coreGetFirstChildIfAvailable();
     }
+
+    public void detachAndDiscardParent() {
+        super.detachAndDiscardParent();
+    }
 }



Mime
View raw message