axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r329804 - in /webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2: om/impl/dom/ om/impl/dom/factory/ soap/impl/dom/
Date Mon, 31 Oct 2005 11:59:10 GMT
Author: ruchithf
Date: Mon Oct 31 03:58:39 2005
New Revision: 329804

URL: http://svn.apache.org/viewcvs?rev=329804&view=rev
Log:
Adding the org.apache.axis2.soap.impl.dom.* stuff ... most of the code is copied over from the llom impl


Added:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPBodyImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPElement.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultDetailImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultNodeImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultRoleImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultTextImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultValueImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderBlockImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPMessageImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPTextImpl.java
Modified:
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java?rev=329804&r1=329803&r2=329804&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/DocumentImpl.java Mon Oct 31 03:58:39 2005
@@ -20,6 +20,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMXMLParserWrapper;
 import org.apache.axis2.om.impl.OMOutputImpl;
 import org.apache.axis2.om.impl.dom.util.XMLChar;
 import org.w3c.dom.Attr;
@@ -55,6 +56,11 @@
 	 */
 	public DocumentImpl(DocumentImpl ownerDocument) {
 		super(ownerDocument);
+	}
+	
+	public DocumentImpl(OMXMLParserWrapper parserWrapper) {
+		ElementImpl docElem = (ElementImpl)parserWrapper.getDocumentElement();
+		this.appendChild(docElem);
 	}
 
 	public DocumentImpl() {

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java?rev=329804&r1=329803&r2=329804&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/ElementImpl.java Mon Oct 31 03:58:39 2005
@@ -47,7 +47,7 @@
  * interfaces.
  * @author Ruchith Fernando (ruchith.fernando@gmail.com)
  */
-public class ElementImpl extends ParentNode implements Element,OMElement {
+public class ElementImpl extends ParentNode implements Element,OMElement, OMConstants {
 	
 	protected OMNamespace namespace;
 	protected String localName;

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java?rev=329804&r1=329803&r2=329804&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/om/impl/dom/factory/OMDOMFactory.java Mon Oct 31 03:58:39 2005
@@ -228,4 +228,8 @@
 		throw new UnsupportedOperationException("TODO");
 	}
 	
+	public DocumentImpl getDocument() {
+		return this.document;
+	}
+	
 }

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPBodyImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPBodyImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPBodyImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,150 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMConstants;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPConstants;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.llom.SOAPElement;
+import org.apache.axis2.soap.impl.llom.SOAPEnvelopeImpl;
+
+public abstract class SOAPBodyImpl extends SOAPElement implements SOAPBody,
+		OMConstants {
+
+	/**
+	 * Field hasSOAPFault
+	 */
+	private boolean hasSOAPFault = false;
+
+	/**
+	 * @param envelope
+	 */
+	public SOAPBodyImpl(SOAPEnvelope envelope) throws SOAPProcessingException {
+		super(envelope, SOAPConstants.BODY_LOCAL_NAME, true);
+
+	}
+
+	/**
+	 * Constructor SOAPBodyImpl
+	 *
+	 * @param envelope
+	 * @param builder
+	 */
+	public SOAPBodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+		super(envelope, SOAPConstants.BODY_LOCAL_NAME, builder);
+	}
+
+	/**
+	 * Creates a new <code>SOAPFault</code> object and adds it to
+	 * this <code>SOAPBody</code> object.
+	 *
+	 * @param e
+	 * @return the new <code>SOAPFault</code> object
+	 * @throws org.apache.axis2.om.OMException
+	 *                     if there is a SOAP error
+	 * @throws OMException
+	 */
+	public abstract SOAPFault addFault(Exception e) throws OMException;
+
+	/**
+	 * Indicates whether a <code>SOAPFault</code> object exists in
+	 * this <code>SOAPBody</code> object.
+	 *
+	 * @return <code>true</code> if a <code>SOAPFault</code> object exists in
+	 *         this <code>SOAPBody</code> object; <code>false</code>
+	 *         otherwise
+	 */
+	public boolean hasFault() {
+		if (hasSOAPFault) {
+			return true;
+		} else {
+			OMElement element = getFirstElement();
+			if (element != null
+					&& SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element
+							.getLocalName())
+					&& (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
+							.equals(element.getNamespace().getName()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
+							.equals(element.getNamespace().getName()))) { //added this line
+				hasSOAPFault = true;
+				return true;
+			} else {
+				return false;
+			}
+		}
+	}
+
+	/**
+	 * Returns the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+	 * object.
+	 *
+	 * @return the <code>SOAPFault</code> object in this <code>SOAPBody</code>
+	 *         object
+	 */
+	public SOAPFault getFault() {
+		OMElement element = getFirstElement();
+		if (hasSOAPFault) {
+			return (SOAPFault) element;
+		} else if (element != null
+				&& SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element
+						.getLocalName())
+				&& (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(element
+						.getNamespace().getName()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
+						.equals(element.getNamespace().getName()))) { //added this line
+			hasSOAPFault = true;
+			return (SOAPFault) element;
+		} else {
+			return null;
+		}
+
+	}
+
+	/**
+	 * @param soapFault
+	 * @throws org.apache.axis2.om.OMException
+	 *
+	 * @throws OMException
+	 */
+	public void addFault(SOAPFault soapFault) throws OMException {
+		if (hasSOAPFault) {
+			throw new OMException(
+					"SOAP Body already has a SOAP Fault and there can not be more than one SOAP fault");
+		}
+		addChild(soapFault);
+		hasSOAPFault = true;
+	}
+
+	protected void checkParent(OMElement parent) throws SOAPProcessingException {
+		if (!(parent instanceof SOAPEnvelopeImpl)) {
+			throw new SOAPProcessingException(
+					"Expecting an implementation of SOAP Envelope as the parent. But received some other implementation");
+		}
+	}
+
+	public OMNode detach() throws OMException {
+		throw new SOAPProcessingException(
+				"Can not detach SOAP Body, SOAP Envelope must have a Body !!");
+	}
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPElement.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPElement.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPElement.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,82 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.dom.DocumentImpl;
+import org.apache.axis2.om.impl.dom.ElementImpl;
+import org.apache.axis2.om.impl.dom.NamespaceImpl;
+import org.apache.axis2.om.impl.dom.ParentNode;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+public abstract class SOAPElement extends ElementImpl {
+
+
+    /**
+     * @param parent
+     * @param parent
+     */
+    protected SOAPElement(OMElement parent,
+                          String localName,
+                          boolean extractNamespaceFromParent) throws SOAPProcessingException {
+        super((ParentNode)parent, localName, null);
+        if (parent == null) {
+            throw new SOAPProcessingException(
+                    " Can not create " + localName +
+                    " element without a parent !!");
+        }
+        checkParent(parent);
+
+        if (extractNamespaceFromParent) {
+            this.namespace = parent.getNamespace();
+        }
+        this.localName = localName;
+    }
+
+
+    protected SOAPElement(OMElement parent,
+                          String localName,
+                          OMXMLParserWrapper builder) {
+        super((ParentNode)parent, localName, null, builder);
+    }
+
+    protected SOAPElement(DocumentImpl doc, String localName,OMNamespace ns) {
+		super(doc, localName, (NamespaceImpl)ns);
+	}
+    
+// /**
+// * Caution : This Constructor is meant to be used only by the SOAPEnvelope.
+//     * <p/>
+//     * Reasons : This can be used to create a SOAP Element programmatically. But we need to make sure that the user
+//     * always passes a parent for the element being created. But SOAP Envelope has no parent.
+//     *
+//     * @param localName
+//     * @param ns
+//     */
+//    protected SOAPElement(String localName, OMNamespace ns) {
+//        super(localName, ns);
+//
+//    }
+
+    /**
+     * This has to be implemented by all the derived classes to check for the correct parent.
+     */
+    protected abstract void checkParent(OMElement parent) throws SOAPProcessingException;
+
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPEnvelopeImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,184 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMConstants;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPConstants;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.dom.SOAPElement;
+import org.apache.axis2.soap.impl.dom.factory.DOMSOAPFactory;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+public class SOAPEnvelopeImpl extends SOAPElement implements SOAPEnvelope,
+		OMConstants {
+
+	SOAPFactory factory;
+
+	/**
+	 * @param builder
+	 */
+	public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) {
+		super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder);
+		this.factory = factory;
+	}
+
+	/**
+	 * @param ns
+	 */
+	public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
+		super(((DOMSOAPFactory) factory).getDocument(),
+				SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns);
+		this.factory = factory;
+	}
+
+	/**
+	 * Returns the <CODE>SOAPHeader</CODE> object for this <CODE> SOAPEnvelope</CODE>
+	 * object.
+	 * <P>
+	 * This SOAPHeader will just be a container for all the headers in the
+	 * <CODE>OMMessage</CODE>
+	 * </P>
+	 * 
+	 * @return the <CODE>SOAPHeader</CODE> object or <CODE> null</CODE> if
+	 *         there is none
+	 * @throws org.apache.axis2.om.OMException
+	 *             if there is a problem obtaining the <CODE>SOAPHeader</CODE>
+	 *             object
+	 * @throws OMException
+	 */
+	public SOAPHeader getHeader() throws OMException {
+		SOAPHeader header = (SOAPHeader) getFirstChildWithName(new QName(
+				SOAPConstants.HEADER_LOCAL_NAME));
+		if (builder == null && header == null) {
+			header = factory.createSOAPHeader(this);
+			addChild(header);
+		}
+		return header;
+	}
+
+	/**
+	 * Convenience method to add a SOAP header to this envelope
+	 * 
+	 * @param namespaceURI
+	 * @param name
+	 */
+	public SOAPHeaderBlock addHeader(String namespaceURI, String name)
+			throws OMException {
+		// TODO : cache SOAP header and body instead of looking them up?
+
+		SOAPHeader headerContainer = getHeader();
+		OMNamespace namespace = factory.createOMNamespace(namespaceURI, null);
+		return factory.createSOAPHeaderBlock(name, namespace, headerContainer);
+	}
+
+	public void addChild(OMNode child) {
+		if ((child instanceof OMElement)
+				&& !(child instanceof SOAPHeader || child instanceof SOAPBody)) {
+			throw new SOAPProcessingException(
+					"SOAP Envelope can not have children other than SOAP Header and Body",
+					SOAP12Constants.FAULT_CODE_SENDER);
+		} else {
+			super.addChild(child);
+		}
+	}
+
+	/**
+	 * Returns the <CODE>SOAPBody</CODE> object associated with this <CODE>SOAPEnvelope</CODE>
+	 * object.
+	 * <P>
+	 * This SOAPBody will just be a container for all the BodyElements in the
+	 * <CODE>OMMessage</CODE>
+	 * </P>
+	 * 
+	 * @return the <CODE>SOAPBody</CODE> object for this <CODE> SOAPEnvelope</CODE>
+	 *         object or <CODE>null</CODE> if there is none
+	 * @throws org.apache.axis2.om.OMException
+	 *             if there is a problem obtaining the <CODE>SOAPBody</CODE>
+	 *             object
+	 * @throws OMException
+	 */
+	public SOAPBody getBody() throws OMException {
+		// check for the first element
+		OMElement element = getFirstElement();
+		if (element != null) {
+			if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
+				return (SOAPBody) element;
+			} else { // if not second element SHOULD be the body
+				OMNode node = element.getNextOMSibling();
+				while (node != null && node.getType() != OMNode.ELEMENT_NODE) {
+					node = node.getNextOMSibling();
+				}
+				element = (OMElement) node;
+
+				if (node != null
+						&& SOAPConstants.BODY_LOCAL_NAME.equals(element
+								.getLocalName())) {
+					return (SOAPBody) element;
+				} else {
+					throw new OMException(
+							"SOAPEnvelope must contain a body element which is either first or second child element of the SOAPEnvelope.");
+				}
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Method detach
+	 * 
+	 * @throws OMException
+	 */
+	public OMNode detach() throws OMException {
+		throw new OMException("Root Element can not be detached");
+	}
+
+	protected void checkParent(OMElement parent) throws SOAPProcessingException {
+		// here do nothing as SOAPEnvelope doesn't have a parent !!!
+	}
+
+	protected void serialize(OMOutputImpl omOutput, boolean cache)
+			throws XMLStreamException {
+
+		if (!omOutput.isIgnoreXMLDeclaration()) {
+			String charSetEncoding = omOutput.getCharSetEncoding();
+			String xmlVersion = omOutput.getXmlVersion();
+			omOutput
+					.getXmlStreamWriter()
+					.writeStartDocument(
+							charSetEncoding == null ? OMConstants.DEFAULT_CHAR_SET_ENCODING
+									: charSetEncoding,
+							xmlVersion == null ? OMConstants.DEFAULT_XML_VERSION
+									: xmlVersion);
+		}
+		super.serialize(omOutput, cache);
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultCodeImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,123 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.om.impl.llom.OMSerializerUtil;
+import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.soap.SOAPFaultCode;
+import org.apache.axis2.soap.SOAPFaultSubCode;
+import org.apache.axis2.soap.SOAPFaultValue;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.dom.SOAPElement;
+import org.apache.axis2.soap.impl.llom.util.UtilProvider;
+
+import javax.xml.stream.XMLStreamException;
+
+public abstract class SOAPFaultCodeImpl  extends SOAPElement implements SOAPFaultCode{
+
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     */
+    public SOAPFaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, builder);
+    }
+
+    /**
+     * @param parent
+     * @param parent
+     */
+    public SOAPFaultCodeImpl(SOAPFault parent,
+                             boolean extractNamespaceFromParent) throws SOAPProcessingException {
+        super(parent,
+                SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME,
+                extractNamespaceFromParent);
+    }
+
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
+        UtilProvider.setNewElement(this, value, value);
+    }
+
+    public SOAPFaultValue getValue() {
+        return (SOAPFaultValue) UtilProvider.getChildWithName(this,
+                SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
+    }
+
+    public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException {
+        UtilProvider.setNewElement(this, getSubCode(), value);
+    }
+
+    public SOAPFaultSubCode getSubCode() {
+        return (SOAPFaultSubCode) UtilProvider.getChildWithName(this,
+                SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+    }
+
+    protected void serialize(OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput));
+        }
+
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, omOutput);
+                firstChild.serializeAndConsume(omOutput);
+                OMSerializerUtil.serializeEndpart(omOutput);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, omOutput);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, omOutput);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(omOutput);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, omOutput, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, omOutput, cache);
+
+            // do not serialise the siblings
+        }
+
+
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultDetailImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultDetailImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultDetailImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultDetailImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,97 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.OMSerializerUtil;
+import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.soap.SOAPFaultDetail;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.llom.SOAPElement;
+
+import java.util.Iterator;
+
+import javax.xml.stream.XMLStreamException;
+
+public abstract class SOAPFaultDetailImpl extends SOAPElement implements SOAPFaultDetail {
+
+    protected SOAPFaultDetailImpl(SOAPFault parent,
+                                  boolean extractNamespaceFromParent) throws SOAPProcessingException {
+        super(parent,
+                SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,
+                extractNamespaceFromParent);
+    }
+
+    protected SOAPFaultDetailImpl(SOAPFault parent,
+                                  OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, builder);
+    }
+
+    public void addDetailEntry(OMElement detailElement) {
+        this.addChild(detailElement);
+    }
+
+    public Iterator getAllDetailEntries() {
+        return this.getChildren();
+    }
+
+    protected void serialize(org.apache.axis2.om.impl.OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput));
+        }
+
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, omOutput);
+                firstChild.serializeAndConsume(omOutput);
+                OMSerializerUtil.serializeEndpart(omOutput);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, omOutput);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, omOutput);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(omOutput);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, omOutput, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, omOutput, cache);
+
+            // do not serialise the siblings
+        }
+
+
+    }
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,240 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMConstants;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.dom.ElementImpl;
+import org.apache.axis2.om.impl.dom.NamespaceImpl;
+import org.apache.axis2.om.impl.dom.ParentNode;
+import org.apache.axis2.om.impl.llom.OMSerializerUtil;
+import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPConstants;
+import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.soap.SOAPFaultCode;
+import org.apache.axis2.soap.SOAPFaultDetail;
+import org.apache.axis2.soap.SOAPFaultNode;
+import org.apache.axis2.soap.SOAPFaultReason;
+import org.apache.axis2.soap.SOAPFaultRole;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+public abstract class SOAPFaultImpl extends SOAPElement implements SOAPFault,
+		OMConstants {
+
+	protected Exception e;
+	/**
+	 * Constructor SOAPFaultImpl
+	 * 
+	 * @param parent
+	 * @param e
+	 */
+	public SOAPFaultImpl(SOAPBody parent, Exception e)
+			throws SOAPProcessingException {
+		super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true);
+		setException(e);
+	}
+
+	public void setException(Exception e) {
+		this.e = e;
+		putExceptionToSOAPFault(e);
+	}
+
+	public SOAPFaultImpl(SOAPBody parent) throws SOAPProcessingException {
+		super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true);
+	}
+
+	/**
+	 * Constructor SOAPFaultImpl
+	 * 
+	 * @param parent
+	 * @param builder
+	 */
+	public SOAPFaultImpl(SOAPBody parent, OMXMLParserWrapper builder) {
+		super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, builder);
+	}
+
+	protected abstract SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault)
+			throws SOAPProcessingException;
+
+	// --------------- Getters and Settors --------------------------- //
+
+	public void setCode(SOAPFaultCode soapFaultCode)
+			throws SOAPProcessingException {
+		setNewElement(getCode(), soapFaultCode);
+	}
+
+	public SOAPFaultCode getCode() {
+		return (SOAPFaultCode) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
+	}
+
+	public void setReason(SOAPFaultReason reason)
+			throws SOAPProcessingException {
+		setNewElement(getReason(), reason);
+	}
+
+	public SOAPFaultReason getReason() {
+		return (SOAPFaultReason) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME);
+	}
+
+	public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+		setNewElement(getNode(), node);
+	}
+
+	public SOAPFaultNode getNode() {
+		return (SOAPFaultNode) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME);
+	}
+
+	public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+		setNewElement(getRole(), role);
+	}
+
+	public SOAPFaultRole getRole() {
+		return (SOAPFaultRoleImpl) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME);
+	}
+
+	public void setDetail(SOAPFaultDetail detail)
+			throws SOAPProcessingException {
+		setNewElement(getDetail(), detail);
+	}
+
+	public SOAPFaultDetail getDetail() {
+		return (SOAPFaultDetail) this
+				.getChildWithName(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
+	}
+
+	/**
+	 * If exception detailElement is not there we will return null
+	 */
+	public Exception getException() throws OMException {
+		SOAPFaultDetail detail = getDetail();
+		if (detail == null) {
+			return null;
+		}
+
+		OMElement exceptionElement = getDetail().getFirstChildWithName(
+				new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
+		if (exceptionElement != null && exceptionElement.getText() != null) {
+			return new Exception(exceptionElement.getText());
+		}
+		return null;
+	}
+
+	protected void putExceptionToSOAPFault(Exception e)
+			throws SOAPProcessingException {
+		StringWriter sw = new StringWriter();
+		e.printStackTrace(new PrintWriter(sw));
+		sw.flush();
+		getDetail();
+		if (getDetail() == null) {
+			setDetail(getNewSOAPFaultDetail(this));
+
+		}
+		OMElement faultDetailEnty = new ElementImpl((ParentNode) this,
+				SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY,
+				(NamespaceImpl) this.namespace);
+		faultDetailEnty.setText(sw.getBuffer().toString());
+	}
+
+	protected void setNewElement(OMElement myElement, OMElement newElement) {
+		if (myElement != null) {
+			myElement.discard();
+		}
+		if (newElement != null && newElement.getParent() != null) {
+			newElement.discard();
+		}
+		this.addChild(newElement);
+		myElement = newElement;
+	}
+
+	protected OMElement getChildWithName(String childName) {
+		Iterator childrenIter = getChildren();
+		while (childrenIter.hasNext()) {
+			OMNode node = (OMNode) childrenIter.next();
+			if (node.getType() == OMNode.ELEMENT_NODE
+					&& childName.equals(((OMElement) node).getLocalName())) {
+				return (OMElement) node;
+			}
+		}
+		return null;
+	}
+
+	protected void serialize(org.apache.axis2.om.impl.OMOutputImpl omOutput,
+			boolean cache) throws XMLStreamException {
+		// select the builder
+		short builderType = PULL_TYPE_BUILDER; // default is pull type
+		if (builder != null) {
+			builderType = this.builder.getBuilderType();
+		}
+		if ((builderType == PUSH_TYPE_BUILDER)
+				&& (builder.getRegisteredContentHandler() == null)) {
+			builder
+					.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(
+							omOutput));
+		}
+
+		// this is a special case. This fault element may contain its children
+		// in any order. But spec mandates a specific order
+		// the overriding of the method will facilitate that. Not sure this is
+		// the best method to do this :(
+		build();
+
+		OMSerializerUtil.serializeStartpart(this, omOutput);
+		SOAPFaultCode faultCode = getCode();
+		if (faultCode != null) {
+			faultCode.serialize(omOutput);
+		}
+		SOAPFaultReason faultReason = getReason();
+		if (faultReason != null) {
+			faultReason.serialize(omOutput);
+		}
+
+		serializeFaultNode(omOutput);
+
+		SOAPFaultRole faultRole = getRole();
+		if (faultRole != null) {
+			faultRole.serialize(omOutput);
+		}
+
+		SOAPFaultDetail faultDetail = getDetail();
+		if (faultDetail != null) {
+			faultDetail.serialize(omOutput);
+		}
+
+		OMSerializerUtil.serializeEndpart(omOutput);
+	}
+
+	protected abstract void serializeFaultNode(
+			org.apache.axis2.om.impl.OMOutputImpl omOutput)
+			throws XMLStreamException;
+
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultNodeImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultNodeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultNodeImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,90 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.OMSerializerUtil;
+import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.soap.SOAPFaultNode;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+
+public abstract class SOAPFaultNodeImpl extends SOAPElement implements SOAPFaultNode {
+
+    public SOAPFaultNodeImpl(SOAPFault parent) throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, true);
+    }
+
+    public SOAPFaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, builder);
+    }
+
+    public void setNodeValue(String uri) {
+        this.setText(uri);
+    }
+
+    public String getNodeValue() {
+        return this.getText();
+    }
+
+    protected void serialize(org.apache.axis2.om.impl.OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+            // select the builder
+            short builderType = PULL_TYPE_BUILDER;    // default is pull type
+            if (builder != null) {
+                builderType = this.builder.getBuilderType();
+            }
+            if ((builderType == PUSH_TYPE_BUILDER)
+                    && (builder.getRegisteredContentHandler() == null)) {
+                builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput));
+            }
+
+
+            if (!cache) {
+                //No caching
+                if (this.firstChild != null) {
+                    OMSerializerUtil.serializeStartpart(this, omOutput);
+                    firstChild.serializeAndConsume(omOutput);
+                    OMSerializerUtil.serializeEndpart(omOutput);
+                } else if (!this.done) {
+                    if (builderType == PULL_TYPE_BUILDER) {
+                        OMSerializerUtil.serializeByPullStream(this, omOutput);
+                    } else {
+                        OMSerializerUtil.serializeStartpart(this, omOutput);
+                        builder.setCache(cache);
+                        builder.next();
+                        OMSerializerUtil.serializeEndpart(omOutput);
+                    }
+                } else {
+                    OMSerializerUtil.serializeNormal(this, omOutput, cache);
+                }
+                // do not serialise the siblings
+
+
+            } else {
+                //Cached
+                OMSerializerUtil.serializeNormal(this, omOutput, cache);
+
+                // do not serialise the siblings
+            }
+
+
+        }
+
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultReasonImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,109 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.OMSerializerUtil;
+import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.soap.SOAPFaultReason;
+import org.apache.axis2.soap.SOAPFaultText;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.llom.util.UtilProvider;
+
+import javax.xml.stream.XMLStreamException;
+
+public abstract class SOAPFaultReasonImpl extends SOAPElement implements SOAPFaultReason {
+    protected SOAPFaultText text;
+
+    /**
+     * Constructor OMElementImpl
+     *
+     * @param parent
+     * @param builder
+     */
+    public SOAPFaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, builder);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAPFaultReasonImpl(OMElement parent,
+                               boolean extractNamespaceFromParent) throws SOAPProcessingException {
+        super(parent,
+                SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME,
+                extractNamespaceFromParent);
+    }
+
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    public void setSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
+        UtilProvider.setNewElement(this, text, soapFaultText);
+    }
+
+    public SOAPFaultText getSOAPText() {
+        return (SOAPFaultText) UtilProvider.getChildWithName(this,
+                SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME);
+    }
+
+    protected void serialize(org.apache.axis2.om.impl.OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput));
+        }
+
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, omOutput);
+                firstChild.serializeAndConsume(omOutput);
+                OMSerializerUtil.serializeEndpart(omOutput);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, omOutput);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, omOutput);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(omOutput);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, omOutput, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, omOutput, cache);
+
+            // do not serialise the siblings
+        }
+
+
+    }
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultRoleImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultRoleImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultRoleImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultRoleImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,94 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.om.impl.llom.OMSerializerUtil;
+import org.apache.axis2.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+
+
+public abstract class SOAPFaultRoleImpl extends SOAPElement implements org.apache.axis2.soap.SOAPFaultRole {
+
+    public SOAPFaultRoleImpl(SOAPFault parent,
+                             boolean extractNamespaceFromParent) throws SOAPProcessingException {
+        super(parent,
+                SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME,
+                extractNamespaceFromParent);
+    }
+
+    public SOAPFaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME, builder);
+    }
+
+    public void setRoleValue(String uri) {
+        this.setText(uri);
+    }
+
+    public String getRoleValue() {
+        return this.getText();
+    }
+
+    protected void serialize(OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+        // select the builder
+        short builderType = PULL_TYPE_BUILDER;    // default is pull type
+        if (builder != null) {
+            builderType = this.builder.getBuilderType();
+        }
+        if ((builderType == PUSH_TYPE_BUILDER)
+                && (builder.getRegisteredContentHandler() == null)) {
+            builder.registerExternalContentHandler(new StreamWriterToContentHandlerConverter(omOutput));
+        }
+
+
+        if (!cache) {
+            //No caching
+            if (this.firstChild != null) {
+                OMSerializerUtil.serializeStartpart(this, omOutput);
+                firstChild.serializeAndConsume(omOutput);
+                OMSerializerUtil.serializeEndpart(omOutput);
+            } else if (!this.done) {
+                if (builderType == PULL_TYPE_BUILDER) {
+                    OMSerializerUtil.serializeByPullStream(this, omOutput);
+                } else {
+                    OMSerializerUtil.serializeStartpart(this, omOutput);
+                    builder.setCache(cache);
+                    builder.next();
+                    OMSerializerUtil.serializeEndpart(omOutput);
+                }
+            } else {
+                OMSerializerUtil.serializeNormal(this, omOutput, cache);
+            }
+            // do not serialise the siblings
+
+
+        } else {
+            //Cached
+            OMSerializerUtil.serializeNormal(this, omOutput, cache);
+
+            // do not serialise the siblings
+        }
+
+
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultSubCodeImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,69 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFaultSubCode;
+import org.apache.axis2.soap.SOAPFaultValue;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.llom.util.UtilProvider;
+
+public abstract class SOAPFaultSubCodeImpl extends SOAPElement implements SOAPFaultSubCode {
+
+    protected SOAPFaultValue value;
+    protected SOAPFaultSubCode subCode;
+
+
+    protected SOAPFaultSubCodeImpl(OMElement parent, String localName) throws SOAPProcessingException {
+        super(parent, localName, true);
+    }
+
+    protected SOAPFaultSubCodeImpl(OMElement parent,
+                                   String localName,
+                                   OMXMLParserWrapper builder) {
+        super(parent, localName, builder);
+    }
+
+    public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {
+        UtilProvider.setNewElement(this, value, soapFaultSubCodeValue);
+    }
+
+    public SOAPFaultValue getValue() {
+        if (value == null) {
+            value =
+                    (SOAPFaultValue) UtilProvider.getChildWithName(this,
+                            SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
+        }
+        return value;
+    }
+
+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+        UtilProvider.setNewElement(this, this.subCode, subCode);
+
+    }
+
+    public SOAPFaultSubCode getSubCode() {
+        if (subCode == null) {
+            subCode =
+                    (SOAPFaultSubCode) UtilProvider.getChildWithName(this,
+                            SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+        }
+        return subCode;
+    }
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultTextImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultTextImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultTextImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,70 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.dom.AttrImpl;
+import org.apache.axis2.om.impl.dom.factory.OMDOMFactory;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFaultReason;
+import org.apache.axis2.soap.SOAPFaultText;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+import javax.xml.namespace.QName;
+
+public abstract class SOAPFaultTextImpl extends SOAPElement implements SOAPFaultText {
+    protected OMAttribute langAttr;
+    protected OMNamespace langNamespace = new OMDOMFactory()
+            .createOMNamespace(
+                    SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI,
+                    SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX);
+
+    protected SOAPFaultTextImpl(SOAPFaultReason parent) throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true);
+    }
+
+    protected SOAPFaultTextImpl(SOAPFaultReason parent,
+                                OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder);
+    }
+
+
+    public void setLang(String lang) {
+        //langAttr = new OMAttributeImpl(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, parent.getNamespace(), lang);
+        langAttr =
+                new AttrImpl(
+                        SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME,
+                        langNamespace,
+                        lang);
+        this.addAttribute(langAttr);
+    }
+
+    public String getLang() {
+        if (langAttr == null) {
+            //langAttr = this.getFirstAttribute(new QName(SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME, parent.getNamespace().getName()));
+            langAttr =
+                    this.getFirstAttribute(
+                            new QName(langNamespace.getName(),
+                                    SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_LOCAL_NAME,
+                                    SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX));
+        }
+
+        return langAttr == null ? null : langAttr.getAttributeValue();
+    }
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultValueImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultValueImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultValueImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPFaultValueImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,34 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPFaultValue;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+public abstract class SOAPFaultValueImpl extends SOAPElement implements SOAPFaultValue {
+
+    protected SOAPFaultValueImpl(OMElement parent) throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, true);
+    }
+
+    protected SOAPFaultValueImpl(OMElement parent, OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, builder);
+    }
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderBlockImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderBlockImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderBlockImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,105 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.dom.AttrImpl;
+import org.apache.axis2.om.impl.dom.ElementImpl;
+import org.apache.axis2.om.impl.dom.NamespaceImpl;
+import org.apache.axis2.om.impl.dom.ParentNode;
+import org.apache.axis2.soap.SOAPConstants;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+import javax.xml.namespace.QName;
+
+public abstract class SOAPHeaderBlockImpl  extends ElementImpl implements SOAPHeaderBlock {
+
+    private boolean processed = false;
+
+    /**
+     * @param localName
+     * @param ns
+     */
+    public SOAPHeaderBlockImpl(String localName,
+                               OMNamespace ns,
+                               SOAPHeader parent) throws SOAPProcessingException {
+        super((ParentNode)parent, localName,(NamespaceImpl) ns);
+        this.setNamespace(ns);
+    }
+
+    /**
+     * Constructor SOAPHeaderBlockImpl
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     */
+    public SOAPHeaderBlockImpl(String localName, OMNamespace ns,
+                               OMElement parent, OMXMLParserWrapper builder) {
+        super((ParentNode)parent, localName, (NamespaceImpl)ns, builder);
+        this.setNamespace(ns);
+    }
+
+    /**
+     * @param attributeName
+     * @param attrValue
+     */
+    protected void setAttribute(String attributeName,
+                                String attrValue,
+                                String soapEnvelopeNamespaceURI) {
+        OMAttribute omAttribute = this.getFirstAttribute(
+                new QName(soapEnvelopeNamespaceURI, attributeName));
+        if (omAttribute != null) {
+            omAttribute.setAttributeValue(attrValue);
+        } else {
+            OMAttribute attribute = new AttrImpl(attributeName,
+                    new NamespaceImpl(soapEnvelopeNamespaceURI,
+                            SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX),
+                    attrValue);
+            this.addAttribute(attribute);
+        }
+    }
+
+    /**
+     * Method getAttribute
+     *
+     * @param attrName
+     * @return
+     */
+    protected String getAttribute(String attrName,
+                                  String soapEnvelopeNamespaceURI) {
+        OMAttribute omAttribute = this.getFirstAttribute(
+                new QName(soapEnvelopeNamespaceURI, attrName));
+        return (omAttribute != null)
+                ? omAttribute.getAttributeValue()
+                : null;
+    }
+
+    public boolean isProcessed() {
+        return processed;
+    }
+
+    public void setProcessed() {
+        processed = true;
+    }
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPHeaderImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,225 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAPConstants;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.dom.SOAPElement;
+import org.apache.axis2.soap.impl.dom.SOAPEnvelopeImpl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public abstract class SOAPHeaderImpl extends SOAPElement implements SOAPHeader{
+	   /**
+     * @param envelope
+     */
+    public SOAPHeaderImpl(SOAPEnvelope envelope) throws SOAPProcessingException {
+        super(envelope, SOAPConstants.HEADER_LOCAL_NAME, true);
+
+    }
+
+    /**
+     * Constructor SOAPHeaderImpl
+     *
+     * @param envelope
+     * @param builder
+     */
+    public SOAPHeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+        super(envelope, SOAPConstants.HEADER_LOCAL_NAME, builder);
+    }
+
+    /**
+     * Creates a new <CODE>SOAPHeaderBlock</CODE> object initialized with the
+     * specified name and adds it to this <CODE>SOAPHeader</CODE> object.
+     *
+     * @param localName
+     * @param ns
+     * @return the new <CODE>SOAPHeaderBlock</CODE> object that was inserted
+     *         into this <CODE>SOAPHeader</CODE> object
+     * @throws org.apache.axis2.om.OMException
+     *                     if a SOAP error occurs
+     * @throws OMException
+     */
+    public abstract SOAPHeaderBlock addHeaderBlock(String localName,
+                                                   OMNamespace ns)
+            throws OMException;
+
+    /**
+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this
+     * <CODE>SOAPHeader</CODE> object that have the the specified actor. An
+     * actor is a global attribute that indicates the intermediate parties to
+     * whom the message should be sent. An actor receives the message and then
+     * sends it to the next actor. The default actor is the ultimate intended
+     * recipient for the message, so if no actor attribute is included in a
+     * <CODE>SOAPHeader</CODE> object, the message is sent to its ultimate
+     * destination.
+     *
+     * @param paramRole a <CODE>String</CODE> giving the URI of the actor for
+     *                  which to search
+     * @return an <CODE>Iterator</CODE> object over all the <CODE>
+     *         SOAPHeaderBlock</CODE> objects that contain the specified actor
+     * @see #extractHeaderBlocks(String) extractHeaderBlocks(java.lang.String)
+     */
+    public Iterator examineHeaderBlocks(String paramRole) {
+        Iterator headerBlocksIter = this.getChildren();
+        ArrayList headersWithGivenActor = new ArrayList();
+        
+        if(paramRole == null || "".equals(paramRole)){
+    		return returnAllSOAPHeaders(this.getChildren());
+    	}
+        
+        while (headerBlocksIter.hasNext()) {
+            Object o = headerBlocksIter.next();
+            if (o instanceof SOAPHeaderBlock) {
+                SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o;
+                String role = soapHeaderBlock.getRole();
+                if ((role != null) && role.equalsIgnoreCase(paramRole)) {
+                    headersWithGivenActor.add(soapHeaderBlock);
+                }
+            }
+        }
+        return headersWithGivenActor.iterator();
+    }
+
+    private Iterator returnAllSOAPHeaders(Iterator children) {
+    	ArrayList headers = new ArrayList();
+    	while (children.hasNext()) {
+            Object o = children.next();
+            if (o instanceof SOAPHeaderBlock) {
+                headers.add(o);
+            }
+        }
+    	
+    	return headers.iterator();
+		
+	}
+
+	/**
+     * Returns a list of all the <CODE>SOAPHeaderBlock</CODE> objects in this
+     * <CODE>SOAPHeader</CODE> object that have the the specified role and
+     * detaches them from this <CODE> SOAPHeader</CODE> object. <P>This method
+     * allows an role to process only the parts of the <CODE>SOAPHeader</CODE>
+     * object that apply to it and to remove them before passing the message on
+     * to the next role.
+     *
+     * @param role a <CODE>String</CODE> giving the URI of the role for which to
+     *             search
+     * @return an <CODE>Iterator</CODE> object over all the <CODE>
+     *         SOAPHeaderBlock</CODE> objects that contain the specified role
+     * @see #examineHeaderBlocks(String) examineHeaderBlocks(java.lang.String)
+     */
+    public abstract Iterator extractHeaderBlocks(String role);
+
+    /**
+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+     * objects in this <code>SOAPHeader</code> object that have the specified
+     * actor and that have a MustUnderstand attribute whose value is equivalent
+     * to <code>true</code>.
+     *
+     * @param actor a <code>String</code> giving the URI of the actor for which
+     *              to search
+     * @return an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects that contain the specified
+     *         actor and are marked as MustUnderstand
+     */
+    public Iterator examineMustUnderstandHeaderBlocks(String actor) {
+        Iterator headerBlocksIter = this.getChildren();
+        ArrayList mustUnderstandHeadersWithGivenActor = new ArrayList();
+        while (headerBlocksIter.hasNext()) {
+            Object o = headerBlocksIter.next();
+            if (o instanceof SOAPHeaderBlock) {
+                SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) o;
+                String role = soapHeaderBlock.getRole();
+                boolean mustUnderstand = soapHeaderBlock.getMustUnderstand();
+                if ((role != null) && role.equalsIgnoreCase(actor) &&
+                        mustUnderstand) {
+                    mustUnderstandHeadersWithGivenActor.add(soapHeaderBlock);
+                }
+            }
+        }
+        return mustUnderstandHeadersWithGivenActor.iterator();
+    }
+
+    /**
+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+     * objects in this <code>SOAPHeader</code> object. Not that this will return
+     * elements containing the QName (http://schemas.xmlsoap.org/soap/envelope/,
+     * Header)
+     *
+     * @return an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects contained by this
+     *         <code>SOAPHeader</code>
+     */
+    public Iterator examineAllHeaderBlocks() {
+        return this.getChildrenWithName(null);
+    }
+
+    /**
+     * Returns an <code>Iterator</code> over all the <code>SOAPHeaderBlock</code>
+     * objects in this <code>SOAPHeader </code> object and detaches them from
+     * this <code>SOAPHeader</code> object.
+     *
+     * @return an <code>Iterator</code> object over all the
+     *         <code>SOAPHeaderBlock</code> objects contained by this
+     *         <code>SOAPHeader</code>
+     */
+    public Iterator extractAllHeaderBlocks() {
+        throw new UnsupportedOperationException(); // TODO implement this
+    }
+
+    public ArrayList getHeaderBlocksWithNSURI(String nsURI) {
+        ArrayList headers = null;
+        OMNode node = null;
+        OMElement header = this.getFirstElement();
+
+        if (header != null) {
+            headers = new ArrayList();
+        }
+
+        node = header;
+
+        while (node != null) {
+            if (node.getType() == OMNode.ELEMENT_NODE) {
+                header = (OMElement) node;
+                if (nsURI.equals(header.getNamespace().getName())) {
+                    headers.add(header);
+                }
+            }
+            node = node.getNextOMSibling();
+
+        }
+        return headers;
+
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAPEnvelopeImpl)) {
+            throw new SOAPProcessingException(
+                    "Expecting an implementation of SOAP Envelope as the parent. But received some other implementation");
+        }
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPMessageImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPMessageImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPMessageImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPMessageImpl.java Mon Oct 31 03:58:39 2005
@@ -0,0 +1,77 @@
+/*
+ * 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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.OMOutputImpl;
+import org.apache.axis2.om.impl.dom.DocumentImpl;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPMessage;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+
+public class SOAPMessageImpl extends DocumentImpl implements SOAPMessage {
+
+    public SOAPMessageImpl() {
+    }
+
+    public SOAPMessageImpl(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) {
+    	this(parserWrapper);
+    	this.setSOAPEnvelope(envelope);
+    }
+
+    public SOAPMessageImpl(OMXMLParserWrapper parserWrapper) {
+        super(parserWrapper);
+    }
+
+
+    public SOAPEnvelope getSOAPEnvelope() throws SOAPProcessingException {
+        return (SOAPEnvelope) getOMDocumentElement();
+    }
+
+    public void setSOAPEnvelope(SOAPEnvelope envelope) throws SOAPProcessingException {
+    	if(this.getDocumentElement() != null) {
+    		this.replaceChild(this.getDocumentElement(), (SOAPEnvelopeImpl)envelope);
+    	} else {
+    		this.appendChild((SOAPEnvelopeImpl)envelope);
+    	}
+    }
+
+    public void setOMDocumentElement(OMElement rootElement) {
+        throw new UnsupportedOperationException("This is not allowed. Use set SOAPEnvelope instead");
+    }
+
+    public void addChild(OMNode child) {
+        throw new UnsupportedOperationException("Can not add normal children to SOAP envelope. Use setSOAPEnvelope()");
+    }
+
+
+    public void setFirstChild(OMNode firstChild) {
+        throw new UnsupportedOperationException("This is not allowed. Use set SOAPEnvelope instead");
+    }
+
+    protected void serialize(OMOutputImpl omOutput, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException {
+        if (cache) {
+            ((OMElement)this.ownerNode.getDocumentElement()).serialize(omOutput);
+        } else {
+        	((OMElement)this.ownerNode.getDocumentElement()).serializeAndConsume(omOutput);
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPTextImpl.java?rev=329804&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPTextImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/SOAPTextImpl.java Mon Oct 31 03:58:39 2005
@@ -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.axis2.soap.impl.dom;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPProcessingException;
+
+public class SOAPTextImpl extends SOAPElement{
+
+    protected SOAPTextImpl(OMElement parent) throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, true);
+    }
+
+    protected SOAPTextImpl(OMElement parent, OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder);
+    }
+
+    public void setLang(String lang) {
+        // TODO : Chinthaka fix me
+    }
+
+    public String getLang() {
+        // TODO Chinthaka fix me
+        return null;
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        // do nothing
+    }
+}



Mime
View raw message