axis-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1377526 [1/3] - in /axis/axis2/java/core/branches/1_6: ./ modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/ modules/saaj/ modules/saaj/src/org/apache/axis2/saaj/ modules/saaj/src/org/apache/axis2/saaj/util/ modules/saaj/test/org/...
Date Sun, 26 Aug 2012 21:42:36 GMT
Author: veithen
Date: Sun Aug 26 21:42:35 2012
New Revision: 1377526

URL: http://svn.apache.org/viewvc?rev=1377526&view=rev
Log:
Merged a couple of changes to the 1.6 branch to increase compatibility with Axiom 1.2.14.

Added:
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java
      - copied, changed from r1343353, axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java
Removed:
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/NodeImplEx.java
Modified:
    axis/axis2/java/core/branches/1_6/   (props changed)
    axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/   (props changed)
    axis/axis2/java/core/branches/1_6/modules/saaj/pom.xml
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailEntryImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyElementImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPFactoryImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultElementImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java
    axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java
    axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
    axis/axis2/java/core/branches/1_6/modules/saaj/test/org/apache/axis2/saaj/integration/IntegrationTest.java

Propchange: axis/axis2/java/core/branches/1_6/
------------------------------------------------------------------------------
  Merged /axis/axis2/java/core/trunk:r1343353,1348340

Modified: axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/jaxws/src/org/apache/axis2/jaxws/message/util/impl/SAAJConverterImpl.java Sun Aug 26 21:42:35 2012
@@ -21,10 +21,8 @@ package org.apache.axis2.jaxws.message.u
 
 import org.apache.axiom.attachments.Attachments;
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.impl.dom.ElementImpl;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
@@ -631,8 +629,8 @@ public class SAAJConverterImpl implement
                         // get that and add it as a text node under the original element.
                         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();
+                            org.apache.axis2.saaj.SOAPElementImpl<?> valueElement = (org.apache.axis2.saaj.SOAPElementImpl<?>) value;
+                            OMElement e = valueElement.getOMTarget();
                             String content = e.getText();
                             
                             SOAPElement child = fault.addChildElement(new QName(se.getNamespaceURI(), SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME));
@@ -656,8 +654,8 @@ public class SAAJConverterImpl implement
                         // get that and add it as a text node under the original element.
                         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();
+                            org.apache.axis2.saaj.SOAPElementImpl<?> valueElement = (org.apache.axis2.saaj.SOAPElementImpl<?>) value;
+                            OMElement e = valueElement.getOMTarget();
                             String content = e.getText();
                            
                             SOAPElement child = fault.addChildElement(new QName(se.getNamespaceURI(), SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME));

Propchange: axis/axis2/java/core/branches/1_6/modules/saaj/
------------------------------------------------------------------------------
  Merged /axis/axis2/java/core/trunk/modules/saaj:r1328733,1331561,1338816,1343353,1343399,1348340,1360338

Modified: axis/axis2/java/core/branches/1_6/modules/saaj/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/pom.xml?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/pom.xml (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/pom.xml Sun Aug 26 21:42:35 2012
@@ -44,6 +44,7 @@
         <dependency>
             <groupId>org.apache.ws.commons.axiom</groupId>
             <artifactId>axiom-dom</artifactId>
+            <scope>runtime</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.axis2</groupId>

Modified: axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/AttachmentPartImpl.java Sun Aug 26 21:42:35 2012
@@ -19,10 +19,8 @@
 
 package org.apache.axis2.saaj;
 
+import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
-import org.apache.axiom.om.impl.dom.DocumentImpl;
-import org.apache.axiom.om.impl.dom.TextImpl;
 import org.apache.axiom.om.util.Base64;
 import org.apache.axis2.saaj.util.SAAJDataSource;
 import org.apache.axis2.transport.http.HTTPConstants;
@@ -284,7 +282,7 @@ public class AttachmentPartImpl extends 
         if (datahandler != null) {
             this.dataHandler = datahandler;
             setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE, datahandler.getContentType());
-            omText = DOOMAbstractFactory.getOMFactory().createOMText(datahandler, true);
+            omText = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory().createOMText(datahandler, true);
         } else {
             throw new IllegalArgumentException("Cannot set null DataHandler");
         }
@@ -528,10 +526,6 @@ public class AttachmentPartImpl extends 
         return omText;
     }
 
-    public TextImpl getText(DocumentImpl doc) {
-        return new TextImpl(doc, omText.getText(), doc.getOMFactory());
-    }
-
     /**
      * Set the filename of this attachment part.
      *

Modified: axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/CommentImpl.java Sun Aug 26 21:42:35 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/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailEntryImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailEntryImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailEntryImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailEntryImpl.java Sun Aug 26 21:42:35 2012
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.OMElement;
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.DetailEntry;
@@ -32,10 +32,10 @@ import java.util.Iterator;
  * which carries information about errors related to the SOAPBody  object that contains it, is
  * application-specific.
  */
