You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ru...@apache.org on 2006/03/27 10:02:11 UTC

svn commit: r389047 [7/7] - in /webservices/commons/trunk/modules/axiom: ./ src/org/apache/axiom/om/impl/dom/ src/org/apache/axiom/om/impl/dom/factory/ src/org/apache/axiom/om/impl/dom/jaxp/ src/org/apache/axiom/om/impl/dom/msg/ src/org/apache/axiom/so...

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.NamespaceImpl;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPEnvelopeImpl;
+import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory;
+
+public class SOAP12Factory extends DOMSOAPFactory {
+	
+	public SOAP12Factory() {}
+	
+	public SOAP12Factory(DocumentImpl doc) {
+		super(doc);
+	}
+	
+    public String getSoapVersionURI() {
+        return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+    }
+
+    public SOAPEnvelope createSOAPEnvelope() {
+        return new SOAPEnvelopeImpl(
+                new NamespaceImpl(
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX,
+                        this),
+                this);
+    }
+
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException {
+        return new SOAP12HeaderImpl(envelope, this);
+    }
+
+    public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
+                                       OMXMLParserWrapper builder) {
+        return new SOAP12HeaderImpl(envelope, builder, this);
+    }
+
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+                                                 OMNamespace ns,
+                                                 SOAPHeader parent) throws SOAPProcessingException {
+        return new SOAP12HeaderBlockImpl(localName, ns, parent, this);
+    }
+
+    public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+                                                 OMNamespace ns,
+                                                 SOAPHeader parent,
+                                                 OMXMLParserWrapper builder) throws SOAPProcessingException {
+        return new SOAP12HeaderBlockImpl(localName, ns, parent, builder, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException {
+        return new SOAP12FaultImpl(parent, e, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException {
+        return new SOAP12FaultImpl(parent, this);
+    }
+
+    public SOAPFault createSOAPFault(SOAPBody parent,
+                                     OMXMLParserWrapper builder) {
+        return new SOAP12FaultImpl(parent, builder, this);
+    }
+
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException {
+        return new SOAP12BodyImpl(envelope, this);
+    }
+
+    public SOAPBody createSOAPBody(SOAPEnvelope envelope,
+                                   OMXMLParserWrapper builder) {
+        return new SOAP12BodyImpl(envelope, builder, this);
+    }
+
+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultCodeImpl(parent, this);
+    }
+
+    public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP12FaultCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException {
+        return new SOAP12FaultValueImpl(parent, this);
+    }
+
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,
+                                               OMXMLParserWrapper builder) {
+        return new SOAP12FaultValueImpl(parent, builder, this);
+    }
+
+    //added
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException {
+        return new SOAP12FaultValueImpl(parent, this);
+    }
+
+    //added
+    public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,
+                                               OMXMLParserWrapper builder) {
+        return new SOAP12FaultValueImpl(parent, builder, this);
+    }
+
+    //changed
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException {
+        return new SOAP12FaultSubCodeImpl(parent, this);
+    }
+
+    //changed
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,
+                                                   OMXMLParserWrapper builder) {
+        return new SOAP12FaultSubCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException {
+        return new SOAP12FaultSubCodeImpl(parent, this);
+    }
+
+    public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,
+                                                   OMXMLParserWrapper builder) {
+        return new SOAP12FaultSubCodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultReasonImpl(parent, this);
+    }
+
+    public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,
+                                                 OMXMLParserWrapper builder) {
+        return new SOAP12FaultReasonImpl(parent, builder, this);
+    }
+
+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException {
+        return new SOAP12FaultTextImpl(parent, this);
+    }
+
+    public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP12FaultTextImpl(parent, builder, this);
+    }
+
+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultNodeImpl(parent, this);
+    }
+
+    public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP12FaultNodeImpl(parent, builder, this);
+    }
+
+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultRoleImpl(parent, this);
+    }
+
+    public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,
+                                             OMXMLParserWrapper builder) {
+        return new SOAP12FaultRoleImpl(parent, builder, this);
+    }
+
+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException {
+        return new SOAP12FaultDetailImpl(parent, this);
+    }
+
+    public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,
+                                                 OMXMLParserWrapper builder) {
+        return new SOAP12FaultDetailImpl(parent, builder, this);
+    }
+
+    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
+        OMNamespace ns =
+                new NamespaceImpl(
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX,
+                        this);
+        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
+        createSOAPHeader(env);
+        createSOAPBody(env);
+
+        return env;
+    }
+
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultCodeImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultCodeImpl;
+
+public class SOAP12FaultCodeImpl extends SOAPFaultCodeImpl {
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAP12FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP12FaultCodeImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, true, factory);
+    }
+
+
+    public void setSubCode(SOAPFaultSubCode subCode)
+            throws SOAPProcessingException {
+        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault " +
+                    "Sub Code. But received some other implementation");
+        }
+        super.setSubCode(subCode);
+    }
+
+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
+        if (!(value instanceof SOAP12FaultValueImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Value. " +
+                    "But received some other implementation");
+        }
+        super.setValue(value);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as " +
+                    "the parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultDetailImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultDetailImpl;
+
+public class SOAP12FaultDetailImpl extends SOAPFaultDetailImpl {
+    
+    public SOAP12FaultDetailImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, true, factory);
+    }
+
+    public SOAP12FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,116 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultNode;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPFaultRole;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultImpl;
+
+import javax.xml.stream.XMLStreamException;
+
+public class SOAP12FaultImpl extends SOAPFaultImpl {
+    public SOAP12FaultImpl(SOAPBody parent, Exception e, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, e, factory);
+    }
+
+    public SOAP12FaultImpl(SOAPBody parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * This is a convenience method for the SOAP Fault Impl.
+     *
+     * @param parent
+     */
+    public SOAP12FaultImpl(SOAPBody parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) {
+        return new SOAP12FaultDetailImpl(fault, (SOAPFactory)this.factory);
+
+    }
+
+    public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException {
+        if (!(soapFaultCode instanceof SOAP12FaultCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Code. " +
+                    "But received some other implementation");
+        }
+        super.setCode(soapFaultCode);
+    }
+
+
+    public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
+        if (!(reason instanceof SOAP12FaultReasonImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Reason. But received some other implementation");
+        }
+        super.setReason(reason);
+    }
+
+    public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+        if (!(node instanceof SOAP12FaultNodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Node. But received some other implementation");
+        }
+        super.setNode(node);
+    }
+
+    public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+        if (!(role instanceof SOAP12FaultRoleImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Role. But received some other implementation");
+        }
+        super.setRole(role);
+    }
+
+    public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
+        if (!(detail instanceof SOAP12FaultDetailImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Detail. But received some other implementation");
+        }
+        super.setDetail(detail);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12BodyImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");
+        }
+    }
+
+    protected void serializeFaultNode(org.apache.axiom.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
+        SOAPFaultNode faultNode = getNode();
+        if (faultNode != null) {
+            ((OMNodeEx)faultNode).serialize(omOutput);
+        }
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultNodeImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultNodeImpl;
+
+public class SOAP12FaultNodeImpl extends SOAPFaultNodeImpl {
+    public SOAP12FaultNodeImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP12FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultReasonImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPFaultText;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultReasonImpl;
+
+public class SOAP12FaultReasonImpl extends SOAPFaultReasonImpl {
+
+    public SOAP12FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP12FaultReasonImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, true, factory);
+    }
+
+    public void setSOAPText(SOAPFaultText soapFaultText)
+            throws SOAPProcessingException {
+        if (!(soapFaultText instanceof SOAP12FaultTextImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Text. " +
+                    "But received some other implementation");
+        }
+        super.setSOAPText(soapFaultText);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultRoleImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFault;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultRoleImpl;
+
+public class SOAP12FaultRoleImpl extends SOAPFaultRoleImpl {
+    
+    public SOAP12FaultRoleImpl(SOAPFault parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME, true, factory);
+    }
+
+    public SOAP12FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault as the " +
+                    "parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultSubCodeImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultSubCode;
+import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultSubCodeImpl;
+
+public class SOAP12FaultSubCodeImpl extends SOAPFaultSubCodeImpl {
+    //changed
+    public SOAP12FaultSubCodeImpl(SOAPFaultCode parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);
+    }
+
+    //changed
+    public SOAP12FaultSubCodeImpl(SOAPFaultCode parent,
+                                  OMXMLParserWrapper builder,
+                                  SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, factory);
+    }
+
+    public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent,
+                                  OMXMLParserWrapper builder,
+                                  SOAPFactory factory) {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder,
+                factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!((parent instanceof SOAP12FaultSubCodeImpl) ||
+                (parent instanceof SOAP12FaultCodeImpl))) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP FaultSubCode " +
+                    "or SOAP FaultCodeValue as the parent. But received some " +
+                    "other implementation");
+        }
+    }
+
+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault " +
+                    "Sub Code. But received some other implementation");
+        }
+        super.setSubCode(subCode);
+    }
+
+    public void setValue(SOAPFaultValue soapFaultSubCodeValue)
+            throws SOAPProcessingException {
+        if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Fault Value. " +
+                    "But received some other implementation");
+        }
+        super.setValue(soapFaultSubCodeValue);
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultTextImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPFaultReason;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultTextImpl;
+
+public class SOAP12FaultTextImpl extends SOAPFaultTextImpl {
+    
+    public SOAP12FaultTextImpl(SOAPFaultReason parent, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP12FaultTextImpl(SOAPFaultReason parent,
+                               OMXMLParserWrapper builder,
+                               SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultReasonImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP FaultReason " +
+                    "as the parent. But received some other implementation");
+        }
+    }
+}
\ No newline at end of file

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12FaultValueImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPFaultValueImpl;
+
+public class SOAP12FaultValueImpl extends SOAPFaultValueImpl {
+    
+    public SOAP12FaultValueImpl(OMElement parent, SOAPFactory factory) throws SOAPProcessingException {
+        super(parent, factory);
+    }
+
+    public SOAP12FaultValueImpl(OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) {
+        super(parent, builder, factory);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!((parent instanceof SOAP12FaultSubCodeImpl) ||
+                (parent instanceof SOAP12FaultCodeImpl))) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPHeaderBlockImpl;
+
+public class SOAP12HeaderBlockImpl extends SOAPHeaderBlockImpl {
+    /**
+     * @param localName
+     * @param ns
+     */
+    public SOAP12HeaderBlockImpl(String localName,
+                                 OMNamespace ns,
+                                 SOAPHeader parent,
+                                 SOAPFactory factory) throws SOAPProcessingException {
+        super(localName, ns, parent, factory);
+        checkParent(parent);
+    }
+
+    /**
+     * Constructor SOAPHeaderBlockImpl
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     */
+    public SOAP12HeaderBlockImpl(String localName,
+                                 OMNamespace ns,
+                                 SOAPHeader parent,
+                                 OMXMLParserWrapper builder,
+                                 SOAPFactory factory) {
+        super(localName, ns, parent, builder, factory);
+
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12HeaderImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");
+        }
+    }
+
+    public void setRole(String roleURI) {
+        setAttribute(SOAP12Constants.SOAP_ROLE,
+                roleURI,
+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+    }
+
+    public String getRole() {
+        return getAttribute(SOAP12Constants.SOAP_ROLE,
+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+    }
+
+    public void setMustUnderstand(boolean mustUnderstand) {
+        setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                mustUnderstand ? "1" : "0",
+                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+    }
+
+    public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException {
+        if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) ||
+                SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) {
+            setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                    mustUnderstand,
+                    SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+        } else {
+            throw new SOAPProcessingException(
+                    "mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" ");
+        }
+    }
+
+    public boolean getMustUnderstand() throws SOAPProcessingException {
+        String mustUnderstand = "";
+        if ((mustUnderstand =
+                getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+                        SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+                != null) {
+            if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(
+                    mustUnderstand) ||
+                    SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(
+                            mustUnderstand)) {
+                return true;
+            } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equalsIgnoreCase(
+                    mustUnderstand) ||
+                    SOAPConstants.ATTR_MUSTUNDERSTAND_0.equalsIgnoreCase(
+                            mustUnderstand)) {
+                return false;
+            } else {
+                throw new SOAPProcessingException(
+                        "Invalid value found in mustUnderstand value of " +
+                        this.getLocalName() +
+                        " header block");
+            }
+        }
+        return false;
+
+    }
+}

