ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1608309 - in /webservices/axiom/trunk/modules: axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/ axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/ axiom-impl/src/ma...
Date Sun, 06 Jul 2014 22:56:48 GMT
Author: veithen
Date: Sun Jul  6 22:56:47 2014
New Revision: 1608309

URL: http://svn.apache.org/r1608309
Log:
Unify the code in parent node implementations.

Modified:
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreChildNode.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNodeSupport.aj
    webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IContainer.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-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
    webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.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
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPElement.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
    webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreChildNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreChildNode.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreChildNode.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreChildNode.java
Sun Jul  6 22:56:47 2014
@@ -22,5 +22,6 @@ import org.apache.axiom.om.impl.OMNodeEx
 
 public interface CoreChildNode extends OMNodeEx, ISerializable {
     CoreParentNode coreGetParent();
+    void coreSetParent(CoreParentNode parent);
     CoreChildNode coreGetNextSiblingIfAvailable();
 }

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNode.java
Sun Jul  6 22:56:47 2014
@@ -19,7 +19,6 @@
 package org.apache.axiom.om.impl.common;
 
 import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.w3c.dom.Attr;
 import org.w3c.dom.DocumentFragment;
@@ -37,16 +36,4 @@ public interface CoreParentNode {
     OMXMLParserWrapper getBuilder();
     int getState();
     boolean isComplete();
-
-    /**
-     * Get the first child if it is available. The child is available if it is complete or
-     * if the builder has started building the node. In the latter case,
-     * {@link OMNode#isComplete()} may return <code>false</code> when called
on the child. 
-     * In contrast to {@link OMContainer#getFirstOMChild()}, this method will never modify
-     * the state of the underlying parser.
-     * 
-     * @return the first child or <code>null</code> if the container has no children
or
-     *         the builder has not yet started to build the first child
-     */
-    public CoreChildNode coreGetFirstChildIfAvailable();
 }

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNodeSupport.aj?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNodeSupport.aj
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/CoreParentNodeSupport.aj
Sun Jul  6 22:56:47 2014
@@ -19,12 +19,54 @@
 package org.apache.axiom.om.impl.common;
 
 import org.apache.axiom.om.NodeUnavailableException;