-public class DetailEntryImpl extends SOAPElementImpl implements DetailEntry {
+public class DetailEntryImpl extends SOAPElementImpl<OMElement> implements DetailEntry {
 
     /** @param element  */
-    public DetailEntryImpl(ElementImpl element) {
+    public DetailEntryImpl(OMElement element) {
         super(element);
     }
 

Modified: axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/DetailImpl.java Sun Aug 26 21:42:35 2012
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAPFaultDetail;
 
 import javax.xml.namespace.QName;
@@ -52,14 +52,11 @@ import java.util.Iterator;
  * "http://www.wombat.org/trader"); d.addDetailEntry(name); Iterator it = d.getDetailEntries();
  * </PRE>
  */
-public class DetailImpl extends SOAPFaultElementImpl implements Detail {
-
-//    private SOAPFaultDetail faultDetail;
+public class DetailImpl extends SOAPFaultElementImpl<SOAPFaultDetail> implements Detail {
 
     /** @param element  */
     public DetailImpl(SOAPFaultDetail element) {
-        super((ElementImpl)element);
-//        faultDetail = element;
+        super(element);
     }
 
     /**
@@ -72,9 +69,9 @@ public class DetailImpl extends SOAPFaul
      *                       Detail object.
      */
     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);
+        SOAPElementImpl<?> childElement = (SOAPElementImpl<?>)addChildElement(name);
+        DetailEntryImpl detailEntry = new DetailEntryImpl(childElement.omTarget);
+        childElement.target.setUserData(SAAJ_NODE, detailEntry, null);
         return detailEntry;
     }
 
@@ -85,10 +82,10 @@ public class DetailImpl extends SOAPFaul
      *         <code>Detail</code> object
      */
     public Iterator getDetailEntries() {
-        final Iterator detailEntriesIter = element.getChildElements();
+        final Iterator detailEntriesIter = omTarget.getChildElements();
         Collection details = new ArrayList();
         while (detailEntriesIter.hasNext()) {
-            details.add(new DetailEntryImpl((ElementImpl)detailEntriesIter.next()));
+            details.add(new DetailEntryImpl((OMElement)detailEntriesIter.next()));
         }
         return details.iterator();
     }
@@ -101,9 +98,9 @@ public class DetailImpl extends SOAPFaul
      *                       Detail object.
      */
     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);
+        SOAPElementImpl<?> childElement = (SOAPElementImpl<?>)addChildElement(qname);
+        DetailEntryImpl detailEntry = new DetailEntryImpl(childElement.omTarget);
+        childElement.target.setUserData(SAAJ_NODE, detailEntry, null);
         return detailEntry;
     }
 

Modified: axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/MessageFactoryImpl.java Sun Aug 26 21:42:35 2012
@@ -19,8 +19,10 @@
 
 package org.apache.axis2.saaj;
 
-import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
-import org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.w3c.dom.Element;
 
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.MimeHeaders;
@@ -96,19 +98,19 @@ public class MessageFactoryImpl extends 
      *                       protocol of this MessageFactory instance is DYNAMIC_SOAP_PROTOCOL
      */
     public SOAPMessage createMessage() throws SOAPException {
-        org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl soapEnvelope;
+        OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM);
+        SOAPEnvelope soapEnvelope;
         if (soapVersion.equals(SOAPConstants.SOAP_1_2_PROTOCOL)) {
-            soapEnvelope = (org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl)
-                            new SOAP12Factory().getDefaultEnvelope();
+            soapEnvelope = metaFactory.getSOAP12Factory().getDefaultEnvelope();
         } else if (soapVersion.equals(SOAPConstants.DYNAMIC_SOAP_PROTOCOL)) {
             throw new UnsupportedOperationException("createMessage() is not supported for " +
                     "DYNAMIC_SOAP_PROTOCOL");
         } else {
             //SOAP 1.1
-            soapEnvelope = (org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl)
-                            new SOAP11Factory().getDefaultEnvelope();
+            soapEnvelope = metaFactory.getSOAP11Factory().getDefaultEnvelope();
         }
-        soapEnvelope.getOwnerDocument().appendChild(soapEnvelope);
+        Element domSoapEnvelope = (Element)soapEnvelope;
+        domSoapEnvelope.getOwnerDocument().appendChild(domSoapEnvelope);
         SOAPMessageImpl soapMessage = new SOAPMessageImpl(new SOAPEnvelopeImpl(soapEnvelope));
         soapMessage.setSaveRequired();
         return soapMessage;

Copied: axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java (from r1343353, axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java)
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java?p2=axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java&p1=axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java&r1=1343353&r2=1377526&rev=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SAAJNode.java Sun Aug 26 21:42:35 2012
@@ -23,11 +23,13 @@ import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 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;
-import org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Comment;
 import org.w3c.dom.DOMException;
