You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/05/28 20:27:55 UTC

svn commit: r1343353 [1/2] - in /axis/axis2/java/core/trunk/modules: jaxws/src/org/apache/axis2/jaxws/message/util/impl/ saaj/src/org/apache/axis2/saaj/

Author: veithen
Date: Mon May 28 18:27:54 2012
New Revision: 1343353

URL: http://svn.apache.org/viewvc?rev=1343353&view=rev
Log:
Attempt to reduce the strong coupling between the SAAJ implementation and DOOM. The SAAJ implementation basically creates proxy nodes that use DOOM nodes as targets. There is no reason why these proxy nodes would extend the base class used by DOOM (NodeImpl).

Added:
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java
      - copied, changed from r1340151, axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/NodeImplEx.java
Removed:
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/NodeImplEx.java
Modified:
    axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
    axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java

Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java Mon May 28 18:27:54 2012
@@ -632,7 +632,7 @@ public class SAAJConverterImpl implement
                         Node value = se.getFirstChild();
                         if (value != null && value instanceof org.apache.axis2.saaj.SOAPElementImpl) {
                             org.apache.axis2.saaj.SOAPElementImpl valueElement = (org.apache.axis2.saaj.SOAPElementImpl) value;
-                            ElementImpl e = valueElement.getElement();
+                            ElementImpl e = valueElement.getTarget();
                             String content = e.getText();
                             
                             SOAPElement child = fault.addChildElement(new QName(se.getNamespaceURI(), SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME));
@@ -657,7 +657,7 @@ public class SAAJConverterImpl implement
                         Node value = se.getFirstChild();
                         if (value != null && value instanceof org.apache.axis2.saaj.SOAPElementImpl) {
                             org.apache.axis2.saaj.SOAPElementImpl valueElement = (org.apache.axis2.saaj.SOAPElementImpl) value;
-                            ElementImpl e = valueElement.getElement();
+                            ElementImpl e = valueElement.getTarget();
                             String content = e.getText();
                            
                             SOAPElement child = fault.addChildElement(new QName(se.getNamespaceURI(), SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME));

Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java Mon May 28 18:27:54 2012
@@ -19,7 +19,6 @@
 package org.apache.axis2.saaj;
 
 import javax.xml.soap.SOAPElement;
-import javax.xml.soap.Text;
 
 import org.w3c.dom.Comment;
 
@@ -37,12 +36,4 @@ public class CommentImpl extends TextImp
     public boolean isComment() {
         return true;
     }
-
-    public String getNodeName() {
-        return "#comment";
-    }
-
-    public short getNodeType() {
-        return Text.COMMENT_NODE;
-    }
 }

Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java Mon May 28 18:27:54 2012
@@ -73,8 +73,8 @@ public class DetailImpl extends SOAPFaul
      */
     public DetailEntry addDetailEntry(Name name) throws SOAPException {
         SOAPElementImpl childElement = (SOAPElementImpl)addChildElement(name);
-        DetailEntryImpl detailEntry = new DetailEntryImpl(childElement.element);
-        childElement.element.setUserData(SAAJ_NODE, detailEntry, null);
+        DetailEntryImpl detailEntry = new DetailEntryImpl(childElement.target);
+        childElement.target.setUserData(SAAJ_NODE, detailEntry, null);
         return detailEntry;
     }
 
@@ -85,7 +85,7 @@ public class DetailImpl extends SOAPFaul
      *         <code>Detail</code> object
      */
     public Iterator getDetailEntries() {
-        final Iterator detailEntriesIter = element.getChildElements();
+        final Iterator detailEntriesIter = target.getChildElements();
         Collection details = new ArrayList();
         while (detailEntriesIter.hasNext()) {
             details.add(new DetailEntryImpl((ElementImpl)detailEntriesIter.next()));
@@ -102,8 +102,8 @@ public class DetailImpl extends SOAPFaul
      */
     public DetailEntry addDetailEntry(QName qname) throws SOAPException {
         SOAPElementImpl childElement = (SOAPElementImpl)addChildElement(qname);
-        DetailEntryImpl detailEntry = new DetailEntryImpl(childElement.element);
-        childElement.element.setUserData(SAAJ_NODE, detailEntry, null);
+        DetailEntryImpl detailEntry = new DetailEntryImpl(childElement.target);
+        childElement.target.setUserData(SAAJ_NODE, detailEntry, null);
         return detailEntry;
     }
 

Copied: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java (from r1340151, axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/NodeImplEx.java)
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java?p2=axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java&p1=axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/NodeImplEx.java&r1=1340151&r2=1343353&rev=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/NodeImplEx.java (original)
+++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java Mon May 28 18:27:54 2012
@@ -22,8 +22,8 @@ package org.apache.axis2.saaj;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.dom.DOMMessageFormatter;
 import org.apache.axiom.om.impl.dom.ElementImpl;
 import org.apache.axiom.om.impl.dom.NodeImpl;
 import org.apache.axiom.soap.impl.dom.SOAPBodyImpl;
@@ -31,8 +31,13 @@ import org.apache.axiom.soap.impl.dom.SO
 import org.w3c.dom.Attr;
 import org.w3c.dom.Comment;
 import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
 import org.w3c.dom.TypeInfo;
+import org.w3c.dom.UserDataHandler;
 
 import javax.xml.soap.Node;
 import javax.xml.soap.SOAPElement;
@@ -43,15 +48,18 @@ import javax.xml.soap.SOAPException;
  * some tree manipulation methods. This interface provides methods for getting the value of a node,
  * for getting and setting the parent of a node, and for removing a node.
  */
-public abstract class NodeImplEx extends NodeImpl implements Node {
+public abstract class SAAJNode<T extends org.w3c.dom.Node> implements Node {
+    protected final T target;
+    protected SOAPElement parentElement;
+    static final String SAAJ_NODE = "saaj.node";
 
-    /** @param factory  */
-    protected NodeImplEx(OMFactory factory) {
-        super(factory);
+    public SAAJNode(T target) {
+        this.target = target;
     }
 
-    protected SOAPElement parentElement;
-    static final String SAAJ_NODE = "saaj.node";
+    public final T getTarget() {
+        return target;
+    }
 
     /**
      * Removes this <code>Node</code> object from the tree. Once removed, this node can be garbage
@@ -83,23 +91,6 @@ public abstract class NodeImplEx extends
     }*/
 
     /**
-     * Returns the the value of the immediate child of this <code>Node</code> object if a child
-     * exists and its valu e is text.
-     *
-     * @return a <code>String</code> with the text of the immediate child of this <code>Node</code>
-     *         object if (1) there is a child and (2) the child is a <code>Text</code> object;
-     *         <code>null</code> otherwise
-     */
-    public String getValue() {
-        if (this.getNodeType() == Node.TEXT_NODE) {
-            return this.getNodeValue();
-        } else if (this.getNodeType() == Node.ELEMENT_NODE) {
-            return ((NodeImplEx)(((OMElement)this).getFirstOMChild())).getValue();
-        }
-        return null;
-    }
-
-    /**
      * Notifies the implementation that this <code>Node</code> object is no longer being used by the
      * application and that the implementation is free to reuse this object for nodes that may be
      * created later.
@@ -298,4 +289,194 @@ public abstract class NodeImplEx extends
     public org.w3c.dom.Node getParentNode() {
         return null;
     }
+
+    public final boolean hasAttributes() {
+        return parentElement.hasAttributes();
+    }
+
+    public final boolean isSupported(String feature, String version) {
+        return parentElement.isSupported(feature, version);
+    }
+
+    public final String getBaseURI() {
+        return parentElement.getBaseURI();
+    }
+
+    public final String getNodeValue() throws DOMException {
+        return target.getNodeValue();
+    }
+
+    public final void setNodeValue(String nodeValue) throws DOMException {
+        target.setNodeValue(nodeValue);
+    }
+
+    public final org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild) throws DOMException {
+        return target.insertBefore(newChild, refChild);
+    }
+
+    public final org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild) throws DOMException {
+        return target.replaceChild(newChild, oldChild);
+    }
+
+    public final org.w3c.dom.Node cloneNode(boolean deep) {
+        return target.cloneNode(deep);
+    }
+
+    public final void normalize() {
+        target.normalize();
+    }
+
+    public final void setPrefix(String prefix) throws DOMException {
+        target.setPrefix(prefix);
+    }
+
+    public final short compareDocumentPosition(org.w3c.dom.Node other) throws DOMException {
+        return target.compareDocumentPosition(other);
+    }
+
+    public final void setTextContent(String textContent) throws DOMException {
+        target.setTextContent(textContent);
+    }
+
+    public final boolean isSameNode(org.w3c.dom.Node other) {
+        return target.isSameNode(other);
+    }
+
+    public final String lookupPrefix(String namespaceURI) {
+        return target.lookupPrefix(namespaceURI);
+    }
+
+    public final boolean isDefaultNamespace(String namespaceURI) {
+        return target.isDefaultNamespace(namespaceURI);
+    }
+
+    public final String lookupNamespaceURI(String prefix) {
+        return null;
+    }
+
+    public final boolean isEqualNode(org.w3c.dom.Node arg) {
+        return target.isEqualNode(arg);
+    }
+
+    public final Object getFeature(String feature, String version) {
+        return target.getFeature(feature, version);
+    }
+
+    public final Object setUserData(String key, Object data, UserDataHandler handler) {
+        return target.setUserData(key, data, handler);
+    }
+
+    public final Object getUserData(String key) {
+        return target.getUserData(key);
+    }
+
+    public final org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws DOMException {
+        if (oldChild instanceof SAAJNode) {
+            oldChild = ((SAAJNode<?>)oldChild).getTarget();
+        }
+        return target.removeChild(oldChild);
+    }
+
+    public final String getNodeName() {
+        return target.getNodeName();
+    }
+
+    public final short getNodeType() {
+        return parentElement.getNodeType();
+    }
+
+    public final Document getOwnerDocument() {
+        return target.getOwnerDocument();
+    }
+
+    public final String getLocalName() {
+        return target.getLocalName();
+    }
+
+    public final String getNamespaceURI() {
+        return target.getNamespaceURI();
+    }
+
+    public final String getPrefix() {
+        return target.getPrefix();
+    }
+
+    public final org.w3c.dom.Node getFirstChild() {
+        return toSAAJNode(target.getFirstChild());
+    }
+
+    public final boolean hasChildNodes() {
+        return target.hasChildNodes();
+    }
+
+    public final org.w3c.dom.Node getLastChild() {
+        return toSAAJNode(target.getLastChild());
+    }
+
+    protected final NodeList toSAAJNodeList(NodeList nodes) {
+        NodeListImpl result = new NodeListImpl();
+        for (int i = 0; i < nodes.getLength(); i++) {
+            result.addNode(toSAAJNode(nodes.item(i)));
+        }
+        return result;
+    }
+
+    public final NodeList getChildNodes() {
+        return toSAAJNodeList(target.getChildNodes());
+    }
+
+    public final org.w3c.dom.Node appendChild(org.w3c.dom.Node child) throws DOMException {        
+        if (getOwnerDocument() != child.getOwnerDocument()) {
+            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "Wrong document");
+        }
+        try {
+            if (child instanceof Text) {
+                return appendText((Text)child);
+            } else if (child instanceof ElementImpl) {
+                return appendElement((ElementImpl)child);
+            }
+        } catch (SOAPException e) {
+            DOMException ex = 
+                new DOMException(DOMException.HIERARCHY_REQUEST_ERR, e.getMessage());
+            ex.initCause(e);
+            throw ex;
+        }
+        throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                DOMMessageFormatter.formatMessage(
+                        DOMMessageFormatter.DOM_DOMAIN,
+                        DOMException.HIERARCHY_REQUEST_ERR, null));
+    }
+
+    protected Text appendText(Text child) throws SOAPException {
+        String text = child.getData();
+        Text textNode = getOwnerDocument().createTextNode(text);
+        NodeImpl node = ((NodeImpl)target.appendChild(textNode));
+        TextImplEx saajTextNode = new TextImplEx(text, (SOAPElement)this);
+        node.setUserData(SAAJ_NODE, saajTextNode, null);
+        return saajTextNode;
+    }
+    
+    protected Element appendElement(ElementImpl child) throws SOAPException {
+        String namespaceURI = child.getNamespaceURI();
+        String prefix = child.getPrefix();
+
+        SOAPElementImpl childEle = new SOAPElementImpl(child);
+        
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
+        if (namespaceURI != null && namespaceURI.trim().length() > 0) {
+            childEle.target.setNamespace(childEle.target.declareNamespace(namespaceURI, prefix));
+        }
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        childEle.setParentElement((SOAPElement)this);
+        return childEle;
+    }
+
+    public final String getTextContent() throws DOMException {
+        return target.getTextContent();
+    }
+
+    public final NamedNodeMap getAttributes() {
+        return target.getAttributes();
+    }
 }

Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java Mon May 28 18:27:54 2012
@@ -72,9 +72,9 @@ public class SOAPBodyImpl extends SOAPEl
         }
         SOAPBodyElementImpl childEle =
                 new SOAPBodyElementImpl((ElementImpl)getOwnerDocument().createElement(localName));
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         isBodyElementAdded = true;
         return childEle;
     }
@@ -89,10 +89,10 @@ public class SOAPBodyImpl extends SOAPEl
                 new SOAPBodyElementImpl(
                         (ElementImpl)getOwnerDocument().createElementNS(namespaceURI,
                                                                         localName));
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
-        childEle.element.setNamespace(childEle.element.declareNamespace(namespaceURI, prefix));
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
+        childEle.target.setNamespace(childEle.target.declareNamespace(namespaceURI, prefix));
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
@@ -104,12 +104,12 @@ public class SOAPBodyImpl extends SOAPEl
 
         SOAPBodyElementImpl childEle = new SOAPBodyElementImpl(child);
 
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
         if (namespaceURI != null && namespaceURI.trim().length() > 0) {
-            childEle.element.setNamespace(childEle.element.declareNamespace(namespaceURI, prefix));
+            childEle.target.setNamespace(childEle.target.declareNamespace(namespaceURI, prefix));
         }
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
@@ -125,7 +125,7 @@ public class SOAPBodyImpl extends SOAPEl
                 new SOAPBodyElementImpl(
                         (ElementImpl)getOwnerDocument().createElement(localName));
         } else {
-            element.declareNamespace(namespaceURI, prefix);
+            target.declareNamespace(namespaceURI, prefix);
             childEle =
                 new SOAPBodyElementImpl(
                         (ElementImpl)getOwnerDocument().createElementNS(namespaceURI,
@@ -146,12 +146,12 @@ public class SOAPBodyImpl extends SOAPEl
             }
         }
 
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
         if (namespaceURI != null && namespaceURI.trim().length() > 0) {
-            childEle.element.setNamespace(childEle.element.declareNamespace(namespaceURI, prefix));
+            childEle.target.setNamespace(childEle.target.declareNamespace(namespaceURI, prefix));
         }
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
@@ -180,10 +180,10 @@ public class SOAPBodyImpl extends SOAPEl
                     (ElementImpl)getOwnerDocument().createElementNS(uri,
                                                                     prefix + ":" + localName));
         }
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
-        childEle.element.setNamespace(getOMFactory().createOMNamespace(uri, prefix));
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
+        childEle.target.setNamespace(target.getOMFactory().createOMNamespace(uri, prefix));
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         isBodyElementAdded = true;
         childEle.setParentElement(this);
         return childEle;
@@ -202,13 +202,13 @@ public class SOAPBodyImpl extends SOAPEl
         }
         SOAPFaultImpl saajSOAPFault = null;
 
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             SOAP11FaultImpl fault =
-                    new SOAP11FaultImpl(omSOAPBody, (SOAPFactory)this.element.getOMFactory());
+                    new SOAP11FaultImpl(omSOAPBody, (SOAPFactory)this.target.getOMFactory());
             saajSOAPFault = new SOAPFaultImpl(fault);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             SOAP12FaultImpl fault =
-                    new SOAP12FaultImpl(omSOAPBody, (SOAPFactory)this.element.getOMFactory());
+                    new SOAP12FaultImpl(omSOAPBody, (SOAPFactory)this.target.getOMFactory());
             saajSOAPFault = new SOAPFaultImpl(fault);
         }
         // set default fault code and string
@@ -271,12 +271,12 @@ public class SOAPBodyImpl extends SOAPEl
     public SOAPFault addFault(Name faultCode, String faultString, Locale locale)
             throws SOAPException {
         org.apache.axiom.soap.SOAPFault fault;
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             fault = new SOAP11FaultImpl(omSOAPBody, new Exception(
-                    faultString), (SOAPFactory)this.element.getOMFactory());
+                    faultString), (SOAPFactory)this.target.getOMFactory());
         } else {
             fault = new SOAP12FaultImpl(omSOAPBody, new Exception(
-                    faultString), (SOAPFactory)this.element.getOMFactory());
+                    faultString), (SOAPFactory)this.target.getOMFactory());
         }
         SOAPFaultImpl faultImpl = new SOAPFaultImpl(fault);
         faultImpl.setFaultCode(faultCode);
@@ -324,7 +324,7 @@ public class SOAPBodyImpl extends SOAPEl
 
         SOAPElement saajSOAPEle = (SOAPElement)toSAAJNode(docEle, this);
         SOAPBodyElementImpl bodyEle =
-                new SOAPBodyElementImpl(((SOAPElementImpl)saajSOAPEle).element);
+                new SOAPBodyElementImpl(((SOAPElementImpl)saajSOAPEle).target);
         addChildElement(bodyEle);
         return bodyEle;
     }
@@ -364,13 +364,13 @@ public class SOAPBodyImpl extends SOAPEl
             throws SOAPException {
         SOAPFaultImpl faultImpl = null;
 
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             SOAP11FaultImpl fault = new SOAP11FaultImpl(omSOAPBody, new Exception(
-                    faultString), (SOAPFactory)this.element.getOMFactory());
+                    faultString), (SOAPFactory)this.target.getOMFactory());
             faultImpl = new SOAPFaultImpl(fault);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             SOAP12FaultImpl fault = new SOAP12FaultImpl(omSOAPBody, new Exception(
-                    faultString), (SOAPFactory)this.element.getOMFactory());
+                    faultString), (SOAPFactory)this.target.getOMFactory());
             faultImpl = new SOAPFaultImpl(fault);
         }
 
@@ -468,7 +468,7 @@ public class SOAPBodyImpl extends SOAPEl
         }
         ElementImpl eleImpl =
                 new ElementImpl((DocumentImpl)this.getOwnerDocument(),
-                                localName, ns, this.element.getOMFactory());
+                                localName, ns, this.target.getOMFactory());
 
         SOAPElementImpl saajEle = new SOAPElementImpl(eleImpl);
 
@@ -508,25 +508,25 @@ public class SOAPBodyImpl extends SOAPEl
 
     public OMNode detach() {
         this.parentElement = null;
-        return this.element.detach();
+        return this.target.detach();
     }
 
     public Iterator getChildElements(Name name) {
         QName qName = new QName(name.getURI(), name.getLocalName());
-        return getChildren(element.getChildrenWithName(qName));
+        return getChildren(target.getChildrenWithName(qName));
     }
 
     public SOAPElement addAttribute(QName qname, String value) throws SOAPException {
         OMNamespace omNamespace = null;
         SOAPFactory soapFactory;
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             soapFactory = new SOAP11Factory();
             omNamespace = soapFactory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             soapFactory = new SOAP12Factory();
             omNamespace = soapFactory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
         }
-        this.element.addAttribute(qname.getLocalPart(), value, omNamespace);
+        this.target.addAttribute(qname.getLocalPart(), value, omNamespace);
         return this;
     }
 
@@ -548,21 +548,21 @@ public class SOAPBodyImpl extends SOAPEl
                                                                     qname.getPrefix() + ":" +
                                                                             qname.getLocalPart()));
         }
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
-        childEle.element.setNamespace(getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()));
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
+        childEle.target.setNamespace(target.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()));
 
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         isBodyElementAdded = true;
         childEle.setParentElement(this);
         return childEle;
     }
 
     public QName createQName(String localName, String prefix) throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             return super.createQName(localName, prefix);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
-            if (this.element.findNamespaceURI(prefix) == null) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
+            if (this.target.findNamespaceURI(prefix) == null) {
                 throw new SOAPException("Only Namespace Qualified elements are allowed");
             } else {
                 return super.createQName(localName, prefix);
@@ -598,7 +598,7 @@ public class SOAPBodyImpl extends SOAPEl
     }
 
     public Iterator getChildElements() {
-        return getChildren(element.getChildren());
+        return getChildren(target.getChildren());
     }
 
     public SOAPElement addTextNode(String text) throws SOAPException {
@@ -617,7 +617,7 @@ public class SOAPBodyImpl extends SOAPEl
                 if (domNode instanceof ElementImpl) {
                     if (omSOAPBody.hasFault()) {
 
-                        SOAPFactory omFactory = (SOAPFactory)this.element.getOMFactory();
+                        SOAPFactory omFactory = (SOAPFactory)this.target.getOMFactory();
                         org.apache.axiom.soap.SOAPFault fault;
                         if (omFactory instanceof SOAP11Factory) {
                             fault = new SOAP11FaultImpl(omSOAPBody, omFactory);

Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java Mon May 28 18:27:54 2012
@@ -24,11 +24,10 @@ import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.dom.DOMMessageFormatter;
 import org.apache.axiom.om.impl.dom.ElementImpl;
 import org.apache.axiom.om.impl.dom.NodeImpl;
 import org.apache.axiom.om.impl.dom.TextImpl;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
 import org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory;
 import org.w3c.dom.Attr;
@@ -58,30 +57,23 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 
-public class SOAPElementImpl extends NodeImplEx implements SOAPElement {
-
-    /**
-     * Using a delegate because we can't extend from org.apache.axiom.om.impl.dom.ElementImpl since
-     * this class must extend SNodeImpl
-     */
-    protected ElementImpl element;
+public class SOAPElementImpl extends SAAJNode<ElementImpl> implements SOAPElement {
     private String encodingStyle;
 
     public SOAPElementImpl(ElementImpl element) {
-        super(element.getOMFactory());
-        this.element = element;
+        super(element);
     }
 
     /* (non-Javadoc)
       * @see org.apache.axiom.om.OMNode#discard()
       */
     public void discard() throws OMException {
-        element.discard();
+        target.discard();
     }
 
     public void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean cache)
             throws XMLStreamException {
-        element.internalSerialize(writer, cache);
+        target.internalSerialize(writer, cache);
     }
 
     /**
@@ -95,9 +87,9 @@ public class SOAPElementImpl extends Nod
      */
     public SOAPElement addAttribute(Name name, String value) throws SOAPException {
         if (name.getURI() == null || name.getURI().trim().length() == 0) {
-            element.setAttribute(name.getLocalName(), value);
+            target.setAttribute(name.getLocalName(), value);
         } else {
-            element.setAttributeNS(name.getURI(), name.getPrefix() + ":" + name.getLocalName(),
+            target.setAttributeNS(name.getURI(), name.getPrefix() + ":" + name.getLocalName(),
                                    value);
         }
         return this;
@@ -124,7 +116,7 @@ public class SOAPElementImpl extends Nod
         if (namespaceURI == null || namespaceURI.trim().length() == 0) {
             childEle =  new SOAPElementImpl((ElementImpl)getOwnerDocument().createElement(localName));
         } else {
-            element.declareNamespace(namespaceURI, prefix);
+            target.declareNamespace(namespaceURI, prefix);
             childEle =
                 new SOAPElementImpl((ElementImpl)getOwnerDocument().createElementNS(namespaceURI,
                                                                                     localName));
@@ -144,31 +136,16 @@ public class SOAPElementImpl extends Nod
             }
         }
 
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
         if (namespaceURI != null && namespaceURI.trim().length() > 0) {
-            childEle.element.setNamespace(childEle.element.declareNamespace(namespaceURI, prefix));
+            childEle.target.setNamespace(childEle.target.declareNamespace(namespaceURI, prefix));
         }
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
 
-    public String getLocalName() {
-        return element.getLocalName();
-    }
-
-    public String getNamespaceURI() {
-        return element.getNamespaceURI();
-    }
-
-    /*
-    * Overidden in ElementImpl and AttrImpl.
-    */
-    public String getPrefix() {
-        return element.getPrefix();
-    }
-
     /* (non-Javadoc)
     * @see javax.xml.soap.SOAPElement#addChildElement(java.lang.String, java.lang.String, java.lang.String)
     */
@@ -181,12 +158,12 @@ public class SOAPElementImpl extends Nod
                 new SOAPElementImpl((ElementImpl)getOwnerDocument().
                         createElementNS(namespaceURI, prefix.length() == 0 ? localName : prefix + ":" + localName));
     
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
-        childEle.element.setNamespace(prefix.length() == 0
-                ? childEle.element.declareDefaultNamespace(namespaceURI)
-                : childEle.element.declareNamespace(namespaceURI, prefix));
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
+        childEle.target.setNamespace(prefix.length() == 0
+                ? childEle.target.declareDefaultNamespace(namespaceURI)
+                : childEle.target.declareNamespace(namespaceURI, prefix));
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
@@ -210,9 +187,9 @@ public class SOAPElementImpl extends Nod
     public SOAPElement addChildElement(String localName) throws SOAPException {
         SOAPElementImpl childEle =
                 new SOAPElementImpl((ElementImpl)getOwnerDocument().createElement(localName));
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
+        target.appendChild(childEle.target);
+        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
@@ -222,9 +199,9 @@ public class SOAPElementImpl extends Nod
       */
     public SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException {
         if (prefix == null || prefix.length() == 0) {
-            element.declareDefaultNamespace(uri);
+            target.declareDefaultNamespace(uri);
         } else {
-            element.declareNamespace(uri, prefix);
+            target.declareNamespace(uri, prefix);
         }
         return this;
     }
@@ -243,7 +220,7 @@ public class SOAPElementImpl extends Nod
         //Therefore create a text node and add it
         //TODO: May need to address the situation where the prev sibling of the textnode itself is a textnode
         Text textNode = getOwnerDocument().createTextNode(text);
-        NodeImpl node = ((NodeImpl)element.appendChild(textNode));
+        NodeImpl node = ((NodeImpl)target.appendChild(textNode));
         TextImplEx saajTextNode = new TextImplEx((TextImpl)textNode, this);
         node.setUserData(SAAJ_NODE, saajTextNode, null);
         return this;
@@ -257,7 +234,7 @@ public class SOAPElementImpl extends Nod
      * @return an iterator over the names of the attributes
      */
     public Iterator getAllAttributes() {
-        final Iterator attribIter = element.getAllAttributes();
+        final Iterator attribIter = target.getAllAttributes();
         Collection attribName = new ArrayList();
         Attr attr;
         while (attribIter.hasNext()) {
@@ -283,7 +260,7 @@ public class SOAPElementImpl extends Nod
     public String getAttributeValue(Name name) {
         //This method is waiting on the finalization of the name for a method
         //in OMElement that returns a OMAttribute from an input QName
-        final OMAttribute attribute = element.getAttribute(new QName(name.getURI(),
+        final OMAttribute attribute = target.getAttribute(new QName(name.getURI(),
                                                                      name.getLocalName(),
                                                                      name.getPrefix()));
         if (attribute == null) {
@@ -300,7 +277,7 @@ public class SOAPElementImpl extends Nod
      *         <CODE>SOAPElement</CODE> object
      */
     public Iterator getChildElements() {
-        Iterator childIter = element.getChildren();
+        Iterator childIter = target.getChildren();
         Collection childElements = new ArrayList();
         while (childIter.hasNext()) {
             childElements.add(toSAAJNode((org.w3c.dom.Node)childIter.next()));
@@ -313,7 +290,7 @@ public class SOAPElementImpl extends Nod
       */
     public Iterator getChildElements(Name name) {
         QName qName = new QName(name.getURI(), name.getLocalName());
-        Iterator childIter = element.getChildrenWithName(qName);
+        Iterator childIter = target.getChildrenWithName(qName);
         Collection childElements = new ArrayList();
         while (childIter.hasNext()) {
             childElements.add(toSAAJNode((org.w3c.dom.Node)childIter.next()));
@@ -325,7 +302,7 @@ public class SOAPElementImpl extends Nod
       * @see javax.xml.soap.SOAPElement#getElementName()
       */
     public Name getElementName() {
-        QName qName = element.getQName();
+        QName qName = target.getQName();
         return new PrefixedQName(qName.getNamespaceURI(),
                                  qName.getLocalPart(),
                                  qName.getPrefix());
@@ -344,7 +321,7 @@ public class SOAPElementImpl extends Nod
     public Iterator getNamespacePrefixes() {
         //Get all declared namespace, make a list of their prefixes and return an iterator over that list
         ArrayList prefixList = new ArrayList();
-        Iterator nsIter = element.getAllDeclaredNamespaces();
+        Iterator nsIter = target.getAllDeclaredNamespaces();
         while (nsIter.hasNext()) {
             Object o = nsIter.next();
             if (o instanceof org.apache.axiom.om.OMNamespace) {
@@ -359,7 +336,7 @@ public class SOAPElementImpl extends Nod
       * @see javax.xml.soap.SOAPElement#getNamespaceURI(java.lang.String)
       */
     public String getNamespaceURI(String prefix) {
-        return element.getNamespaceURI(prefix);
+        return target.getNamespaceURI(prefix);
     }
 
     /* (non-Javadoc)
@@ -367,7 +344,7 @@ public class SOAPElementImpl extends Nod
       */
     public Iterator getVisibleNamespacePrefixes() {
         //I'll recursively return all the declared namespaces till this node, including its parents etc.
-        Iterator namespacesIter = element.getAllDeclaredNamespaces();
+        Iterator namespacesIter = target.getAllDeclaredNamespaces();
         ArrayList returnList = new ArrayList();
         while (namespacesIter.hasNext()) {
             Object o = namespacesIter.next();
@@ -381,7 +358,7 @@ public class SOAPElementImpl extends Nod
         //taken care of adding namespaces of this node.
         //now we have to take care of adding the namespaces that are in the scope till the level of
         //this nodes' parent.
-        org.apache.axiom.om.OMContainer parent = element.getParent();
+        org.apache.axiom.om.OMContainer parent = target.getParent();
         if (parent != null && parent instanceof org.apache.axiom.om.OMElement) {
             Iterator parentScopeNamespacesIter =
                     ((org.apache.axiom.om.OMElement)parent).getAllDeclaredNamespaces();
@@ -401,9 +378,9 @@ public class SOAPElementImpl extends Nod
 
     public SOAPElement addAttribute(QName qname, String value) throws SOAPException {
         if (qname.getNamespaceURI() == null || qname.getNamespaceURI().trim().length() == 0) {
-            element.setAttribute(qname.getLocalPart(), value);
+            target.setAttribute(qname.getLocalPart(), value);
         } else {
-            element.setAttributeNS(qname.getNamespaceURI(), qname.getPrefix() + ":" +
+            target.setAttributeNS(qname.getNamespaceURI(), qname.getPrefix() + ":" +
                     qname.getLocalPart(), value);
         }
         return this;
@@ -430,7 +407,7 @@ public class SOAPElementImpl extends Nod
      * @since SAAJ 1.3
      */
     public QName createQName(String localName, String prefix) throws SOAPException {
-        String namespaceURI = element.getNamespaceURI(prefix);
+        String namespaceURI = target.getNamespaceURI(prefix);
         if (namespaceURI == null) {
             throw new SOAPException("Invalid prefix");
         } else {
@@ -439,7 +416,7 @@ public class SOAPElementImpl extends Nod
     }
 
     public Iterator getAllAttributesAsQNames() {
-        final Iterator attribIter = element.getAllAttributes();
+        final Iterator attribIter = target.getAllAttributes();
         Collection attributesAsQNames = new ArrayList();
         Attr attr;
         QName qname;
@@ -453,7 +430,7 @@ public class SOAPElementImpl extends Nod
     }
 
     public String getAttributeValue(QName qname) {
-        final OMAttribute attribute = element.getAttribute(qname);
+        final OMAttribute attribute = target.getAttribute(qname);
         if (attribute == null) {
             return null;
         }
@@ -461,7 +438,7 @@ public class SOAPElementImpl extends Nod
     }
 
     public Iterator getChildElements(QName qname) {
-        Iterator childIter = element.getChildrenWithName(qname);
+        Iterator childIter = target.getChildrenWithName(qname);
         Collection childElements = new ArrayList();
         while (childIter.hasNext()) {
             childElements.add(toSAAJNode((org.w3c.dom.Node)childIter.next()));
@@ -470,29 +447,29 @@ public class SOAPElementImpl extends Nod
     }
 
     public QName getElementQName() {
-        return element.getQName();
+        return target.getQName();
     }
 
     public boolean removeAttribute(QName qname) {
-        org.apache.axiom.om.OMAttribute attr = element.getAttribute(qname);
+        org.apache.axiom.om.OMAttribute attr = target.getAttribute(qname);
         if (attr != null) {
-            element.removeAttribute(attr);
+            target.removeAttribute(attr);
             return true;
         }
         return false;
     }
 
     public SOAPElement setElementQName(QName newName) throws SOAPException {
-        String localName = this.element.getLocalName();
+        String localName = this.target.getLocalName();
         if (org.apache.axiom.soap.SOAPConstants.BODY_LOCAL_NAME.equals(localName)
                 || org.apache.axiom.soap.SOAPConstants.HEADER_LOCAL_NAME.equals(localName)
                 || org.apache.axiom.soap.SOAPConstants.SOAPENVELOPE_LOCAL_NAME .equals(localName)) {
             throw new SOAPException("changing this element name is not allowed");
         }
         OMNamespace omNamespace =
-                getOMFactory().createOMNamespace(newName.getNamespaceURI(), newName.getPrefix());
-        this.element.setNamespace(omNamespace);
-        this.element.setLocalName(newName.getLocalPart());
+                target.getOMFactory().createOMNamespace(newName.getNamespaceURI(), newName.getPrefix());
+        this.target.setNamespace(omNamespace);
+        this.target.setLocalName(newName.getLocalPart());
         return this;
     }
 
@@ -500,11 +477,11 @@ public class SOAPElementImpl extends Nod
       * @see javax.xml.soap.SOAPElement#removeAttribute(javax.xml.soap.Name)
       */
     public boolean removeAttribute(Name name) {
-        org.apache.axiom.om.OMAttribute attr = element.getAttribute(new QName(name.getURI(),
+        org.apache.axiom.om.OMAttribute attr = target.getAttribute(new QName(name.getURI(),
                                                                               name.getLocalName(),
                                                                               name.getPrefix()));
         if (attr != null) {
-            element.removeAttribute(attr);
+            target.removeAttribute(attr);
             return true;
         }
         return false;
@@ -515,7 +492,7 @@ public class SOAPElementImpl extends Nod
       */
     public void removeContents() {
         //We will get all the children and iteratively call the detach() on all of 'em.
-        Iterator childIter = element.getChildElements();
+        Iterator childIter = target.getChildElements();
         while (childIter.hasNext()) {
             childIter.next();
             childIter.remove();
@@ -526,7 +503,7 @@ public class SOAPElementImpl extends Nod
       * @see javax.xml.soap.SOAPElement#removeNamespaceDeclaration(java.lang.String)
       */
     public boolean removeNamespaceDeclaration(String prefix) {
-        return element.removeNamespace(prefix);
+        return target.removeNamespace(prefix);
     }
 
 
@@ -539,7 +516,7 @@ public class SOAPElementImpl extends Nod
      *          the encodingStyle is invalid for this SOAPElement.
      */
     public void setEncodingStyle(String encodingStyle) throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             try {
                 URI uri = new URI(encodingStyle);
                 if (!(this instanceof SOAPEnvelope)) {
@@ -553,7 +530,7 @@ public class SOAPElementImpl extends Nod
                 throw new IllegalArgumentException("Invalid Encoding style : "
                         + encodingStyle + ":" + e);
             }
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             if (this instanceof SOAPHeader || this instanceof SOAPBody ||
                     this instanceof SOAPFault ||
                     this instanceof SOAPFaultElement || this instanceof SOAPEnvelope ||
@@ -567,112 +544,112 @@ public class SOAPElementImpl extends Nod
       * @see org.apache.axiom.om.impl.OMNodeEx#setParent(org.apache.axiom.om.OMContainer)
       */
     public void setParent(OMContainer parentElement) {
-        element.setParent(parentElement);
+        target.setParent(parentElement);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#getAttribute(java.lang.String)
       */
     public String getAttribute(String name) {
-        return element.getAttribute(name);
+        return target.getAttribute(name);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#getAttributeNode(java.lang.String)
       */
     public Attr getAttributeNode(String name) {
-        return element.getAttributeNode(name);
+        return target.getAttributeNode(name);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#getAttributeNodeNS(java.lang.String, java.lang.String)
       */
     public Attr getAttributeNodeNS(String namespaceURI, String localName) {
-        return element.getAttributeNodeNS(namespaceURI, localName);
+        return target.getAttributeNodeNS(namespaceURI, localName);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#getAttributeNS(java.lang.String, java.lang.String)
       */
     public String getAttributeNS(String namespaceURI, String localName) {
-        return element.getAttributeNS(namespaceURI, localName);
+        return target.getAttributeNS(namespaceURI, localName);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#getElementsByTagName(java.lang.String)
       */
     public NodeList getElementsByTagName(String name) {
-        return toSAAJNodeList(element.getElementsByTagName(name));
+        return toSAAJNodeList(target.getElementsByTagName(name));
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, java.lang.String)
       */
     public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
-        return toSAAJNodeList(element.getElementsByTagNameNS(namespaceURI, localName));
+        return toSAAJNodeList(target.getElementsByTagNameNS(namespaceURI, localName));
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#getTagName()
       */
     public String getTagName() {
-        return element.getTagName();
+        return target.getTagName();
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#hasAttribute(java.lang.String)
       */
     public boolean hasAttribute(String name) {
-        return element.hasAttribute(name);
+        return target.hasAttribute(name);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#hasAttributeNS(java.lang.String, java.lang.String)
       */
     public boolean hasAttributeNS(String namespaceURI, String localName) {
-        return element.hasAttributeNS(namespaceURI, localName);
+        return target.hasAttributeNS(namespaceURI, localName);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#removeAttribute(java.lang.String)
       */
     public void removeAttribute(String name) throws DOMException {
-        element.removeAttribute(name);
+        target.removeAttribute(name);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr)
       */
     public Attr removeAttributeNode(Attr attr) throws DOMException {
-        return element.removeAttributeNode(attr);
+        return target.removeAttributeNode(attr);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#removeAttributeNS(java.lang.String, java.lang.String)
       */
     public void removeAttributeNS(String namespaceURI, String localName) throws DOMException {
-        element.removeAttributeNS(namespaceURI, localName);
+        target.removeAttributeNS(namespaceURI, localName);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#setAttribute(java.lang.String, java.lang.String)
       */
     public void setAttribute(String name, String value) throws DOMException {
-        element.setAttribute(name, value);
+        target.setAttribute(name, value);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr)
       */
     public Attr setAttributeNode(Attr attr) throws DOMException {
-        return element.setAttributeNode(attr);
+        return target.setAttributeNode(attr);
     }
 
     /* (non-Javadoc)
       * @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr)
       */
     public Attr setAttributeNodeNS(Attr attr) throws DOMException {
-        return element.setAttributeNodeNS(attr);
+        return target.setAttributeNodeNS(attr);
     }
 
     /* (non-Javadoc)
@@ -680,25 +657,7 @@ public class SOAPElementImpl extends Nod
       */
     public void setAttributeNS(String namespaceURI,
                                String qualifiedName, String value) throws DOMException {
-        element.setAttributeNS(namespaceURI, qualifiedName, value);
-    }
-
-    /* (non-Javadoc)
-      * @see org.w3c.dom.Node#getNodeName()
-      */
-    public String getNodeName() {
-        return element.getNodeName();
-    }
-
-    /* (non-Javadoc)
-      * @see org.w3c.dom.Node#getNodeType()
-      */
-    public short getNodeType() {
-        return Node.ELEMENT_NODE;
-    }
-
-    public ElementImpl getElement() {
-        return element;
+        target.setAttributeNS(namespaceURI, qualifiedName, value);
     }
 
     /**
@@ -712,7 +671,7 @@ public class SOAPElementImpl extends Nod
      */
     public SOAPElement getParentElement() {
         if (this.parentElement == null) {
-            javax.xml.soap.Node parentNode = toSAAJNode(element.getParentNode());
+            javax.xml.soap.Node parentNode = toSAAJNode(target.getParentNode());
             if (parentNode instanceof SOAPElement) {
                 this.parentElement = (SOAPElement) parentNode;
             }
@@ -722,15 +681,7 @@ public class SOAPElementImpl extends Nod
 
     public void setParentElement(SOAPElement parent) throws SOAPException {
         this.parentElement = parent;
-        this.element.setParent(((SOAPElementImpl)parent).element);
-    }
-
-    /**
-     * Find the Document that this Node belongs to (the document in whose context the Node was
-     * created). The Node may or may not
-     */
-    public Document getOwnerDocument() {
-        return element.getOwnerDocument();
+        this.target.setParent(((SOAPElementImpl)parent).target);
     }
 
     /**
@@ -742,10 +693,10 @@ public class SOAPElementImpl extends Nod
      *         <code>null</code> otherwise
      */
     public String getValue() {
-        if (element.getType() == OMNode.TEXT_NODE) {
-            return element.getText();
-        } else if (element.getType() == OMNode.ELEMENT_NODE) {
-            final OMNode firstOMChild = element.getFirstOMChild();
+        if (target.getType() == OMNode.TEXT_NODE) {
+            return target.getText();
+        } else if (target.getType() == OMNode.ELEMENT_NODE) {
+            final OMNode firstOMChild = target.getFirstOMChild();
             if (firstOMChild instanceof TextImpl) {
                 return ((TextImpl)firstOMChild).getData();
             } else if (firstOMChild instanceof SOAPElementImpl) {
@@ -755,33 +706,16 @@ public class SOAPElementImpl extends Nod
         return null;
     }
 
-    public String getTextContent() throws DOMException {
-        return element.getTextContent();
-    }
-
     @Override
     protected Object clone() throws CloneNotSupportedException {
         // TODO Auto-generated method stub
         return super.clone();
     }
 
-    public org.w3c.dom.Node getFirstChild() {
-        return toSAAJNode(element.getFirstChild());
-    }
-
-    /**
-     * Method getLastChild
-     *
-     * @see org.w3c.dom.Node#getLastChild()
-     */
-    public org.w3c.dom.Node getLastChild() {
-        return toSAAJNode(element.getLastChild());
-    }
-
     public Node getParentNode() {
         Node parentNode = null;
         if (this.parentElement == null) {
-            parentNode = toSAAJNode(element.getParentNode());
+            parentNode = toSAAJNode(target.getParentNode());
             if (parentNode instanceof SOAPElement) {
                 this.parentElement = (SOAPElement) parentNode;
             }
@@ -793,27 +727,11 @@ public class SOAPElementImpl extends Nod
 
     /** dom Node method */
     public org.w3c.dom.Node getNextSibling() {
-        return toSAAJNode(element.getNextSibling());
+        return toSAAJNode(target.getNextSibling());
     }
 
     public Node getPreviousSibling() {
-        return toSAAJNode(element.getPreviousSibling());
-    }
-
-    private NodeList toSAAJNodeList(NodeList nodes) {
-        NodeListImpl result = new NodeListImpl();
-        for (int i = 0; i < nodes.getLength(); i++) {
-            result.addNode(toSAAJNode(nodes.item(i)));
-        }
-        return result;
-    }
-
-    public NodeList getChildNodes() {
-        return toSAAJNodeList(element.getChildNodes());
-    }
-
-    public boolean hasChildNodes() {
-        return element.hasChildNodes();
+        return toSAAJNode(target.getPreviousSibling());
     }
 
     /**
@@ -827,7 +745,7 @@ public class SOAPElementImpl extends Nod
      *                               child node or has a child node that is not a Text node
      */
     public void setValue(String value) {
-        OMNode firstChild = element.getFirstOMChild();
+        OMNode firstChild = target.getFirstOMChild();
         if (firstChild == null) {
             try {
                 this.addTextNode(value);
@@ -849,79 +767,15 @@ public class SOAPElementImpl extends Nod
     }
 
     public OMNode detach() {
-        OMNode omNode = this.element.detach();
+        OMNode omNode = this.target.detach();
         this.parentElement = null;
         return omNode;
     }
 
-    /**
-     * Returns the collection of attributes associated with this node, or null if none. At this
-     * writing, Element is the only type of node which will ever have attributes.
-     *
-     * @see org.apache.axiom.om.impl.dom.ElementImpl
-     */
-    public NamedNodeMap getAttributes() {
-        return element.getAttributes();
-    }
-    
     public String toString() {
-        return element.toString();
-    }
-        
-    public Node removeChild(Node oldChild) throws DOMException {
-        if (oldChild instanceof SOAPElementImpl) {
-            oldChild = ((SOAPElementImpl)oldChild).getElement();
-        } else if (oldChild instanceof TextImplEx) {
-            oldChild = ((TextImplEx)oldChild).getTextNode();
-        }
-        return element.removeChild(oldChild);
+        return target.toString();
     }
-    
-    public Node appendChild(Node child) throws DOMException {        
-        if (getOwnerDocument() != child.getOwnerDocument()) {
-            throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, "Wrong document");
-        }
-        try {
-            if (child instanceof Text) {
-                return appendText((Text)child);
-            } else if (child instanceof ElementImpl) {
-                return appendElement((ElementImpl)child);
-            }
-        } catch (SOAPException e) {
-            DOMException ex = 
-                new DOMException(DOMException.HIERARCHY_REQUEST_ERR, e.getMessage());
-            ex.initCause(e);
-            throw ex;
-        }
-        
-        return super.appendChild(child);        
-    }
-    
-    protected Text appendText(Text child) throws SOAPException {
-        String text = child.getData();
-        Text textNode = getOwnerDocument().createTextNode(text);
-        NodeImpl node = ((NodeImpl)element.appendChild(textNode));
-        TextImplEx saajTextNode = new TextImplEx(text, this);
-        node.setUserData(SAAJ_NODE, saajTextNode, null);
-        return saajTextNode;
-    }
-    
-    protected Element appendElement(ElementImpl child) throws SOAPException {
-        String namespaceURI = child.getNamespaceURI();
-        String prefix = child.getPrefix();
-
-        SOAPElementImpl childEle = new SOAPElementImpl(child);
         
-        childEle.element.setUserData(SAAJ_NODE, childEle, null);
-        if (namespaceURI != null && namespaceURI.trim().length() > 0) {
-            childEle.element.setNamespace(childEle.element.declareNamespace(namespaceURI, prefix));
-        }
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
-        childEle.setParentElement(this);
-        return childEle;
-    }
-    
     protected void copyContents(SOAPElementImpl childEle, Node child) throws SOAPException {
         NamedNodeMap attributes = child.getAttributes();
         for (int i = 0; i < attributes.getLength(); i++) {

Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java Mon May 28 18:27:54 2012
@@ -141,14 +141,14 @@ public class SOAPEnvelopeImpl extends SO
         org.apache.axiom.soap.SOAPHeader header = omSOAPEnvelope.getHeader();
         if (header == null) {
             SOAPHeaderImpl saajSOAPHeader;
-            if (this.element.getOMFactory() instanceof SOAP11Factory) {
+            if (this.target.getOMFactory() instanceof SOAP11Factory) {
                 header = new SOAP11HeaderImpl(omSOAPEnvelope,
-                                              (SOAPFactory)this.element.getOMFactory());
+                                              (SOAPFactory)this.target.getOMFactory());
                 saajSOAPHeader = new SOAPHeaderImpl(header);
                 saajSOAPHeader.setParentElement(this);
             } else {
                 header = new SOAP12HeaderImpl(omSOAPEnvelope,
-                                              (SOAPFactory)this.element.getOMFactory());
+                                              (SOAPFactory)this.target.getOMFactory());
                 saajSOAPHeader = new SOAPHeaderImpl(header);
                 saajSOAPHeader.setParentElement(this);
             }
@@ -175,7 +175,7 @@ public class SOAPEnvelopeImpl extends SO
     public SOAPBody addBody() throws SOAPException {
         org.apache.axiom.soap.SOAPBody body = omSOAPEnvelope.getBody();
         if (body == null) {
-            body = new SOAP11BodyImpl(omSOAPEnvelope, (SOAPFactory)this.element.getOMFactory());
+            body = new SOAP11BodyImpl(omSOAPEnvelope, (SOAPFactory)this.target.getOMFactory());
             SOAPBodyImpl saajSOAPBody = new SOAPBodyImpl(body);
             saajSOAPBody.setParentElement(this);
             ((NodeImpl)omSOAPEnvelope.getBody()).setUserData(SAAJ_NODE, saajSOAPBody, null);
@@ -187,15 +187,15 @@ public class SOAPEnvelopeImpl extends SO
     }
 
     public SOAPElement addTextNode(String text) throws SOAPException {
-        Node firstChild = element.getFirstChild();
+        Node firstChild = target.getFirstChild();
         if (firstChild instanceof org.w3c.dom.Text) {
             ((org.w3c.dom.Text)firstChild).setData(text);
         } else {
             // Else this is a header
-            TextImpl doomText = new TextImpl(text, this.element.getOMFactory());
+            TextImpl doomText = new TextImpl(text, this.target.getOMFactory());
             doomText.setNextOMSibling((OMNode)firstChild);
             doomText.setPreviousOMSibling(null);
-            element.setFirstChild(doomText);
+            target.setFirstChild(doomText);
             ((ChildNode)firstChild).setPreviousOMSibling(doomText);
         }
         return this;
@@ -206,7 +206,7 @@ public class SOAPEnvelopeImpl extends SO
      * on Envelop
      */
     public SOAPElement addAttribute(Name name, String value) throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        if (this.target.getOMFactory() instanceof SOAP12Factory) {
             if ("encodingStyle".equals(name.getLocalName())) {
                 throw new SOAPException(
                         "SOAP1.2 does not allow encodingStyle attribute to be set " +
@@ -221,9 +221,9 @@ public class SOAPEnvelopeImpl extends SO
      * element
      */
     public SOAPElement addChildElement(Name name) throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        if (this.target.getOMFactory() instanceof SOAP12Factory) {
             throw new SOAPException("Cannot add elements after body element");
-        } else if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP11Factory) {
             //Let elements to be added any where.
             return super.addChildElement(name);
         }

Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java Mon May 28 18:27:54 2012
@@ -73,7 +73,7 @@ public class SOAPFaultImpl extends SOAPB
     }
 
     void setDefaults() throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             setFaultCode(SOAP11Constants.QNAME_SENDER_FAULTCODE);
         } else {
             setFaultCode(SOAP12Constants.QNAME_SENDER_FAULTCODE);
@@ -121,12 +121,12 @@ public class SOAPFaultImpl extends SOAPB
 //        		localName = faultCode.substring(faultCode.indexOf(":")+1);
 //        	}
 
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
-            soapFactory = (SOAP11Factory)this.element.getOMFactory();
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
+            soapFactory = (SOAP11Factory)this.target.getOMFactory();
             soapFaultCode = soapFactory.createSOAPFaultCode(fault);
             soapFaultCode.setText(faultCode);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
-            soapFactory = (SOAP12Factory)this.element.getOMFactory();
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
+            soapFactory = (SOAP12Factory)this.target.getOMFactory();
             soapFaultCode = soapFactory.createSOAPFaultCode(fault);
             SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode);
             soapFaultCode.setValue(soapFaultValue);
@@ -144,9 +144,9 @@ public class SOAPFaultImpl extends SOAPB
      */
     public String getFaultCode() {
         if (fault != null && fault.getCode() != null) {
-            if (this.element.getOMFactory() instanceof SOAP11Factory) {
+            if (this.target.getOMFactory() instanceof SOAP11Factory) {
                 return fault.getCode().getText();
-            } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+            } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
                 return fault.getCode().getValue().getText();
             } else {
                 return null;
@@ -168,10 +168,10 @@ public class SOAPFaultImpl extends SOAPB
      */
     public void setFaultActor(String faultActor) throws SOAPException {
 
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             if (this.fault.getRole() == null) {
                 SOAP11FaultRoleImpl faultRoleImpl = new SOAP11FaultRoleImpl(
-                        this.fault, (SOAPFactory)this.element.getOMFactory());
+                        this.fault, (SOAPFactory)this.target.getOMFactory());
 
                 faultRoleImpl.setRoleValue(faultActor);
                 this.fault.setRole(faultRoleImpl);
@@ -179,10 +179,10 @@ public class SOAPFaultImpl extends SOAPB
                 SOAPFaultRole role = this.fault.getRole();
                 role.setRoleValue(faultActor);
             }
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             if (this.fault.getRole() == null) {
                 SOAP12FaultRoleImpl faultRoleImpl = new SOAP12FaultRoleImpl(
-                        this.fault, (SOAPFactory)this.element.getOMFactory());
+                        this.fault, (SOAPFactory)this.target.getOMFactory());
 
                 faultRoleImpl.setRoleValue(faultActor);
                 this.fault.setRole(faultRoleImpl);
@@ -212,9 +212,9 @@ public class SOAPFaultImpl extends SOAPB
      * @see #getFaultString() getFaultString()
      */
     public void setFaultString(String faultString) throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             setFaultString(faultString, null);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             setFaultString(faultString, Locale.getDefault());
         }
     }
@@ -282,7 +282,7 @@ public class SOAPFaultImpl extends SOAPB
         }
 
         SOAPFaultDetail omDetail;
-        SOAPFactory factory = (SOAPFactory)this.element.getOMFactory();
+        SOAPFactory factory = (SOAPFactory)this.target.getOMFactory();
         if (factory instanceof SOAP11Factory) {
             omDetail = new SOAP11FaultDetailImpl(this.fault,
                                                  factory);
@@ -318,18 +318,18 @@ public class SOAPFaultImpl extends SOAPB
     public void setFaultString(String faultString, Locale locale) throws SOAPException {
         if (this.fault.getReason() != null) {
             SOAPFaultReason reason = this.fault.getReason();
-            if (this.element.getOMFactory() instanceof SOAP11Factory) {
+            if (this.target.getOMFactory() instanceof SOAP11Factory) {
                 reason.setText(faultString);
-            } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+            } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
                 addFaultReasonText(faultString, locale);
             }
         } else {
-            if (this.element.getOMFactory() instanceof SOAP11Factory) {
+            if (this.target.getOMFactory() instanceof SOAP11Factory) {
                 SOAPFaultReason reason = new SOAP11FaultReasonImpl(this.fault,
-                                                                   (SOAPFactory)this.element
+                                                                   (SOAPFactory)this.target
                                                                            .getOMFactory());
                 reason.setText(faultString);
-            } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+            } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
                 addFaultReasonText(faultString, locale);
             }
         }
@@ -349,9 +349,9 @@ public class SOAPFaultImpl extends SOAPB
      * @since SAAJ 1.2
      */
     public Locale getFaultStringLocale() {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             return this.faultReasonLocale;
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             Locale locale = null;
             try {
                 if (getFaultReasonLocales().hasNext()) {
@@ -384,15 +384,15 @@ public class SOAPFaultImpl extends SOAPB
         if (locale == null) {
             throw new SOAPException("Received null for locale");
         }
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException("Not supported in SOAP 1.1");
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             removeDefaults();
             
             String existingReasonText = getFaultReasonText(locale);
             if (existingReasonText == null) {
                 org.apache.axiom.soap.SOAPFactory soapFactory = null;
-                soapFactory = (SOAP12Factory)this.element.getOMFactory();
+                soapFactory = (SOAP12Factory)this.target.getOMFactory();
                 if (this.fault.getReason() == null) {
                     SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason(this.fault);
                     this.fault.setReason(soapFaultReason);
@@ -436,9 +436,9 @@ public class SOAPFaultImpl extends SOAPB
         if (subcode.getNamespaceURI() == null || subcode.getNamespaceURI().trim().length() == 0) {
             throw new SOAPException("Unqualified QName object : " + subcode);
         }
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException();
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             soapFactory = DOOMAbstractFactory.getSOAP12Factory();
         }
 
@@ -480,7 +480,7 @@ public class SOAPFaultImpl extends SOAPB
     public QName getFaultCodeAsQName() {
         SOAPFaultCode soapFaultCode = this.fault.getCode();
         if (soapFaultCode != null) {
-            if (this.element.getOMFactory() instanceof SOAP11Factory) {
+            if (this.target.getOMFactory() instanceof SOAP11Factory) {
                 return soapFaultCode.getTextAsQName();
             } else {
                 return soapFaultCode.getValue().getTextAsQName();
@@ -498,7 +498,7 @@ public class SOAPFaultImpl extends SOAPB
      *          - if this message does not support the SOAP 1.2 concept of Fault Node.
      */
     public String getFaultNode() {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException("Message does not support the " +
                     "SOAP 1.2 concept of Fault Node");
         } else {
@@ -523,7 +523,7 @@ public class SOAPFaultImpl extends SOAPB
      * @since SAAJ 1.3
      */
     public Iterator getFaultReasonLocales() throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException("Message does not support the " +
                     "SOAP 1.2 concept of Fault Reason");
         } else {
@@ -563,7 +563,7 @@ public class SOAPFaultImpl extends SOAPB
      * @since SAAJ 1.3
      */
     public String getFaultReasonText(Locale locale) throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException("Message does not support the " +
                     "SOAP 1.2 concept of Fault Reason");
         } else {
@@ -595,7 +595,7 @@ public class SOAPFaultImpl extends SOAPB
      */
 
     public Iterator getFaultReasonTexts() throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException();
         }
 
@@ -618,7 +618,7 @@ public class SOAPFaultImpl extends SOAPB
      * @since SAAJ 1.3
      */
     public String getFaultRole() {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException("Message does not support the " +
                     "SOAP 1.2 concept of Fault Reason");
         } else {
@@ -640,7 +640,7 @@ public class SOAPFaultImpl extends SOAPB
      *          - if this message does not support the SOAP 1.2 concept of Subcode.
      */
     public Iterator getFaultSubcodes() {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException();
         }
         ArrayList faultSubcodes = new ArrayList();
@@ -671,7 +671,7 @@ public class SOAPFaultImpl extends SOAPB
      *          - if this message does not support the SOAP 1.2 concept of Subcode.
      */
     public void removeAllFaultSubcodes() {
-        if (factory instanceof SOAP11Factory) {
+        if (target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException();
         } else {
             fault.getCode().getSubCode().detach();
@@ -697,15 +697,15 @@ public class SOAPFaultImpl extends SOAPB
         }
 
         org.apache.axiom.soap.SOAPFactory soapFactory = null;
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
-            soapFactory = (SOAPFactory)this.element.getOMFactory();
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
+            soapFactory = (SOAPFactory)this.target.getOMFactory();
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             if (!(qname.getNamespaceURI()
                     .equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE))) {
                 throw new SOAPException("Incorrect URI"
                         + qname.getNamespaceURI());
             }
-            soapFactory = (SOAPFactory)this.element.getOMFactory();
+            soapFactory = (SOAPFactory)this.target.getOMFactory();
         } else {
             throw new SOAPException("Invalid SOAP version");
         }
@@ -715,7 +715,7 @@ public class SOAPFaultImpl extends SOAPB
                 .equals("")) ? qname.getPrefix() : this.fault.getQName()
                 .getPrefix();
 
-        OMFactory factory = element.getOMFactory();
+        OMFactory factory = target.getOMFactory();
         if (factory instanceof SOAP11Factory) {
             soapFaultCode.setText(prefix + ":" + qname.getLocalPart());
             OMNamespace omNamespace = factory.createOMNamespace(qname.getNamespaceURI(),
@@ -746,10 +746,10 @@ public class SOAPFaultImpl extends SOAPB
 
     public void setFaultNode(String s) throws SOAPException {
         org.apache.axiom.soap.SOAPFactory soapFactory = null;
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException("message does not support " +
                     "the SOAP 1.2 concept of Fault Node");
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             soapFactory = DOOMAbstractFactory.getSOAP12Factory();
         }
         SOAPFaultNode soapFaultNode = soapFactory.createSOAPFaultNode(this.fault);
@@ -768,10 +768,10 @@ public class SOAPFaultImpl extends SOAPB
      */
     public void setFaultRole(String uri) throws SOAPException {
         org.apache.axiom.soap.SOAPFactory soapFactory = null;
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException("message does not support the " +
                     "SOAP 1.2 concept of Fault Role");
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
+        } else if (this.target.getOMFactory() instanceof SOAP12Factory) {
             soapFactory = DOOMAbstractFactory.getSOAP12Factory();
         }
         SOAPFaultRole soapFaultRole = soapFactory.createSOAPFaultRole(this.fault);
@@ -781,11 +781,11 @@ public class SOAPFaultImpl extends SOAPB
 
     public Iterator getChildElements(Name name) {
         QName qName = new QName(name.getURI(), name.getLocalName());
-        return getChildren(element.getChildrenWithName(qName));
+        return getChildren(target.getChildrenWithName(qName));
     }
 
     public Iterator getChildElements() {
-        return getChildren(element.getChildren());
+        return getChildren(target.getChildren());
     }
 
     private Iterator getChildren(Iterator childIter) {

Modified: axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java?rev=1343353&r1=1343352&r2=1343353&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java (original)
+++ axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java Mon May 28 18:27:54 2012
@@ -99,7 +99,7 @@ public class SOAPHeaderElementImpl exten
      *                       - if this message does not support the SOAP 1.2 concept of Fault Role.
      */
     public void setRole(String uri) throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException();
         } else {
             this.headerElem.setRole(uri);
@@ -107,7 +107,7 @@ public class SOAPHeaderElementImpl exten
     }
 
     public String getRole() {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException();
         } else {
             return this.headerElem.getRole();
@@ -128,7 +128,7 @@ public class SOAPHeaderElementImpl exten
      *                       support the SOAP 1.2 concept of Relay attribute.
      */
     public void setRelay(boolean flag) throws SOAPException {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException();
         } else {
             this.headerElem.setRelay(flag);
@@ -136,7 +136,7 @@ public class SOAPHeaderElementImpl exten
     }
 
     public boolean getRelay() {
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
+        if (this.target.getOMFactory() instanceof SOAP11Factory) {
             throw new UnsupportedOperationException();
         } else {
             return this.headerElem.getRelay();