+import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 
 public aspect CoreParentNodeSupport {
+    private CoreChildNode CoreParentNode.firstChild;
+    private CoreChildNode CoreParentNode.lastChild;
+    
+    /**
+     * Get the first child if it is available. The child is available if it is complete or
+     * if the builder has started building the node. In the latter case,
+     * {@link OMNode#isComplete()} may return <code>false</code> when called
on the child. 
+     * In contrast to {@link OMContainer#getFirstOMChild()}, this method will never modify
+     * the state of the underlying parser.
+     * 
+     * @return the first child or <code>null</code> if the container has no children
or
+     *         the builder has not yet started to build the first child
+     */
+    public CoreChildNode CoreParentNode.coreGetFirstChildIfAvailable() {
+        return firstChild;
+    }
+
+    public CoreChildNode CoreParentNode.coreGetLastKnownChild() {
+        return lastChild;
+    }
+
+    /**
+     * forcefully set the first element in this parent element
+     * @param omNode
+     */
+    public void CoreParentNode.coreSetFirstChild(CoreChildNode firstChild) {
+        if (firstChild != null) {
+            firstChild.coreSetParent(this);
+        }
+        this.firstChild = firstChild;
+    }
+
+    /**
+     * forcefully set the last element in this parent element
+     * @param omNode
+     */
+    public void CoreParentNode.coreSetLastChild(CoreChildNode lastChild) {
+         this.lastChild = lastChild;
+    }
+
     public void CoreParentNode.buildNext() {
         OMXMLParserWrapper builder = getBuilder();
         if (builder == null) {

Modified: webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IContainer.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IContainer.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IContainer.java
(original)
+++ webservices/axiom/trunk/modules/axiom-common-impl/src/main/java/org/apache/axiom/om/impl/common/IContainer.java
Sun Jul  6 22:56:47 2014
@@ -32,18 +32,4 @@ public interface IContainer extends OMCo
      *             if the node is not allowed as a child of the container
      */
     void checkChild(OMNode child);
-    
-    /**
-     * forcefully set the first element in this parent element
-     * @param omNode
-     */
-    public void setFirstChild(OMNode omNode);
-
-    /**
-     * forcefully set the last element in this parent element
-     * @param omNode
-     */
-    public void setLastChild(OMNode omNode);
-    
-    OMNode getLastKnownOMChild();
 }

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=1608309&r1=1608308&r2=1608309&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 22:56:47 2014
@@ -18,7 +18,6 @@
  */
 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;
 
@@ -26,6 +25,4 @@ public interface INode extends OMNodeEx,
     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=1608309&r1=1608308&r2=1608309&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 22:56:47 2014
@@ -107,7 +107,7 @@ public aspect OMContainerSupport {
             if (!isComplete()) {
                 build();
             }
-            if (child.getParent() == this && child == getLastKnownOMChild()) {
+            if (child.getParent() == this && child == coreGetLastKnownChild()) {
                 // The child is already the last node. 
                 // We don't need to detach and re-add it.
                 return;
@@ -118,16 +118,16 @@ public aspect OMContainerSupport {
             child.detach();
         }
         
-        child.setParent(this);
+        child.coreSetParent(this);
 
         if (coreGetFirstChildIfAvailable() == null) {
-            setFirstChild(child);
+            coreSetFirstChild(child);
         } else {
-            OMNode lastChild = getLastKnownOMChild();
+            CoreChildNode lastChild = coreGetLastKnownChild();
             child.setPreviousOMSibling(lastChild);
             ((INode)lastChild).setNextOMSibling(child);
         }
-        setLastChild(child);
+        coreSetLastChild(child);
 
         // For a normal OMNode, the incomplete status is
         // propogated up the tree.  
@@ -175,7 +175,7 @@ public aspect OMContainerSupport {
         CoreChildNode child = coreGetFirstChildIfAvailable();
         boolean updateState;
         if (getState() == CoreParentNode.INCOMPLETE && getBuilder() != null) {
-            OMNode lastKnownChild = getLastKnownOMChild();
+            CoreChildNode lastKnownChild = coreGetLastKnownChild();
             if (lastKnownChild != null) {
                 lastKnownChild.build();
             }
@@ -188,11 +188,11 @@ public aspect OMContainerSupport {
             CoreChildNode nextSibling = (CoreChildNode)child.getNextOMSiblingIfAvailable();
             ((INode)child).setPreviousOMSibling(null);
             ((INode)child).setNextOMSibling(null);
-            ((INode)child).setParent(null);
+            child.coreSetParent(null);
             child = nextSibling;
         }
-        setFirstChild(null);
-        setLastChild(null);
+        coreSetFirstChild(null);
+        coreSetLastChild(null);
         if (updateState) {
             setComplete(true);
         }

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=1608309&r1=1608308&r2=1608309&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 22:56:47 2014
@@ -156,7 +156,7 @@ public aspect OMElementSupport {
     }
     
     public void IElement.detachAndDiscardParent() {
-        setParent(null);
+        coreSetParent(null);
         setPreviousOMSibling(null);
         setNextOMSibling(null);
     }

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=1608309&r1=1608308&r2=1608309&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 22:56:47 2014
@@ -30,6 +30,8 @@ import org.apache.axiom.om.OMSerializabl
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.om.impl.common.CoreChildNode;
+import org.apache.axiom.om.impl.common.CoreParentNode;
 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;
@@ -540,7 +542,7 @@ public abstract class NodeImpl extends I
         return parentNode();
     }
 
-    public final void setParent(OMContainer element) {
+    public final void coreSetParent(CoreParentNode element) {
         setParent((ParentNode)element, false);
     }
     
@@ -567,10 +569,10 @@ public abstract class NodeImpl extends I
             NodeImpl nextSibling = internalGetNextSibling();
             if (previousSibling == null) { // This is the first child
                 if (nextSibling != null) {
-                    parentNode.setFirstChild((OMNode)nextSibling);
+                    parentNode.coreSetFirstChild((CoreChildNode)nextSibling);
                 } else {
-                    parentNode.firstChild = null;
-                    parentNode.lastChild = null;
+                    parentNode.coreSetFirstChild(null);
+                    parentNode.coreSetLastChild(null);
                 }
             } else {
                 previousSibling.setNextOMSibling((OMNode)nextSibling);
@@ -579,8 +581,8 @@ public abstract class NodeImpl extends I
                 nextSibling.setPreviousOMSibling((OMNode)previousSibling);
                 internalSetNextSibling(null);
             }
-            if (parentNode != null && parentNode.lastChild == this) {
-                parentNode.lastChild = previousSibling;
+            if (parentNode != null && parentNode.coreGetLastKnownChild() == this)
{
+                parentNode.coreSetLastChild((CoreChildNode)previousSibling);
             }
             setParent(null, useDomSemantics);
             internalSetPreviousSibling(null);
@@ -599,13 +601,13 @@ public abstract class NodeImpl extends I
         if (sibling.getParent() != null) {
             sibling.detach();
         }
-        ((INode)sibling).setParent((OMContainer)parentNode);
+        ((INode)sibling).coreSetParent(parentNode);
         if (sibling instanceof NodeImpl) {
             NodeImpl domSibling = (NodeImpl) sibling;
             domSibling.internalSetPreviousSibling(this);
             NodeImpl nextSibling = internalGetNextSibling();
             if (nextSibling == null) {
-                parentNode.setLastChild(sibling);
+                parentNode.coreSetLastChild((CoreChildNode)sibling);
             } else {
                 nextSibling.internalSetPreviousSibling(domSibling);
             }
@@ -642,7 +644,7 @@ public abstract class NodeImpl extends I
             siblingImpl.internalSetNextSibling(this);
             NodeImpl previousSibling = internalGetPreviousSibling();
             if (previousSibling == null) {
-                parentNode.setFirstChild((OMNode)siblingImpl);
+                parentNode.coreSetFirstChild((CoreChildNode)siblingImpl);
                 siblingImpl.internalSetPreviousSibling(null);
             } else {
                 siblingImpl.setParent(parentNode, false);

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=1608309&r1=1608308&r2=1608309&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 22:56:47 2014
@@ -20,14 +20,11 @@
 package org.apache.axiom.om.impl.dom;
 
 import org.apache.axiom.om.OMCloneOptions;
-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.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;
@@ -38,11 +35,6 @@ import org.xml.sax.InputSource;
 import javax.xml.transform.sax.SAXSource;
 
 public abstract class ParentNode extends NodeImpl implements NodeList, CoreParentNode {
-
-    protected NodeImpl firstChild;
-
-    protected NodeImpl lastChild;
-
     protected ParentNode(OMFactory factory) {
         super(factory);
     }
@@ -55,29 +47,6 @@ public abstract class ParentNode extends
         insertBefore(node, null, false);
     }
     
-    public CoreChildNode coreGetFirstChildIfAvailable() {
-        return (CoreChildNode)firstChild;
-    }
-
-    public OMNode getLastKnownOMChild() {
-        return (OMNode)lastChild;
-    }
-
-    public void setFirstChild(OMNode firstChild) {
-        if (firstChild != null) {
-            ((INode)firstChild).setParent((OMContainer)this);
-        }
-        this.firstChild = (NodeImpl) firstChild;
-    }
-
-    /**
-     * Forcefully set the last child
-     * @param omNode
-     */
-    public void setLastChild(OMNode omNode) {
-        this.lastChild = (NodeImpl) omNode;
-    }
-
     // /
     // /DOM Node methods
     // /
@@ -118,7 +87,7 @@ public abstract class ParentNode extends
         if (!this.isComplete()) {
             this.build();
         }
-        return this.lastChild;
+        return (Node)coreGetLastKnownChild();
     }
 
     public boolean hasChildNodes() {
@@ -176,16 +145,16 @@ public abstract class ParentNode extends
                 build();
             }
             // if there are no children
-            if (this.lastChild == null && firstChild == null) {
-                this.lastChild = newDomChild;
-                this.firstChild = newDomChild;
-                this.firstChild.isFirstChild(true);
+            if (coreGetLastKnownChild() == null && coreGetFirstChildIfAvailable()
== null) {
+                coreSetLastChild((CoreChildNode)newDomChild);
+                coreSetFirstChild((CoreChildNode)newDomChild);
+                ((NodeImpl)coreGetFirstChildIfAvailable()).isFirstChild(true);
                 newDomChild.setParent(this, useDomSemantics);
             } else {
-                this.lastChild.internalSetNextSibling(newDomChild);
-                newDomChild.internalSetPreviousSibling(this.lastChild);
-                this.lastChild = newDomChild;
-                this.lastChild.internalSetNextSibling(null);
+                ((NodeImpl)coreGetLastKnownChild()).internalSetNextSibling(newDomChild);
+                newDomChild.internalSetPreviousSibling((NodeImpl)coreGetLastKnownChild());
+                coreSetLastChild((CoreChildNode)newDomChild);
+                ((NodeImpl)coreGetLastKnownChild()).internalSetNextSibling(null);
             }
             if (newDomChild.parentNode() == null) {
                 newDomChild.setParent(this, useDomSemantics);
@@ -196,7 +165,7 @@ public abstract class ParentNode extends
             while (tempNode != null) {
                 if (tempNode.equals(refChild)) {
                     // RefChild found
-                    if (this.firstChild == tempNode) { // If the refChild is the
+                    if (coreGetFirstChildIfAvailable() == tempNode) { // If the refChild
is the
                         // first child
 
                         if (newChild instanceof DocumentFragmentImpl) {
@@ -204,27 +173,27 @@ public abstract class ParentNode extends
                             DocumentFragmentImpl docFrag =
                                     (DocumentFragmentImpl) newChild;
                             
-                            NodeImpl child = docFrag.firstChild;
+                            NodeImpl child = (NodeImpl)docFrag.coreGetFirstChildIfAvailable();
                             while (child != null) {
                                 child.setParent(this, useDomSemantics);
                                 child = child.internalGetNextSibling();
                             }
                             
-                            this.firstChild = docFrag.firstChild;
-                            docFrag.lastChild.internalSetNextSibling(refDomChild);
-                            refDomChild.internalSetPreviousSibling(docFrag.lastChild.internalGetNextSibling());
+                            coreSetFirstChild(docFrag.coreGetFirstChildIfAvailable());
+                            ((NodeImpl)docFrag.coreGetLastKnownChild()).internalSetNextSibling(refDomChild);
+                            refDomChild.internalSetPreviousSibling(((NodeImpl)docFrag.coreGetLastKnownChild()).internalGetNextSibling());
 
-                            docFrag.firstChild = null;
-                            docFrag.lastChild = null;
+                            docFrag.coreSetFirstChild(null);
+                            docFrag.coreSetLastChild(null);
                         } else {
 
                             // Make the newNode the first Child
-                            this.firstChild = newDomChild;
+                            coreSetFirstChild((CoreChildNode)newDomChild);
 
                             newDomChild.internalSetNextSibling(refDomChild);
                             refDomChild.internalSetPreviousSibling(newDomChild);
 
-                            this.firstChild.isFirstChild(true);
+                            ((NodeImpl)coreGetFirstChildIfAvailable()).isFirstChild(true);
                             refDomChild.isFirstChild(false);
                             newDomChild.internalSetPreviousSibling(null); // Just to be
                             // sure :-)
@@ -238,20 +207,20 @@ public abstract class ParentNode extends
                             DocumentFragmentImpl docFrag =
                                     (DocumentFragmentImpl) newChild;
 
-                            NodeImpl child = docFrag.firstChild;
+                            NodeImpl child = (NodeImpl)docFrag.coreGetFirstChildIfAvailable();
                             while (child != null) {
                                 child.setParent(this, useDomSemantics);
                                 child = child.internalGetNextSibling();
                             }
                             
-                            previousNode.internalSetNextSibling(docFrag.firstChild);
-                            docFrag.firstChild.internalSetPreviousSibling(previousNode);
+                            previousNode.internalSetNextSibling((NodeImpl)docFrag.coreGetFirstChildIfAvailable());
+                            ((NodeImpl)docFrag.coreGetFirstChildIfAvailable()).internalSetPreviousSibling(previousNode);
 
-                            docFrag.lastChild.internalSetNextSibling(refDomChild);
-                            refDomChild.internalSetPreviousSibling(docFrag.lastChild);
+                            ((NodeImpl)docFrag.coreGetLastKnownChild()).internalSetNextSibling(refDomChild);
+                            refDomChild.internalSetPreviousSibling((NodeImpl)docFrag.coreGetLastKnownChild());
 
-                            docFrag.firstChild = null;
-                            docFrag.lastChild = null;
+                            docFrag.coreSetFirstChild(null);
+                            docFrag.coreSetLastChild(null);
                         } else {
 
                             previousNode.internalSetNextSibling(newDomChild);
@@ -320,8 +289,8 @@ public abstract class ParentNode extends
                         child = child.internalGetNextSibling();
                     }
 
-                    docFrag.setFirstChild(null);
-                    docFrag.setLastChild(null);
+                    docFrag.coreSetFirstChild(null);
+                    docFrag.coreSetLastChild(null);
                 } else {
                     head = newDomChild;
                     tail = newDomChild;
@@ -338,13 +307,13 @@ public abstract class ParentNode extends
                 if (previousSibling != null) {
                     previousSibling.internalSetNextSibling(head);
                 } else {
-                    this.firstChild = head;
+                    coreSetFirstChild((CoreChildNode)head);
                 }
 
                 if (nextSibling != null) {
                     nextSibling.internalSetPreviousSibling(tail);
                 } else {
-                    this.lastChild = tail;
+                    coreSetLastChild((CoreChildNode)tail);
                 }
                 
                 found = true;

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
Sun Jul  6 22:56:47 2014
@@ -36,7 +36,6 @@ import org.apache.axiom.om.impl.common.s
 import org.apache.axiom.util.UIDGenerator;
 import org.apache.axiom.util.base64.Base64Utils;
 import org.w3c.dom.DOMException;
-import org.w3c.dom.Node;
 import org.w3c.dom.Text;
 
 import javax.activation.DataHandler;
@@ -194,7 +193,7 @@ public abstract class TextNodeImpl exten
 
         ParentNode parentNode = parentNode();
         if (parentNode != null) {
-            newText.setParent((OMContainer)parentNode);
+            newText.coreSetParent(parentNode);
         }
 
         this.insertSiblingAfter(newText);

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
Sun Jul  6 22:56:47 2014
@@ -117,7 +117,7 @@ public class SOAPEnvelopeImpl extends SO
                 // body and insert the header.  If the body is not found,
                 // this indicates that it has not been parsed yet...and
                 // the code will fall through to the super.addChild.
-                OMNode node = (OMNode)this.lastChild;
+                OMNode node = (OMNode)coreGetLastKnownChild();
                 while (node != null) {
                     if (node instanceof SOAPBody) {
                         node.insertSiblingBefore(child);

Modified: webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
Sun Jul  6 22:56:47 2014
@@ -44,8 +44,8 @@ public abstract class SOAPFaultRoleImpl 
     }
 
     public void setRoleValue(String uri) {
-        if (firstChild != null) {
-            firstChild.detach();
+        if (coreGetFirstChildIfAvailable() != null) {
+            coreGetFirstChildIfAvailable().detach();
         }
         this.setText(uri);
     }

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMDocumentImpl.java
Sun Jul  6 22:56:47 2014
@@ -28,7 +28,6 @@ import org.apache.axiom.om.OMInformation
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
 import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.common.CoreChildNode;
 import org.apache.axiom.om.impl.common.IDocument;
 import org.apache.axiom.om.impl.common.OMDocumentHelper;
 import org.apache.axiom.om.impl.common.serializer.push.OutputException;
@@ -46,12 +45,6 @@ public class OMDocumentImpl extends OMSe
 
     protected int state;
 
-    /** Field firstChild */
-    protected OMNode firstChild;
-
-    /** Field lastChild */
-    protected OMNode lastChild;
-
     /** Field charSetEncoding Default : UTF-8 */
     protected String charSetEncoding = "UTF-8";
 
@@ -150,31 +143,6 @@ public class OMDocumentImpl extends OMSe
     protected void checkDocumentElement(OMElement element) {
     }
 
-    public CoreChildNode coreGetFirstChildIfAvailable() {
-        return (CoreChildNode)firstChild;
-    }
-
-    public OMNode getLastKnownOMChild() {
-        return lastChild;
-    }
-
-    /**
-     * Method setFirstChild.
-     *
-     * @param firstChild
-     */
-    public void setFirstChild(OMNode firstChild) {
-        this.firstChild = firstChild;
-    }
-
-    /**
-     * Forcefully set the last child
-     * @param omNode
-     */
-    public void setLastChild(OMNode omNode) {
-        this.lastChild = omNode;
-    }
-
     public String getCharsetEncoding() {
         return charSetEncoding;
     }

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=1608309&r1=1608308&r2=1608309&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 22:56:47 2014
@@ -30,10 +30,8 @@ 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.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;
@@ -87,16 +85,12 @@ public class OMElementImpl extends OMNod
 
     protected QName qName;
 
-    /** Field firstChild */
-    protected OMNode firstChild;
-
     /** Field namespaces */
     protected HashMap namespaces = null;
     
     /** Field attributes */
     protected HashMap attributes = null;
 
-    protected OMNode lastChild;
     private int lineNumber;
     private static final EmptyIterator EMPTY_ITERATOR = new EmptyIterator();
 
@@ -515,27 +509,6 @@ public class OMElementImpl extends OMNod
         return builder;
     }
 
-    public CoreChildNode coreGetFirstChildIfAvailable() {
-        return (CoreChildNode)firstChild;
-    }
-
-    public OMNode getLastKnownOMChild() {
-        return lastChild;
-    }
-
-    /** Method setFirstChild. */
-    public void setFirstChild(OMNode firstChild) {
-        if (firstChild != null) {
-            ((INode)firstChild).setParent(this);
-        }
-        this.firstChild = firstChild;
-    }
-
-
-    public void setLastChild(OMNode omNode) {
-         this.lastChild = omNode;
-    }
-
     /**
      * Removes this information item and its children, from the model completely.
      *

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=1608309&r1=1608308&r2=1608309&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 22:56:47 2014
@@ -72,7 +72,7 @@ public abstract class OMNodeImpl extends
      *
      * @param element
      */
-    public void setParent(OMContainer element) {
+    public void coreSetParent(CoreParentNode element) {
 
         if ((this.parent) == element) {
             return;
@@ -124,12 +124,12 @@ public abstract class OMNodeImpl extends
         // document or element being built.
         INode nextSibling = (INode)getNextOMSiblingIfAvailable();
         if (previousSibling == null) {
-            parent.setFirstChild(nextSibling);
+            parent.coreSetFirstChild(nextSibling);
         } else {
             previousSibling.setNextOMSibling(nextSibling);
         }
         if (nextSibling == null) {
-            parent.setLastChild(previousSibling);
+            parent.coreSetLastChild(previousSibling);
         } else {
             nextSibling.setPreviousOMSibling(previousSibling);
         }
@@ -155,7 +155,7 @@ public abstract class OMNodeImpl extends
         if (sibling.getParent() != null) {
             sibling.detach();
         }
-        ((INode)sibling).setParent(parent);
+        ((CoreChildNode)sibling).coreSetParent(parent);
         if (sibling instanceof OMNodeImpl) {
             OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
             if (nextSibling == null) {
@@ -163,7 +163,7 @@ public abstract class OMNodeImpl extends
             }
             siblingImpl.setPreviousOMSibling(this);
             if (nextSibling == null) {
-                parent.setLastChild(sibling);
+                parent.coreSetLastChild((CoreChildNode)sibling);
             } else {
                 nextSibling.setPreviousOMSibling(sibling);
             }
@@ -191,11 +191,11 @@ public abstract class OMNodeImpl extends
             OMNodeImpl siblingImpl = (OMNodeImpl) sibling;
             
             if (previousSibling == null) {
-                parent.setFirstChild(siblingImpl);
+                parent.coreSetFirstChild(siblingImpl);
                 siblingImpl.nextSibling = this;
                 siblingImpl.previousSibling = null;
             } else {
-                siblingImpl.setParent(parent);
+                siblingImpl.coreSetParent(parent);
                 siblingImpl.nextSibling = this;
                 previousSibling.setNextOMSibling(siblingImpl);
                 siblingImpl.setPreviousOMSibling(previousSibling);

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=1608309&r1=1608308&r2=1608309&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 22:56:47 2014
@@ -443,12 +443,12 @@ public class OMSourcedElementImpl extend
         return super.getBuilder();
     }
 
-    public void setFirstChild(OMNode node) {
-        super.setFirstChild(node);
+    public void coreSetFirstChild(CoreChildNode firstChild) {
+        super.coreSetFirstChild(firstChild);
     }
 
-    public void setLastChild(OMNode omNode) {
-        super.setLastChild(omNode);
+    public void coreSetLastChild(CoreChildNode lastChild) {
+        super.coreSetLastChild(lastChild);
     }
 
     public OMElement getFirstElement() {
@@ -867,8 +867,8 @@ public class OMSourcedElementImpl extend
         return super.getFirstOMChildIfAvailable();
     }
 
-    public OMNode getLastKnownOMChild() {
-        return super.getLastKnownOMChild();
+    public CoreChildNode getLastKnownOMChild() {
+        return super.coreGetLastKnownChild();
     }
 
     public OMNode detach() throws OMException {
@@ -1109,6 +1109,10 @@ public class OMSourcedElementImpl extend
         return super.coreGetParent();
     }
 
+    public void coreSetParent(CoreParentNode element) {
+        super.coreSetParent(element);
+    }
+
     public CoreChildNode coreGetNextSiblingIfAvailable() {
         return super.coreGetNextSiblingIfAvailable();
     }
@@ -1122,6 +1126,10 @@ public class OMSourcedElementImpl extend
         return super.coreGetFirstChildIfAvailable();
     }
 
+    public CoreChildNode coreGetLastKnownChild() {
+        return super.coreGetLastKnownChild();
+    }
+    
     public void detachAndDiscardParent() {
         super.detachAndDiscardParent();
     }

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPElement.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPElement.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPElement.java
Sun Jul  6 22:56:47 2014
@@ -23,6 +23,7 @@ import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.common.CoreParentNode;
 import org.apache.axiom.om.impl.llom.OMElementImpl;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPProcessingException;
@@ -71,8 +72,8 @@ public abstract class SOAPElement extend
     /** This has to be implemented by all the derived classes to check for the correct parent.
*/
     protected abstract void checkParent(OMElement parent) throws SOAPProcessingException;
 
-    public void setParent(OMContainer element) {
-        super.setParent(element);
+    public void coreSetParent(CoreParentNode element) {
+        super.coreSetParent(element);
 
         if (element instanceof OMElement) {
             checkParent((OMElement) element);

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPEnvelopeImpl.java
Sun Jul  6 22:56:47 2014
@@ -137,7 +137,7 @@ public class SOAPEnvelopeImpl extends SO
                 // body and insert the header.  If the body is not found,
                 // this indicates that it has not been parsed yet...and
                 // the code will fall through to the super.addChild.
-                OMNode node = this.lastChild;
+                OMNode node = coreGetLastKnownChild();
                 while (node != null) {
                     if (node instanceof SOAPBody) {
                         node.insertSiblingBefore(child);

Modified: webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java?rev=1608309&r1=1608308&r2=1608309&view=diff
==============================================================================
--- webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java
(original)
+++ webservices/axiom/trunk/modules/axiom-impl/src/main/java/org/apache/axiom/soap/impl/llom/SOAPHeaderBlockImpl.java
Sun Jul  6 22:56:47 2014
@@ -29,6 +29,7 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMSourcedElement;
 import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.common.CoreParentNode;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.llom.OMAttributeImpl;
 import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
@@ -65,8 +66,8 @@ public abstract class SOAPHeaderBlockImp
 
     protected abstract void checkParent(OMElement parent) throws SOAPProcessingException;
 
-    public void setParent(OMContainer element) {
-        super.setParent(element);
+    public void coreSetParent(CoreParentNode element) {
+        super.coreSetParent(element);
 
         if (element instanceof OMElement) {
             checkParent((OMElement) element);



Mime
View raw message