Added: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java (added)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/soap/impl/dom/soap12/SOAP12HeaderImpl.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.soap.impl.dom.soap12;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMNodeEx;
+import org.apache.axiom.om.impl.traverse.OMChildrenWithSpecificAttributeIterator;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.dom.SOAPHeaderImpl;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+public class SOAP12HeaderImpl extends SOAPHeaderImpl {
+    /**
+     * @param envelope
+     */
+    public SOAP12HeaderImpl(SOAPEnvelope envelope, SOAPFactory factory)
+            throws SOAPProcessingException {
+        super(envelope, factory);
+    }
+
+    /**
+     * Constructor SOAPHeaderImpl
+     *
+     * @param envelope
+     * @param builder
+     */
+    public SOAP12HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,
+            SOAPFactory factory) {
+        super(envelope, builder, factory);
+    }
+
+    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException {
+        if (ns == null || ns.getName() == null || "".equals(ns.getName())) {
+            throw new OMException(
+                    "All the SOAP Header blocks should be namespace qualified");
+        }
+
+        OMNamespace namespace = findNamespace(ns.getName(), ns.getPrefix());
+        if (namespace != null) {
+            ns = namespace;
+        }
+
+        SOAPHeaderBlock soapHeaderBlock = null;
+        try {
+            soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this,
+                    (SOAPFactory)this.factory);
+        } catch (SOAPProcessingException e) {
+            throw new OMException(e);
+        }
+        ((OMNodeEx)soapHeaderBlock).setComplete(true);
+        return soapHeaderBlock;
+    }
+
+
+    public Iterator extractHeaderBlocks(String role) {
+        return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(),
+                new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP12Constants.SOAP_ROLE),
+                role,
+                true);
+    }
+}

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/AbstractTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/AbstractTestCase.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/AbstractTestCase.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/AbstractTestCase.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+/**
+ * Abstract base class for test cases.
+ */
+public abstract class AbstractTestCase
+        extends TestCase {
+    protected String testDir = "test" + File.separator;
+    protected String sampleDir = "samples" + File.separator;
+    protected String outDir = "target" + File.separator + "generated" +
+            File.separator +
+            "samples" +
+            File.separator;
+    protected String tempDir = "target" + File.separator + "generated" +
+            File.separator +
+            "temp";
+    protected String testResourceDir = "test-resources";
+
+    /**
+     * Basedir for all file I/O. Important when running tests from
+     * the reactor.
+     */
+    public String basedir = System.getProperty("basedir");
+
+    /**
+     * @param testName
+     */
+    public AbstractTestCase(String testName) {
+        super(testName);
+        if (basedir == null) {
+            basedir = new File(".").getAbsolutePath();
+        }
+        testDir = new File(basedir, testDir).getAbsolutePath();
+        sampleDir = new File(basedir, sampleDir).getAbsolutePath();
+        outDir = new File(basedir, outDir).getAbsolutePath();
+        tempDir = new File(basedir, tempDir).getAbsolutePath();
+    }
+
+    public File getTestResourceFile(String relativePath) {
+        return new File(testResourceDir, relativePath);
+    }
+
+    public File getTempOutputFile(String filename) {
+        File f = new File(tempDir);
+        if(!f.exists()) {
+            f.mkdirs();
+        }
+        return new File(f, filename);
+    }
+}
+

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DOMImplementationTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DOMImplementationTest.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DOMImplementationTest.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DOMImplementationTest.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl;
+import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderImpl;
+import org.w3c.dom.Document;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+public class DOMImplementationTest extends TestCase {
+
+	public DOMImplementationTest(String name) {
+		super(name);
+	}
+	
+	public void testDOMImpl() {
+		try {
+//			System.setProperty("javax.xml.parsers.DocumentBuilderFactory",DocumentBuilderFactoryImpl.class.getName());
+		    
+            DocumentBuilderFactoryImpl.setDOOMRequired(true);
+            
+			DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
+			DocumentBuilder builder = fac.newDocumentBuilder();
+			Document doc = builder.newDocument();
+			
+			assertEquals("Incorrect DocumentBuilderFactory instance", DocumentBuilderFactoryImpl.class.getName(),fac.getClass().getName());
+			assertEquals("Incorrect DocumentBuilder instance", DocumentBuilderImpl.class.getName(),builder.getClass().getName());
+			assertEquals("Incorrect Document instance", DocumentImpl.class.getName(),doc.getClass().getName());
+            
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} finally {
+            DocumentBuilderFactoryImpl.setDOOMRequired(false);
+        }
+	}
+}

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DocumentImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DocumentImplTest.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DocumentImplTest.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/DocumentImplTest.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+public class DocumentImplTest extends TestCase {
+
+	public DocumentImplTest() {
+		super();
+	}
+
+	public DocumentImplTest(String name) {
+		super(name);
+	}
+	
+	public void testCreateElement() {
+		String tagName = "LocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+        OMDOMFactory fac = new OMDOMFactory();
+		DocumentImpl doc = new DocumentImpl(fac);
+		Element elem = doc.createElement(tagName);
+		
+		assertEquals("Local name misnatch",tagName, elem.getNodeName());
+		
+		elem = doc.createElementNS(namespace, "axis2:" + tagName);
+		assertEquals("Local name misnatch",tagName,elem.getLocalName());
+		assertEquals("Namespace misnatch",namespace,elem.getNamespaceURI());
+		
+	}
+	
+	public void testCreateAttribute() {
+		String attrName = "attrIdentifier";
+		String attrValue = "attrValue";
+		String attrNs = "http://ws.apache.org/axis2/ns";
+		String attrNsPrefix = "axis2";
+		
+        OMDOMFactory fac = new OMDOMFactory();
+        DocumentImpl doc = new DocumentImpl(fac);
+		Attr attr = doc.createAttribute(attrName);
+
+		assertEquals("Attr name mismatch",attrName,attr.getName());
+		assertNull("Namespace value should be null", attr.getNamespaceURI());
+		
+		
+		attr = doc.createAttributeNS(attrNs,attrNsPrefix + ":" + attrName);
+		assertEquals("Attr name mismatch",attrName,attr.getLocalName());
+		assertNotNull("Namespace value should not be null", attr.getNamespaceURI());
+		assertEquals("NamsspaceURI mismatch", attrNs, attr.getNamespaceURI());
+		assertEquals("namespace prefix mismatch", attrNsPrefix, attr.getPrefix());
+		
+		attr.setValue(attrValue);
+		
+	}
+	
+	public void testCreateText() {
+		String textValue = "temp text value";
+		
+        OMDOMFactory fac = new OMDOMFactory();
+        DocumentImpl doc = new DocumentImpl(fac);
+		Text txt = doc.createTextNode(textValue);
+		
+		assertEquals("Text value mismatch", textValue, txt.getData());
+	}
+
+}

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/ElementImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/ElementImplTest.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/ElementImplTest.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/ElementImplTest.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Text;
+
+import javax.xml.namespace.QName;
+import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
+
+public class ElementImplTest extends TestCase {
+
+	public ElementImplTest() {
+		super();
+	}
+
+	public ElementImplTest(String name) {
+		super(name);
+	}
+	
+	public void testSetText() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		OMElement elem = factory.createOMElement(localName,namespace,prefix);
+		
+		String text = "The quick brown fox jumps over the lazy dog";
+		
+		elem.setText(text);
+		
+		assertEquals("Text value mismatch", text, elem.getText());
+		
+	}
+	
+	public void testSerialize() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		String tempText = "The quick brown fox jumps over the lazy dog";
+		String textToAppend = " followed by another";
+		
+		OMElement elem = factory.createOMElement(localName,namespace,prefix);
+		OMText textNode = factory.createText(elem,tempText);
+		
+		((Text)textNode).appendData(textToAppend);
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		try {
+			elem.serialize(baos);
+			System.out.println(new String(baos.toByteArray()));
+			//TODO TEMPORARY: remove this
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		}
+	}
+	
+	public void testAddChild() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String childLocalName = "TestChildLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		
+		OMElement elem = factory.createOMElement(localName,namespace,prefix);
+		OMElement childElem = factory.createOMElement(childLocalName,namespace, prefix);
+		
+		elem.addChild(childElem);
+		
+		Iterator it = elem.getChildrenWithName(new QName(namespace, childLocalName));
+		
+		int count = 0;
+		while (it.hasNext()) {
+			OMElement child = (OMElement) it.next();
+			assertEquals("Child local name mismatch", childLocalName, child.getLocalName());
+			assertEquals("Child namespace mismatch", namespace, child.getNamespace().getName());
+			count ++;
+		}
+		assertEquals("In correct number of children", 1, count );
+	}
+	
+	public void testAppendChild() {
+		try {
+			String elementName = "TestElem";
+			String childElemName = "TestChildElem";
+			String childTextValue = "text value of the child text node";
+			
+			//Apending am Element node
+            DocumentBuilderFactoryImpl.setDOOMRequired(true);
+			Document doc = DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument();
+			Element elem = doc.createElement(elementName);
+			Element childElem = doc.createElement(childElemName);
+			
+			elem.appendChild(childElem);
+			
+			Element addedChild = (Element)elem.getFirstChild();
+			assertNotNull("Child Element node missing",addedChild);
+			assertEquals("Incorre node object", childElem, addedChild);
+			
+			elem = doc.createElement(elementName);
+			Text text = doc.createTextNode(childTextValue);
+			elem.appendChild(text);
+			
+			Text addedTextnode = (Text)elem.getFirstChild();
+			assertNotNull("Child Text node missing", addedTextnode);
+			assertEquals("Incorrect node object", text, addedTextnode);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} finally {
+            DocumentBuilderFactoryImpl.setDOOMRequired(false);      
+        }
+	}
+	
+	/**
+	 * Testing the NodeList returned with the elements's children
+	 */
+	public void testGetElementsbyTagName() {
+		try {
+			String childElementLN = "Child";
+			
+            DocumentBuilderFactoryImpl.setDOOMRequired(true);
+            
+			Document doc = DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument();
+			Element docElem = doc.getDocumentElement();
+			assertNull("The document element shoudl be null", docElem);
+			
+			docElem = doc.createElement("Test");
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			docElem.appendChild(doc.createElement(childElementLN));
+			
+			NodeList list = docElem.getElementsByTagName(childElementLN);
+			
+			assertEquals("Incorrect number of child elements", 7 ,list.getLength());
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} finally {
+            DocumentBuilderFactoryImpl.setDOOMRequired(false);      
+        }
+	}
+	
+	public void testGetElementsbyTagNameNS() {
+		try {
+			String childElementLN = "test:Child";
+			String childElementNS = "http://ws.apache.org/ns/axis2/dom";
+			
+            DocumentBuilderFactoryImpl.setDOOMRequired(true);
+			Document doc = DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder().newDocument();
+			Element docElem = doc.getDocumentElement();
+			assertNull("The document element shoudl be null", docElem);
+			
+			docElem = doc.createElementNS("http://test.org", "test:Test");
+			
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			docElem.appendChild(doc.createElementNS(childElementNS, childElementLN));
+			
+			NodeList list = docElem.getElementsByTagNameNS(childElementNS, childElementLN);
+			
+			assertEquals("Incorrect number of child elements", 7 ,list.getLength());
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		} finally {
+            DocumentBuilderFactoryImpl.setDOOMRequired(false);      
+        }
+	}	
+}

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/MessagesTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/MessagesTest.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/MessagesTest.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/MessagesTest.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+public class MessagesTest extends OMDOMTestCase {
+    SOAPEnvelope soapEnvelope;
+
+    public MessagesTest(String testName) {
+        super(testName);
+    }
+
+    public void testMessageWithLotOfWhiteSpaces() throws OMException,
+            Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/whitespacedMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testMinimalMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/minimalMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testReallyBigMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/reallyReallyBigMessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+    public void testEmptyBodiedMessage() throws OMException, Exception {
+        soapEnvelope =
+                (SOAPEnvelope) OMTestUtils.getOMBuilder(
+                        getTestResourceFile("soap/emtyBodymessage.xml"))
+                .getDocumentElement();
+        OMTestUtils.walkThrough(soapEnvelope);
+    }
+
+
+}

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMFactoryTest.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+
+import javax.xml.namespace.QName;
+
+public class OMDOMFactoryTest extends TestCase{
+
+	public OMDOMFactoryTest() {
+		super();
+	}
+	
+	public OMDOMFactoryTest(String name) {
+		super(name);
+	}
+	
+	public void testCreateElement() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		OMElement elem = factory.createOMElement(localName,namespace,prefix);
+		QName qname = elem.getQName();
+		
+		assertEquals("Localname mismatch",localName,qname.getLocalPart());
+		assertEquals("Namespace mismatch",namespace,qname.getNamespaceURI());
+		assertEquals("namespace prefix mismatch", prefix, qname.getPrefix());
+	}
+
+}

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMTestCase.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMTestCase.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMDOMTestCase.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory;
+import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.FileReader;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class OMDOMTestCase extends AbstractTestCase{
+
+	protected static final String IN_FILE_NAME = "soap/soapmessage.xml";
+    protected StAXSOAPModelBuilder builder;
+    protected OMFactory ombuilderFactory;
+    protected SOAPFactory soapFactory;
+    
+    protected SOAPEnvelope soapEnvelope;
+	
+    public OMDOMTestCase(String testName) {
+		super(testName);
+	}
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        soapEnvelope = (SOAPEnvelope) getOMBuilder("").getDocumentElement();
+    }
+	
+    protected StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {
+        if ("".equals(fileName) || fileName == null) {
+            fileName = IN_FILE_NAME;
+        }
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(
+                        new FileReader(getTestResourceFile(fileName)));
+        builder = new StAXSOAPModelBuilder(parser, new SOAP11Factory(), null);
+        return builder;
+    }
+    
+    
+
+    protected StAXSOAPModelBuilder getOMBuilder(InputStream in) throws Exception {
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(in);
+        builder = new StAXSOAPModelBuilder(parser, new DOMSOAPFactory(), null);
+        return builder;
+    }
+
+    protected XMLStreamWriter getStAXStreamWriter(OutputStream out) throws XMLStreamException {
+        return XMLOutputFactory.newInstance().createXMLStreamWriter(out);
+    }
+}

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMTestUtils.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMTestUtils.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMTestUtils.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/OMTestUtils.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.Iterator;
+
+public class OMTestUtils {
+    public static OMXMLParserWrapper getOMBuilder(File file) throws Exception {
+        XMLStreamReader parser = XMLInputFactory.newInstance()
+                .createXMLStreamReader(new FileReader(file));
+        return OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+                new SOAP11Factory(), parser);
+    }
+
+    public static void walkThrough(OMElement omEle) {
+        Iterator attibIt = omEle.getAllAttributes();
+        if (attibIt != null) {
+            while (attibIt.hasNext()) {
+                TestCase.assertNotNull("once the has next is not null, the " +
+                        "element should not be null",
+                        attibIt.next());
+            }
+        }
+        Iterator it = omEle.getChildren();
+        if (it != null) {
+            while (it.hasNext()) {
+                OMNode ele = (OMNode) it.next();
+                TestCase.assertNotNull("once the has next is not null, the " +
+                        "element should not be null", ele);
+                if (ele instanceof OMElement) {
+                    walkThrough((OMElement) ele);
+                }
+            }
+        }
+    }
+
+    public static void compare(Element ele, OMElement omele) throws Exception {
+        if (ele == null && omele == null) {
+            return;
+        } else if (ele != null && omele != null) {
+            TestCase.assertEquals("Element name not correct",
+                    ele.getLocalName(),
+                    omele.getLocalName());
+            if (omele.getNamespace() != null) {
+                TestCase.assertEquals("Namespace URI not correct",
+                        ele.getNamespaceURI(),
+                        omele.getNamespace().getName());
+
+            }
+
+            //go through the attributes
+            NamedNodeMap map = ele.getAttributes();
+            Iterator attIterator = omele.getAllAttributes();
+            OMAttribute omattribute;
+            while (attIterator != null && attIterator.hasNext() && map == null) {
+                omattribute = (OMAttribute) attIterator.next();
+                Node node = map.getNamedItemNS(
+                        omattribute.getNamespace().getName(),
+                        omattribute.getLocalName());
+                if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
+                    Attr attr = (Attr) node;
+                    TestCase.assertEquals(attr.getValue(),
+                            omattribute.getAttributeValue());
+                } else {
+                    throw new OMException("return type is not a Attribute");
+                }
+
+            }
+            Iterator it = omele.getChildren();
+            NodeList list = ele.getChildNodes();
+            for (int i = 0; i < list.getLength(); i++) {
+                Node node = list.item(i);
+                if (node.getNodeType() == Node.ELEMENT_NODE) {
+                    TestCase.assertTrue(it.hasNext());
+                    OMNode tempOmNode = (OMNode) it.next();
+                    while (tempOmNode.getType() != OMNode.ELEMENT_NODE) {
+                        TestCase.assertTrue(it.hasNext());
+                        tempOmNode = (OMNode) it.next();
+                    }
+                    compare((Element) node, (OMElement) tempOmNode);
+                }
+            }
+
+
+        } else {
+            throw new Exception("One is null");
+        }
+    }
+
+    public static SOAPEnvelope createOM(File file) throws Exception {
+        return (SOAPEnvelope) getOMBuilder(file).getDocumentElement();
+    }
+
+}