@@ -48,19 +50,25 @@ 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 SAAJNode<T extends org.w3c.dom.Node> implements Node {
+public abstract class SAAJNode<T extends org.w3c.dom.Node, S extends OMNode> implements Node {
     protected final T target;
+    protected final S omTarget;
     protected SOAPElement parentElement;
     static final String SAAJ_NODE = "saaj.node";
 
-    public SAAJNode(T target) {
+    public SAAJNode(T target, S omTarget) {
         this.target = target;
+        this.omTarget = omTarget;
     }
 
     public final T getTarget() {
         return target;
     }
 
+    public final S getOMTarget() {
+        return omTarget;
+    }
+
     /**
      * Removes this <code>Node</code> object from the tree. Once removed, this node can be garbage
      * collected if there are no application references to it.
@@ -165,7 +173,7 @@ public abstract class SAAJNode<T extends
         if (domNode == null) {
             return null;
         }
-        Node saajNode = (Node)((NodeImpl)domNode).getUserData(SAAJ_NODE);
+        Node saajNode = (Node)domNode.getUserData(SAAJ_NODE);
         if (saajNode == null) {  // if SAAJ node has not been set in userData, try to construct it
             return toSAAJNode2(domNode, parentNode);
         }
@@ -190,77 +198,62 @@ public abstract class SAAJNode<T extends
             Text text = (Text)domNode;
             org.w3c.dom.Node prevSiblingDOMNode = text.getPreviousSibling();
             org.w3c.dom.Node nextSiblingDOMNode = text.getNextSibling();
-            SOAPElementImpl parent = new SOAPElementImpl((ElementImpl)domNode.getParentNode());
+            SOAPElementImpl<OMElement> parent = new SOAPElementImpl<OMElement>((OMElement)domNode.getParentNode());
             TextImplEx saajTextNode =
                     new TextImplEx(text.getData(), parent, prevSiblingDOMNode, nextSiblingDOMNode);
-            ((NodeImpl)domNode).setUserData(SAAJ_NODE, saajTextNode, null);
+            domNode.setUserData(SAAJ_NODE, saajTextNode, null);
             return saajTextNode;
         } else if (domNode instanceof org.w3c.dom.Comment) {
             Comment comment = (Comment)domNode;
             org.w3c.dom.Node prevSiblingDOMNode = comment.getPreviousSibling();
             org.w3c.dom.Node nextSiblingDOMNode = comment.getNextSibling();
-            SOAPElementImpl parent = new SOAPElementImpl((ElementImpl)domNode.getParentNode());
+            SOAPElementImpl<OMElement> parent = new SOAPElementImpl<OMElement>((OMElement)domNode.getParentNode());
             CommentImpl saajTextNode = new CommentImpl(comment.getData(),
                                                      parent, prevSiblingDOMNode,
                                                      nextSiblingDOMNode);
-            ((NodeImpl)domNode).setUserData(SAAJ_NODE, saajTextNode, null);
+            domNode.setUserData(SAAJ_NODE, saajTextNode, null);
             return saajTextNode;
-        } else if (domNode instanceof org.apache.axiom.soap.impl.dom.SOAPBodyImpl) {
-            org.apache.axiom.soap.impl.dom.SOAPBodyImpl doomSOAPBody = (SOAPBodyImpl)domNode;
+        } else if (domNode instanceof SOAPBody) {
             javax.xml.soap.SOAPBody saajSOAPBody =
-                    new org.apache.axis2.saaj.SOAPBodyImpl(doomSOAPBody);
-            doomSOAPBody.setUserData(SAAJ_NODE, saajSOAPBody, null);
+                    new org.apache.axis2.saaj.SOAPBodyImpl((SOAPBody)domNode);
+            domNode.setUserData(SAAJ_NODE, saajSOAPBody, null);
             return saajSOAPBody;
-        } else if (domNode instanceof org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl) {
-            org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl doomSOAPEnv
-                    = (SOAPEnvelopeImpl)domNode;
+        } else if (domNode instanceof SOAPEnvelope) {
             javax.xml.soap.SOAPEnvelope saajEnvelope
-                    = new org.apache.axis2.saaj.SOAPEnvelopeImpl(doomSOAPEnv);
-            doomSOAPEnv.setUserData(SAAJ_NODE, saajEnvelope, null);
+                    = new org.apache.axis2.saaj.SOAPEnvelopeImpl((SOAPEnvelope)domNode);
+            domNode.setUserData(SAAJ_NODE, saajEnvelope, null);
             return saajEnvelope;
-        } else if (domNode instanceof org.apache.axiom.soap.impl.dom.SOAPFaultNodeImpl) {
-            org.apache.axiom.soap.impl.dom.SOAPFaultNodeImpl doomSOAPFaultNode
-                    = (org.apache.axiom.soap.impl.dom.SOAPFaultNodeImpl)domNode;
+        } else if (domNode instanceof SOAPFaultNode) {
             javax.xml.soap.SOAPFaultElement saajSOAPFaultEle
-                    = new org.apache.axis2.saaj.SOAPFaultElementImpl(doomSOAPFaultNode);
-            doomSOAPFaultNode.setUserData(SAAJ_NODE, saajSOAPFaultEle, null);
+                    = new org.apache.axis2.saaj.SOAPFaultElementImpl<SOAPFaultNode>((SOAPFaultNode)domNode);
+            domNode.setUserData(SAAJ_NODE, saajSOAPFaultEle, null);
             return saajSOAPFaultEle;
-        } else if (domNode instanceof org.apache.axiom.soap.impl.dom.SOAPFaultDetailImpl) {
-            org.apache.axiom.soap.impl.dom.SOAPFaultDetailImpl doomSOAPFaultDetail
-                    = (org.apache.axiom.soap.impl.dom.SOAPFaultDetailImpl)domNode;
+        } else if (domNode instanceof SOAPFaultDetail) {
             javax.xml.soap.Detail saajDetail
-                    = new org.apache.axis2.saaj.DetailImpl(doomSOAPFaultDetail);
-            doomSOAPFaultDetail.setUserData(SAAJ_NODE, saajDetail, null);
+                    = new org.apache.axis2.saaj.DetailImpl((SOAPFaultDetail)domNode);
+            domNode.setUserData(SAAJ_NODE, saajDetail, null);
             return saajDetail;
-        } else if (domNode instanceof org.apache.axiom.soap.impl.dom.SOAPFaultImpl) {
-            org.apache.axiom.soap.impl.dom.SOAPFaultImpl doomSOAPFault
-                    = (org.apache.axiom.soap.impl.dom.SOAPFaultImpl)domNode;
+        } else if (domNode instanceof SOAPFault) {
             javax.xml.soap.SOAPFault saajSOAPFault
-                    = new org.apache.axis2.saaj.SOAPFaultImpl(doomSOAPFault);
-            doomSOAPFault.setUserData(SAAJ_NODE, saajSOAPFault, null);
+                    = new org.apache.axis2.saaj.SOAPFaultImpl((SOAPFault)domNode);
+            domNode.setUserData(SAAJ_NODE, saajSOAPFault, null);
             return saajSOAPFault;
-        } else if (domNode instanceof org.apache.axiom.soap.impl.dom.SOAPHeaderBlockImpl) {
-            org.apache.axiom.soap.impl.dom.SOAPHeaderBlockImpl doomSOAPHeaderBlock
-                    = (org.apache.axiom.soap.impl.dom.SOAPHeaderBlockImpl)domNode;
+        } else if (domNode instanceof SOAPHeaderBlock) {
             javax.xml.soap.SOAPHeaderElement saajSOAPHeaderEle
-                    = new org.apache.axis2.saaj.SOAPHeaderElementImpl(doomSOAPHeaderBlock);
-            doomSOAPHeaderBlock.setUserData(SAAJ_NODE, saajSOAPHeaderEle, null);
+                    = new org.apache.axis2.saaj.SOAPHeaderElementImpl((SOAPHeaderBlock)domNode);
+            domNode.setUserData(SAAJ_NODE, saajSOAPHeaderEle, null);
             return saajSOAPHeaderEle;
-        } else if (domNode instanceof org.apache.axiom.soap.impl.dom.SOAPHeaderImpl) {
-            org.apache.axiom.soap.impl.dom.SOAPHeaderImpl doomSOAPHeader
-                    = (org.apache.axiom.soap.impl.dom.SOAPHeaderImpl)domNode;
+        } else if (domNode instanceof SOAPHeader) {
             javax.xml.soap.SOAPHeader saajSOAPHeader
-                    = new org.apache.axis2.saaj.SOAPHeaderImpl(doomSOAPHeader);
-            doomSOAPHeader.setUserData(SAAJ_NODE, saajSOAPHeader, null);
+                    = new org.apache.axis2.saaj.SOAPHeaderImpl((SOAPHeader)domNode);
+            domNode.setUserData(SAAJ_NODE, saajSOAPHeader, null);
             return saajSOAPHeader;
-        } else if (domNode instanceof org.apache.axiom.om.impl.dom.DocumentImpl) {
+        } else if (domNode instanceof Document) {
             
             // Must be a SOAPEnvelope
             if (!(parentNode instanceof org.apache.axis2.saaj.SOAPEnvelopeImpl)) {
                 return null;
             }
-            org.apache.axiom.om.impl.dom.DocumentImpl doomDocument
-                = (org.apache.axiom.om.impl.dom.DocumentImpl)domNode;
             org.apache.axis2.saaj.SOAPEnvelopeImpl saajEnv = 
                 (org.apache.axis2.saaj.SOAPEnvelopeImpl) parentNode;
             javax.xml.soap.SOAPPart saajSOAPPart = null;
@@ -278,9 +271,8 @@ public abstract class SAAJNode<T extends
             domNode.setUserData(SAAJ_NODE, saajSOAPPart, null);
             return saajSOAPPart;
         } else { // instanceof org.apache.axis2.om.impl.dom.ElementImpl
-            ElementImpl doomElement = (ElementImpl)domNode;
-            SOAPElementImpl saajSOAPElement = new SOAPElementImpl(doomElement);
-            doomElement.setUserData(SAAJ_NODE, saajSOAPElement, null);
+            SOAPElementImpl<OMElement> saajSOAPElement = new SOAPElementImpl<OMElement>((OMElement)domNode);
+            domNode.setUserData(SAAJ_NODE, saajSOAPElement, null);
             return saajSOAPElement;
         }
     }
@@ -372,7 +364,7 @@ public abstract class SAAJNode<T extends
 
     public final org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild) throws DOMException {
         if (oldChild instanceof SAAJNode) {
-            oldChild = ((SAAJNode<?>)oldChild).getTarget();
+            oldChild = ((SAAJNode<?,?>)oldChild).getTarget();
         }
         return target.removeChild(oldChild);
     }
@@ -432,8 +424,8 @@ public abstract class SAAJNode<T extends
         try {
             if (child instanceof Text) {
                 return appendText((Text)child);
-            } else if (child instanceof ElementImpl) {
-                return appendElement((ElementImpl)child);
+            } else if (child instanceof Element) {
+                return appendElement((Element)child);
             }
         } catch (SOAPException e) {
             DOMException ex = 
@@ -442,32 +434,30 @@ public abstract class SAAJNode<T extends
             throw ex;
         }
         throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                DOMMessageFormatter.formatMessage(
-                        DOMMessageFormatter.DOM_DOMAIN,
-                        DOMException.HIERARCHY_REQUEST_ERR, null));
+                "An attempt was made to insert a node where it is not permitted.");
     }
 
     protected Text appendText(Text child) throws SOAPException {
         String text = child.getData();
         Text textNode = getOwnerDocument().createTextNode(text);
-        NodeImpl node = ((NodeImpl)target.appendChild(textNode));
+        target.appendChild(textNode);
         TextImplEx saajTextNode = new TextImplEx(text, (SOAPElement)this);
-        node.setUserData(SAAJ_NODE, saajTextNode, null);
+        textNode.setUserData(SAAJ_NODE, saajTextNode, null);
         return saajTextNode;
     }
     
-    protected Element appendElement(ElementImpl child) throws SOAPException {
+    protected Element appendElement(Element child) throws SOAPException {
         String namespaceURI = child.getNamespaceURI();
         String prefix = child.getPrefix();
 
-        SOAPElementImpl childEle = new SOAPElementImpl(child);
+        SOAPElementImpl<OMElement> childEle = new SOAPElementImpl<OMElement>((OMElement)child);
         
         childEle.target.setUserData(SAAJ_NODE, childEle, null);
         if (namespaceURI != null && namespaceURI.trim().length() > 0) {
-            childEle.target.setNamespace(childEle.target.declareNamespace(namespaceURI, prefix));
+            childEle.omTarget.setNamespace(childEle.omTarget.declareNamespace(namespaceURI, prefix));
         }
         target.appendChild(childEle.target);
-        ((NodeImpl)childEle.target.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement((SOAPElement)this);
         return childEle;
     }

Modified: axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyElementImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyElementImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyElementImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyElementImpl.java Sun Aug 26 21:42:35 2012
@@ -19,7 +19,7 @@
 
 package org.apache.axis2.saaj;
 
-import org.apache.axiom.om.impl.dom.ElementImpl;
+import org.apache.axiom.om.OMElement;
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPBody;
@@ -28,10 +28,10 @@ import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPException;
 import java.util.Iterator;
 
-public class SOAPBodyElementImpl extends SOAPElementImpl implements SOAPBodyElement {
+public class SOAPBodyElementImpl<T extends OMElement> extends SOAPElementImpl<T> implements SOAPBodyElement {
 
     /** @param element  */
-    public SOAPBodyElementImpl(ElementImpl element) {
+    public SOAPBodyElementImpl(T element) {
         super(element);
     }
 

Modified: axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPBodyImpl.java Sun Aug 26 21:42:35 2012
@@ -19,17 +19,12 @@
 
 package org.apache.axis2.saaj;
 
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.dom.DocumentImpl;
-import org.apache.axiom.om.impl.dom.ElementImpl;
-import org.apache.axiom.om.impl.dom.NamespaceImpl;
-import org.apache.axiom.om.impl.dom.NodeImpl;
+import org.apache.axiom.soap.SOAP11Version;
+import org.apache.axiom.soap.SOAP12Version;
 import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
-import org.apache.axiom.soap.impl.dom.soap11.SOAP11FaultImpl;
-import org.apache.axiom.soap.impl.dom.soap12.SOAP12Factory;
-import org.apache.axiom.soap.impl.dom.soap12.SOAP12FaultImpl;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -52,29 +47,27 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.Locale;
 
-public class SOAPBodyImpl extends SOAPElementImpl implements SOAPBody {
+public class SOAPBodyImpl extends SOAPElementImpl<org.apache.axiom.soap.SOAPBody> implements SOAPBody {
 
-    private org.apache.axiom.soap.SOAPBody omSOAPBody;
     private boolean isBodyElementAdded;
 
     /** @param omSOAPBody  */
     public SOAPBodyImpl(org.apache.axiom.soap.SOAPBody omSOAPBody) {
-        super((ElementImpl)omSOAPBody);
-        this.omSOAPBody = omSOAPBody;
+        super(omSOAPBody);
     }
 
     /* (non-Javadoc)
     * @see javax.xml.soap.SOAPElement#addChildElement(java.lang.String)
     */
     public SOAPElement addChildElement(String localName) throws SOAPException {
-        if (omSOAPBody.hasFault()) {
+        if (omTarget.hasFault()) {
             throw new SOAPException("A SOAPFault has been already added to this SOAPBody");
         }
-        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);
+        SOAPBodyElementImpl<OMElement> childEle =
+                new SOAPBodyElementImpl<OMElement>((OMElement)getOwnerDocument().createElement(localName));
+        childEle.target.setUserData(SAAJ_NODE, childEle, null);
+        target.appendChild(childEle.target);
+        childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
         isBodyElementAdded = true;
         return childEle;
     }
@@ -85,31 +78,31 @@ public class SOAPBodyImpl extends SOAPEl
         if (namespaceURI == null) {
             throw new SOAPException("Namespace not declared for the give prefix: " + prefix);
         }
-        SOAPBodyElementImpl childEle =
-                new SOAPBodyElementImpl(
-                        (ElementImpl)getOwnerDocument().createElementNS(namespaceURI,
+        SOAPBodyElementImpl<OMElement> childEle =
+                new SOAPBodyElementImpl<OMElement>(
+                        (OMElement)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.omTarget.setNamespace(childEle.omTarget.declareNamespace(namespaceURI, prefix));
+        target.appendChild(childEle.target);
+        childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
 
     @Override
-    protected Element appendElement(ElementImpl child) throws SOAPException {    
+    protected Element appendElement(Element child) throws SOAPException {    
         String namespaceURI = child.getNamespaceURI();
         String prefix = child.getPrefix();
 
-        SOAPBodyElementImpl childEle = new SOAPBodyElementImpl(child);
+        SOAPBodyElementImpl<OMElement> childEle = new SOAPBodyElementImpl<OMElement>((OMElement)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.omTarget.setNamespace(childEle.omTarget.declareNamespace(namespaceURI, prefix));
         }
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        target.appendChild(childEle.target);
+        childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
@@ -119,16 +112,16 @@ public class SOAPBodyImpl extends SOAPEl
         String prefix = soapElement.getPrefix();
         String localName = soapElement.getLocalName();
 
-        SOAPBodyElementImpl childEle;
+        SOAPBodyElementImpl<OMElement> childEle;
         if (namespaceURI == null || namespaceURI.trim().length() == 0) {
             childEle =
-                new SOAPBodyElementImpl(
-                        (ElementImpl)getOwnerDocument().createElement(localName));
+                new SOAPBodyElementImpl<OMElement>(
+                        (OMElement)getOwnerDocument().createElement(localName));
         } else {
-            element.declareNamespace(namespaceURI, prefix);
+            omTarget.declareNamespace(namespaceURI, prefix);
             childEle =
-                new SOAPBodyElementImpl(
-                        (ElementImpl)getOwnerDocument().createElementNS(namespaceURI,
+                new SOAPBodyElementImpl<OMElement>(
+                        (OMElement)getOwnerDocument().createElementNS(namespaceURI,
                                                                         localName));            
         }
 
@@ -146,12 +139,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.omTarget.setNamespace(childEle.omTarget.declareNamespace(namespaceURI, prefix));
         }
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        target.appendChild(childEle.target);
+        childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
         childEle.setParentElement(this);
         return childEle;
     }
@@ -161,29 +154,29 @@ public class SOAPBodyImpl extends SOAPEl
     */
     public SOAPElement addChildElement(String localName, String prefix, String uri)
             throws SOAPException {
-        if (omSOAPBody.hasFault()) {
+        if (omTarget.hasFault()) {
             throw new SOAPException("A SOAPFault has been already added to this SOAPBody");
         }
         if (prefix == null) {
             prefix = "";
         }
-        SOAPBodyElementImpl childEle;
+        SOAPBodyElementImpl<OMElement> childEle;
         if (uri == null || "".equals(uri)) {
-            childEle = new SOAPBodyElementImpl(
-                    (ElementImpl)getOwnerDocument().createElement(localName));
+            childEle = new SOAPBodyElementImpl<OMElement>(
+                    (OMElement)getOwnerDocument().createElement(localName));
         } else if (prefix.length() == 0) {
-            childEle = new SOAPBodyElementImpl(
-                (ElementImpl)getOwnerDocument().createElementNS(uri,
+            childEle = new SOAPBodyElementImpl<OMElement>(
+                (OMElement)getOwnerDocument().createElementNS(uri,
                                                                 localName));
         } else {
-            childEle = new SOAPBodyElementImpl(
-                    (ElementImpl)getOwnerDocument().createElementNS(uri,
+            childEle = new SOAPBodyElementImpl<OMElement>(
+                    (OMElement)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.omTarget.setNamespace(omTarget.getOMFactory().createOMNamespace(uri, prefix));
+        target.appendChild(childEle.target);
+        childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
         isBodyElementAdded = true;
         childEle.setParentElement(this);
         return childEle;
@@ -200,21 +193,12 @@ public class SOAPBodyImpl extends SOAPEl
         if (isBodyElementAdded) {
             throw new SOAPException("A SOAPBodyElement has been already added to this SOAPBody");
         }
-        SOAPFaultImpl saajSOAPFault = null;
-
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
-            SOAP11FaultImpl fault =
-                    new SOAP11FaultImpl(omSOAPBody, (SOAPFactory)this.element.getOMFactory());
-            saajSOAPFault = new SOAPFaultImpl(fault);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
-            SOAP12FaultImpl fault =
-                    new SOAP12FaultImpl(omSOAPBody, (SOAPFactory)this.element.getOMFactory());
-            saajSOAPFault = new SOAPFaultImpl(fault);
-        }
+        org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget);
+        SOAPFaultImpl saajSOAPFault = new SOAPFaultImpl(fault);
         // set default fault code and string
         saajSOAPFault.setDefaults();
         
-        ((NodeImpl)omSOAPBody.getFault()).setUserData(SAAJ_NODE, saajSOAPFault, null);
+        ((Element)omTarget.getFault()).setUserData(SAAJ_NODE, saajSOAPFault, null);
         return saajSOAPFault;
     }
 
@@ -226,7 +210,7 @@ public class SOAPBodyImpl extends SOAPEl
      *         <code>SOAPBody</code> object; <code>false</code> otherwise
      */
     public boolean hasFault() {
-        return omSOAPBody.hasFault();
+        return omTarget.hasFault();
     }
 
     /**
@@ -235,8 +219,8 @@ public class SOAPBodyImpl extends SOAPEl
      * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code> object
      */
     public SOAPFault getFault() {
-        if (omSOAPBody.hasFault()) {
-            return (SOAPFault)toSAAJNode((org.w3c.dom.Node)omSOAPBody.getFault());
+        if (omTarget.hasFault()) {
+            return (SOAPFault)toSAAJNode((org.w3c.dom.Node)omTarget.getFault());
         }
         return null;
     }
@@ -270,14 +254,7 @@ 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) {
-            fault = new SOAP11FaultImpl(omSOAPBody, new Exception(
-                    faultString), (SOAPFactory)this.element.getOMFactory());
-        } else {
-            fault = new SOAP12FaultImpl(omSOAPBody, new Exception(
-                    faultString), (SOAPFactory)this.element.getOMFactory());
-        }
+        org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget);
         SOAPFaultImpl faultImpl = new SOAPFaultImpl(fault);
         faultImpl.setFaultCode(faultCode);
 
@@ -323,8 +300,8 @@ public class SOAPBodyImpl extends SOAPEl
         Element docEle = document.getDocumentElement();
 
         SOAPElement saajSOAPEle = (SOAPElement)toSAAJNode(docEle, this);
-        SOAPBodyElementImpl bodyEle =
-                new SOAPBodyElementImpl(((SOAPElementImpl)saajSOAPEle).element);
+        SOAPBodyElementImpl<OMElement> bodyEle =
+                new SOAPBodyElementImpl<OMElement>(((SOAPElementImpl<?>)saajSOAPEle).omTarget);
         addChildElement(bodyEle);
         return bodyEle;
     }
@@ -362,17 +339,8 @@ public class SOAPBodyImpl extends SOAPEl
      */
     public SOAPFault addFault(QName faultCode, String faultString, Locale locale)
             throws SOAPException {
-        SOAPFaultImpl faultImpl = null;
-
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
-            SOAP11FaultImpl fault = new SOAP11FaultImpl(omSOAPBody, new Exception(
-                    faultString), (SOAPFactory)this.element.getOMFactory());
-            faultImpl = new SOAPFaultImpl(fault);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
-            SOAP12FaultImpl fault = new SOAP12FaultImpl(omSOAPBody, new Exception(
-                    faultString), (SOAPFactory)this.element.getOMFactory());
-            faultImpl = new SOAPFaultImpl(fault);
-        }
+        org.apache.axiom.soap.SOAPFault fault = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPFault(omTarget);
+        SOAPFaultImpl faultImpl = new SOAPFaultImpl(fault);
 
         if (faultImpl != null) {
             faultImpl.setFaultCode(faultCode);
@@ -439,11 +407,11 @@ public class SOAPBodyImpl extends SOAPEl
         }
         Element domEle = ((Element)node);
         int indexOfColon = domEle.getTagName().indexOf(":");
-        NamespaceImpl ns;
+        OMNamespace ns;
         String localName;
         if (indexOfColon != -1) {
             localName = domEle.getTagName().substring(indexOfColon + 1);
-            ns = new NamespaceImpl(domEle.getNamespaceURI(),
+            ns = omTarget.getOMFactory().createOMNamespace(domEle.getNamespaceURI(),
                                    domEle.getTagName().substring(0, indexOfColon));
         } else {
             localName = domEle.getLocalName();
@@ -456,21 +424,20 @@ public class SOAPBodyImpl extends SOAPEl
                 prefix = "";
             }
             if (domEle.getNamespaceURI() != null) {
-                ns = new NamespaceImpl(domEle.getNamespaceURI(), prefix);
+                ns = omTarget.getOMFactory().createOMNamespace(domEle.getNamespaceURI(), prefix);
             } else {
                 if (prefix != null) {
-                    ns = new NamespaceImpl("", prefix);
+                    ns = omTarget.getOMFactory().createOMNamespace("", prefix);
                 } else {
-                    ns = new NamespaceImpl("", "");
+                    ns = omTarget.getOMFactory().createOMNamespace("", "");
                     
                 }
             }
         }
-        ElementImpl eleImpl =
-                new ElementImpl((DocumentImpl)this.getOwnerDocument(),
-                                localName, ns, this.element.getOMFactory());
+        OMElement eleImpl = this.omTarget.getOMFactory().createOMElement(localName, ns);
+        getOwnerDocument().adoptNode((Element)eleImpl);
 
-        SOAPElementImpl saajEle = new SOAPElementImpl(eleImpl);
+        SOAPElementImpl<OMElement> saajEle = new SOAPElementImpl<OMElement>(eleImpl);
 
         saajEle.setParentElement(parent);
         NamedNodeMap domAttrs = domEle.getAttributes();
@@ -508,61 +475,53 @@ public class SOAPBodyImpl extends SOAPEl
 
     public OMNode detach() {
         this.parentElement = null;
-        return this.element.detach();
+        return this.omTarget.detach();
     }
 
     public Iterator getChildElements(Name name) {
         QName qName = new QName(name.getURI(), name.getLocalName());
-        return getChildren(element.getChildrenWithName(qName));
+        return getChildren(omTarget.getChildrenWithName(qName));
     }
 
     public SOAPElement addAttribute(QName qname, String value) throws SOAPException {
-        OMNamespace omNamespace = null;
-        SOAPFactory soapFactory;
-        if (this.element.getOMFactory() instanceof SOAP11Factory) {
-            soapFactory = new SOAP11Factory();
-            omNamespace = soapFactory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
-            soapFactory = new SOAP12Factory();
-            omNamespace = soapFactory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
-        }
-        this.element.addAttribute(qname.getLocalPart(), value, omNamespace);
+        OMNamespace omNamespace = this.omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
+        this.omTarget.addAttribute(qname.getLocalPart(), value, omNamespace);
         return this;
     }
 
     public SOAPElement addChildElement(QName qname) throws SOAPException {
-        if (omSOAPBody.hasFault()) {
+        if (omTarget.hasFault()) {
             throw new SOAPException("A SOAPFault has been already added to this SOAPBody");
         }
-        SOAPBodyElementImpl childEle;
+        SOAPBodyElementImpl<OMElement> childEle;
         if (qname.getNamespaceURI() == null || "".equals(qname.getNamespaceURI())) {
-            childEle = new SOAPBodyElementImpl(
-                    (ElementImpl)getOwnerDocument().createElement(qname.getLocalPart()));
+            childEle = new SOAPBodyElementImpl<OMElement>(
+                    (OMElement)getOwnerDocument().createElement(qname.getLocalPart()));
         }else if(null == qname.getPrefix() || "".equals(qname.getPrefix().trim())) {
-            childEle = new SOAPBodyElementImpl(
-                    (ElementImpl)getOwnerDocument().createElementNS(qname.getNamespaceURI(),
+            childEle = new SOAPBodyElementImpl<OMElement>(
+                    (OMElement)getOwnerDocument().createElementNS(qname.getNamespaceURI(),
                                                                             qname.getLocalPart()));
         }else {
-            childEle = new SOAPBodyElementImpl(
-                    (ElementImpl)getOwnerDocument().createElementNS(qname.getNamespaceURI(),
+            childEle = new SOAPBodyElementImpl<OMElement>(
+                    (OMElement)getOwnerDocument().createElementNS(qname.getNamespaceURI(),
                                                                     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.omTarget.setNamespace(omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix()));
 
-        element.appendChild(childEle.element);
-        ((NodeImpl)childEle.element.getParentNode()).setUserData(SAAJ_NODE, this, null);
+        target.appendChild(childEle.target);
+        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 (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
             return super.createQName(localName, prefix);
-        } else if (this.element.getOMFactory() instanceof SOAP12Factory) {
-            if (this.element.findNamespaceURI(prefix) == null) {
+        } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+            if (this.omTarget.findNamespaceURI(prefix) == null) {
                 throw new SOAPException("Only Namespace Qualified elements are allowed");
             } else {
                 return super.createQName(localName, prefix);
@@ -598,7 +557,7 @@ public class SOAPBodyImpl extends SOAPEl
     }
 
     public Iterator getChildElements() {
-        return getChildren(element.getChildren());
+        return getChildren(omTarget.getChildren());
     }
 
     public SOAPElement addTextNode(String text) throws SOAPException {
@@ -614,23 +573,18 @@ public class SOAPBodyImpl extends SOAPEl
                 childElements.add(saajNode);
             } else if (!(saajNode instanceof SOAPBodyElement)) {
                 // silently replace node, as per saaj 1.2 spec
-                if (domNode instanceof ElementImpl) {
-                    if (omSOAPBody.hasFault()) {
+                if (domNode instanceof Element) {
+                    if (omTarget.hasFault()) {
 
-                        SOAPFactory omFactory = (SOAPFactory)this.element.getOMFactory();
-                        org.apache.axiom.soap.SOAPFault fault;
-                        if (omFactory instanceof SOAP11Factory) {
-                            fault = new SOAP11FaultImpl(omSOAPBody, omFactory);
-                        } else {
-                            fault = new SOAP12FaultImpl(omSOAPBody, omFactory);
-                        }
+                        SOAPFactory omFactory = (SOAPFactory)this.omTarget.getOMFactory();
+                        org.apache.axiom.soap.SOAPFault fault = omFactory.createSOAPFault(omTarget);
                         SOAPFaultImpl saajSOAPFault = new SOAPFaultImpl(fault);
-                        ((NodeImpl)omSOAPBody.getFault())
+                        ((Element)omTarget.getFault())
                                 .setUserData(SAAJ_NODE, saajSOAPFault, null);
                         childElements.add(saajSOAPFault);
                     } else {
-                        SOAPBodyElement saajBodyEle = new SOAPBodyElementImpl((ElementImpl)domNode);
-                        ((NodeImpl)domNode).setUserData(SAAJ_NODE, saajBodyEle, null);
+                        SOAPBodyElement saajBodyEle = new SOAPBodyElementImpl<OMElement>((OMElement)domNode);
+                        domNode.setUserData(SAAJ_NODE, saajBodyEle, null);
                         childElements.add(saajBodyEle);
                     }
                 }

Modified: axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?rev=1377526&r1=1377525&r2=1377526&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java Sun Aug 26 21:42:35 2012
@@ -212,7 +212,7 @@ public class SOAPConnectionImpl extends 
             SOAPMessage response = getSOAPMessage(responseMsgCtx.getEnvelope());
             Attachments attachments = responseMsgCtx.getAttachmentMap();
             for (String contentId : attachments.getAllContentIDs()) {
-                if (!contentId.equals(attachments.getSOAPPartContentID())) {
+                if (!contentId.equals(attachments.getRootPartContentID())) {
                     AttachmentPart ap = response.createAttachmentPart(
                             attachments.getDataHandler(contentId));
                     ap.setContentId(contentId);



Mime
View raw message