Added: webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/TextImplTest.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/TextImplTest.java?rev=389047&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/TextImplTest.java (added)
+++ webservices/commons/trunk/modules/axiom/test/org/apache/axiom/om/impl/dom/TextImplTest.java Mon Mar 27 00:02:06 2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axiom.om.impl.dom;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
+import org.w3c.dom.Text;
+
+public class TextImplTest extends TestCase {
+
+	public TextImplTest() {
+		super();
+	}
+
+	public TextImplTest(String name) {
+		super(name);
+	}
+
+	public void testSetText() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		String tempText = "The quick brown fox jumps over the lazy dog";
+
+		OMElement elem = factory.createOMElement(localName, namespace, prefix);
+		OMText textNode = factory.createText(elem, tempText);
+
+		assertEquals("Text value mismatch", tempText, textNode.getText());
+	}
+
+	public void testAppendText() {
+		OMDOMFactory factory = new OMDOMFactory();
+		String localName = "TestLocalName";
+		String namespace = "http://ws.apache.org/axis2/ns";
+		String prefix = "axis2";
+		String tempText = "The quick brown fox jumps over the lazy dog";
+		String textToAppend = " followed by another fox";
+
+		OMElement elem = factory.createOMElement(localName, namespace, prefix);
+		OMText textNode = factory.createText(elem, tempText);
+
+		((Text) textNode).appendData(textToAppend);
+
+		assertEquals("Text value mismatch", tempText + textToAppend, textNode
+				.getText());
+	}
+
+	public void testSplitText() {
+		String textValue = "temp text value";
+
+        OMDOMFactory fac = new OMDOMFactory();
+        DocumentImpl doc = new DocumentImpl(fac);
+
+		Text txt = doc.createTextNode(textValue);
+		txt.splitText(3);
+
+		assertNotNull("Text value missing in the original Text node", txt
+				.getNodeValue());
+
+		assertNotNull("Sibling missing after split", txt.getNextSibling());
+		assertNotNull("Text value missing in the new split Text node", txt
+				.getNextSibling().getNodeValue());
+
+		assertEquals("Incorrect split point", textValue.substring(0, 3), txt
+				.getNodeValue());
+		assertEquals("Incorrect split point", textValue.substring(3, textValue
+				.length()), txt.getNextSibling().getNodeValue());
+
+	}
+
+}