You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2012/07/07 20:24:12 UTC
svn commit: r1358610 [5/10] - in /webservices/axiom/branches/AXIOM-201: ./
modules/axiom-api/
modules/axiom-api/src/main/java/org/apache/axiom/attachments/
modules/axiom-api/src/main/java/org/apache/axiom/locator/
modules/axiom-api/src/main/java/org/ap...
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java Sat Jul 7 18:24:00 2012
@@ -19,15 +19,13 @@
package org.apache.axiom.om.impl.dom;
-import org.apache.axiom.om.OMComment;
-import org.apache.axiom.om.OMDocType;
+import org.apache.axiom.om.OMCloneOptions;
+import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMProcessingInstruction;
import org.apache.axiom.om.OMSourcedElement;
-import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.OMXMLStreamReaderConfiguration;
import org.apache.axiom.om.impl.OMContainerEx;
@@ -38,12 +36,10 @@ import org.apache.axiom.om.impl.common.O
import org.apache.axiom.om.impl.common.OMChildrenQNameIterator;
import org.apache.axiom.om.impl.common.OMContainerHelper;
import org.apache.axiom.om.impl.common.OMDescendantsIterator;
-import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
import org.apache.axiom.om.impl.jaxp.OMSource;
import org.apache.axiom.om.impl.traverse.OMChildrenIterator;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -53,16 +49,11 @@ import javax.xml.transform.sax.SAXSource
import java.util.Iterator;
-public abstract class ParentNode extends ChildNode implements OMContainerEx {
+public abstract class ParentNode extends NodeImpl implements NodeList {
- protected ChildNode firstChild;
+ protected NodeImpl firstChild;
- protected ChildNode lastChild;
-
- /** @param ownerDocument */
- protected ParentNode(DocumentImpl ownerDocument, OMFactory factory) {
- super(ownerDocument, factory);
- }
+ protected NodeImpl lastChild;
protected ParentNode(OMFactory factory) {
super(factory);
@@ -72,21 +63,30 @@ public abstract class ParentNode extends
// /OMContainer methods
// /
- public OMXMLParserWrapper getBuilder() {
- return this.builder;
+ void internalAppendChild(NodeImpl node) {
+ insertBefore(node, null, false);
}
-
+
public void addChild(OMNode omNode) {
- if (omNode.getOMFactory() instanceof OMDOMFactory) {
- insertBefore((Node)omNode, null, false);
- } else {
- addChild(importNode(omNode));
- }
+ addChild(omNode, false);
+ }
+
+ public void addChild(OMNode omNode, boolean fromBuilder) {
+ OMContainerHelper.addChild((OMContainerEx)this, omNode, fromBuilder);
}
public void buildNext() {
+ OMXMLParserWrapper builder = getBuilder();
if (builder != null) {
- builder.next();
+ if (((StAXOMBuilder)builder).isClosed()) {
+ throw new OMException("The builder has already been closed");
+ } else if (!builder.isCompleted()) {
+ builder.next();
+ } else {
+ // If the builder is suddenly complete, but the completion status of the node
+ // doesn't change, then this means that we built the wrong nodes
+ throw new IllegalStateException("Builder is already complete");
+ }
}
}
@@ -95,7 +95,7 @@ public abstract class ParentNode extends
}
public Iterator getDescendants(boolean includeSelf) {
- return new OMDescendantsIterator(this, includeSelf);
+ return new OMDescendantsIterator((OMContainer)this, includeSelf);
}
/**
@@ -139,7 +139,7 @@ public abstract class ParentNode extends
}
public OMNode getFirstOMChild() {
- while ((firstChild == null) && !done) {
+ while ((firstChild == null) && !isComplete()) {
buildNext();
}
return (OMNode)firstChild;
@@ -149,11 +149,15 @@ public abstract class ParentNode extends
return (OMNode)firstChild;
}
- public void setFirstChild(OMNode omNode) {
+ public OMNode getLastKnownOMChild() {
+ return (OMNode)lastChild;
+ }
+
+ public void setFirstChild(OMNode firstChild) {
if (firstChild != null) {
- ((OMNodeEx) omNode).setParent(this);
+ ((OMNodeEx) firstChild).setParent((OMContainer)this);
}
- this.firstChild = (ChildNode) omNode;
+ this.firstChild = (NodeImpl) firstChild;
}
/**
@@ -161,22 +165,39 @@ public abstract class ParentNode extends
* @param omNode
*/
public void setLastChild(OMNode omNode) {
- this.lastChild = (ChildNode) omNode;
+ this.lastChild = (NodeImpl) omNode;
}
// /
// /DOM Node methods
// /
- public NodeList getChildNodes() {
- if (!this.done) {
- this.build();
+ public final NodeList getChildNodes() {
+ return this;
+ }
+
+ public final int getLength() {
+ int count = 0;
+ Node child = getFirstChild();
+ while (child != null) {
+ count++;
+ child = child.getNextSibling();
}
- return new NodeListImpl() {
- protected Iterator getIterator() {
- return getChildren();
+ return count;
+ }
+
+ public final Node item(int index) {
+ int count = 0;
+ Node child = getFirstChild();
+ while (child != null) {
+ if (count == index) {
+ return child;
+ } else {
+ child = child.getNextSibling();
}
- };
+ count++;
+ }
+ return null;
}
public Node getFirstChild() {
@@ -184,19 +205,23 @@ public abstract class ParentNode extends
}
public Node getLastChild() {
- if (!this.done) {
+ if (!this.isComplete()) {
this.build();
}
return this.lastChild;
}
public boolean hasChildNodes() {
- while ((firstChild == null) && !done) {
+ while ((firstChild == null) && !isComplete()) {
buildNext();
}
return this.firstChild != null;
}
+ public final Node appendChild(Node newChild) throws DOMException {
+ return insertBefore(newChild, null);
+ }
+
/**
* Inserts newChild before the refChild. If the refChild is null then the newChild is made the
* last child.
@@ -206,8 +231,8 @@ public abstract class ParentNode extends
}
private Node insertBefore(Node newChild, Node refChild, boolean useDomSemantics) {
- ChildNode newDomChild = (ChildNode) newChild;
- ChildNode refDomChild = (ChildNode) refChild;
+ NodeImpl newDomChild = (NodeImpl) newChild;
+ NodeImpl refDomChild = (NodeImpl) refChild;
if (useDomSemantics) {
checkSameOwnerDocument(newDomChild);
@@ -249,6 +274,9 @@ public abstract class ParentNode extends
}
if (refChild == null) { // Append the child to the end of the list
+ if (!isComplete()) {
+ build();
+ }
// if there are no children
if (this.lastChild == null && firstChild == null) {
this.lastChild = newDomChild;
@@ -256,10 +284,10 @@ public abstract class ParentNode extends
this.firstChild.isFirstChild(true);
newDomChild.setParent(this, useDomSemantics);
} else {
- this.lastChild.nextSibling = newDomChild;
- newDomChild.previousSibling = this.lastChild;
+ this.lastChild.internalSetNextSibling(newDomChild);
+ newDomChild.internalSetPreviousSibling(this.lastChild);
this.lastChild = newDomChild;
- this.lastChild.nextSibling = null;
+ this.lastChild.internalSetNextSibling(null);
}
if (newDomChild.parentNode() == null) {
newDomChild.setParent(this, useDomSemantics);
@@ -268,7 +296,7 @@ public abstract class ParentNode extends
Iterator children = this.getChildren();
boolean found = false;
while (children.hasNext()) {
- ChildNode tempNode = (ChildNode) children.next();
+ NodeImpl tempNode = (NodeImpl) children.next();
if (tempNode.equals(refChild)) {
// RefChild found
@@ -280,16 +308,15 @@ public abstract class ParentNode extends
DocumentFragmentImpl docFrag =
(DocumentFragmentImpl) newChild;
- ChildNode child = docFrag.firstChild;
+ NodeImpl child = docFrag.firstChild;
while (child != null) {
child.setParent(this, useDomSemantics);
- child = child.nextSibling;
+ child = child.internalGetNextSibling();
}
this.firstChild = docFrag.firstChild;
- docFrag.lastChild.nextSibling = refDomChild;
- refDomChild.previousSibling =
- docFrag.lastChild.nextSibling;
+ docFrag.lastChild.internalSetNextSibling(refDomChild);
+ refDomChild.internalSetPreviousSibling(docFrag.lastChild.internalGetNextSibling());
docFrag.firstChild = null;
docFrag.lastChild = null;
@@ -298,44 +325,44 @@ public abstract class ParentNode extends
// Make the newNode the first Child
this.firstChild = newDomChild;
- newDomChild.nextSibling = refDomChild;
- refDomChild.previousSibling = newDomChild;
+ newDomChild.internalSetNextSibling(refDomChild);
+ refDomChild.internalSetPreviousSibling(newDomChild);
this.firstChild.isFirstChild(true);
refDomChild.isFirstChild(false);
- newDomChild.previousSibling = null; // Just to be
+ newDomChild.internalSetPreviousSibling(null); // Just to be
// sure :-)
}
} else { // If the refChild is not the fist child
- ChildNode previousNode = refDomChild.previousSibling;
+ NodeImpl previousNode = refDomChild.internalGetPreviousSibling();
if (newChild instanceof DocumentFragmentImpl) {
// the newChild is a document fragment
DocumentFragmentImpl docFrag =
(DocumentFragmentImpl) newChild;
- ChildNode child = docFrag.firstChild;
+ NodeImpl child = docFrag.firstChild;
while (child != null) {
child.setParent(this, useDomSemantics);
- child = child.nextSibling;
+ child = child.internalGetNextSibling();
}
- previousNode.nextSibling = docFrag.firstChild;
- docFrag.firstChild.previousSibling = previousNode;
+ previousNode.internalSetNextSibling(docFrag.firstChild);
+ docFrag.firstChild.internalSetPreviousSibling(previousNode);
- docFrag.lastChild.nextSibling = refDomChild;
- refDomChild.previousSibling = docFrag.lastChild;
+ docFrag.lastChild.internalSetNextSibling(refDomChild);
+ refDomChild.internalSetPreviousSibling(docFrag.lastChild);
docFrag.firstChild = null;
docFrag.lastChild = null;
} else {
- previousNode.nextSibling = newDomChild;
- newDomChild.previousSibling = previousNode;
+ previousNode.internalSetNextSibling(newDomChild);
+ newDomChild.internalSetPreviousSibling(previousNode);
- newDomChild.nextSibling = refDomChild;
- refDomChild.previousSibling = newDomChild;
+ newDomChild.internalSetNextSibling(refDomChild);
+ refDomChild.internalSetPreviousSibling(newDomChild);
}
}
@@ -365,9 +392,9 @@ public abstract class ParentNode extends
}
/** Replaces the oldChild with the newChild. */
- public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
- ChildNode newDomChild = (ChildNode) newChild;
- ChildNode oldDomChild = (ChildNode) oldChild;
+ public final Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+ NodeImpl newDomChild = (NodeImpl) newChild;
+ NodeImpl oldDomChild = (NodeImpl) oldChild;
if (newChild == null) {
return this.removeChild(oldChild);
@@ -385,47 +412,47 @@ public abstract class ParentNode extends
Iterator children = this.getChildren();
boolean found = false;
while (!found && children.hasNext()) {
- ChildNode tempNode = (ChildNode) children.next();
+ NodeImpl tempNode = (NodeImpl) children.next();
if (tempNode.equals(oldChild)) {
if (newChild instanceof DocumentFragmentImpl) {
DocumentFragmentImpl docFrag =
(DocumentFragmentImpl) newDomChild;
- ChildNode child = (ChildNode) docFrag.getFirstChild();
+ NodeImpl child = (NodeImpl) docFrag.getFirstChild();
this.replaceChild(child, oldChild);
//set the parent of all kids to me
while(child != null) {
child.setParent(this, true);
- child = child.nextSibling;
+ child = child.internalGetNextSibling();
}
- this.lastChild = (ChildNode)docFrag.getLastChild();
+ this.lastChild = (NodeImpl)docFrag.getLastChild();
} else {
if (this.firstChild == oldDomChild) {
- if (this.firstChild.nextSibling != null) {
- this.firstChild.nextSibling.previousSibling = newDomChild;
- newDomChild.nextSibling = this.firstChild.nextSibling;
+ if (this.firstChild.internalGetNextSibling() != null) {
+ this.firstChild.internalGetNextSibling().internalSetPreviousSibling(newDomChild);
+ newDomChild.internalSetNextSibling(this.firstChild.internalGetNextSibling());
}
//Cleanup the current first child
this.firstChild.setParent(null, true);
- this.firstChild.nextSibling = null;
+ this.firstChild.internalSetNextSibling(null);
//Set the new first child
this.firstChild = newDomChild;
} else {
- newDomChild.nextSibling = oldDomChild.nextSibling;
- newDomChild.previousSibling = oldDomChild.previousSibling;
+ newDomChild.internalSetNextSibling(oldDomChild.internalGetNextSibling());
+ newDomChild.internalSetPreviousSibling(oldDomChild.internalGetPreviousSibling());
- oldDomChild.previousSibling.nextSibling = newDomChild;
+ oldDomChild.internalGetPreviousSibling().internalSetNextSibling(newDomChild);
// If the old child is not the last
- if (oldDomChild.nextSibling != null) {
- oldDomChild.nextSibling.previousSibling = newDomChild;
+ if (oldDomChild.internalGetNextSibling() != null) {
+ oldDomChild.internalGetNextSibling().internalSetPreviousSibling(newDomChild);
} else {
this.lastChild = newDomChild;
}
@@ -437,8 +464,8 @@ public abstract class ParentNode extends
found = true;
// remove the old child's references to this tree
- oldDomChild.nextSibling = null;
- oldDomChild.previousSibling = null;
+ oldDomChild.internalSetNextSibling(null);
+ oldDomChild.internalSetPreviousSibling(null);
oldDomChild.setParent(null, true);
}
}
@@ -453,9 +480,9 @@ public abstract class ParentNode extends
}
/** Removes the given child from the DOM Tree. */
- public Node removeChild(Node oldChild) throws DOMException {
+ public final Node removeChild(Node oldChild) throws DOMException {
if (oldChild.getParentNode() == this) {
- ((ChildNode)oldChild).detach(true);
+ ((NodeImpl)oldChild).detach(true);
return oldChild;
} else {
throw new DOMException(DOMException.NOT_FOUND_ERR,
@@ -483,97 +510,18 @@ public abstract class ParentNode extends
return false;
}
- public Node cloneNode(boolean deep) {
-
- ParentNode newnode = (ParentNode) super.cloneNode(deep);
-
- // set parent and owner document
- newnode.setParent(null, true);
-
- // Need to break the association w/ original kids
- newnode.firstChild = null;
- newnode.lastChild = null;
-
- // Then, if deep, clone the kids too.
+ final NodeImpl clone(OMCloneOptions options, ParentNode targetParent, boolean deep, boolean namespaceRepairing) {
+ ParentNode clone = shallowClone(options, targetParent, namespaceRepairing);
if (deep) {
- for (ChildNode child = firstChild; child != null;
- child = child.nextSibling) {
- newnode.appendChild(child.cloneNode(true));
- }
- }
- return newnode;
- }
-
- /**
- * This method is intended only to be used by Axiom intenals when merging Objects from different
- * Axiom implementations to the DOOM implementation.
- *
- * @param child
- */
- protected OMNode importNode(OMNode child) {
- int type = child.getType();
- switch (type) {
- case (OMNode.ELEMENT_NODE): {
- OMElement childElement = (OMElement) child;
- OMElement newElement = (new StAXOMBuilder(this.factory,
- childElement.getXMLStreamReader()))
- .getDocumentElement();
- newElement.build();
- return (OMNode)ownerDocument().importNode((Element) newElement,
- true);
- }
- case (OMNode.TEXT_NODE): {
- OMText importedText = (OMText) child;
- OMText newText;
- if (importedText.isBinary()) {
- boolean isOptimize = importedText.isOptimized();
- newText = this.factory.createOMText(importedText
- .getDataHandler(), isOptimize);
- } else if (importedText.isCharacters()) {
- newText = new TextImpl((DocumentImpl) this.getOwnerDocument(),
- importedText.getTextCharacters(), this.factory);
- } else {
- newText = new TextImpl((DocumentImpl) this.getOwnerDocument(),
- importedText.getText(), this.factory);
- }
- return newText;
- }
-
- case (OMNode.PI_NODE): {
- OMProcessingInstruction importedPI = (OMProcessingInstruction) child;
- OMProcessingInstruction newPI = this.factory
- .createOMProcessingInstruction(this,
- importedPI.getTarget(),
- importedPI.getValue());
- return newPI;
- }
- case (OMNode.COMMENT_NODE): {
- OMComment importedComment = (OMComment) child;
- OMComment newComment = this.factory.createOMComment(this,
- importedComment.getValue());
- DocumentImpl doc;
- if (this instanceof DocumentImpl) {
- doc = (DocumentImpl) this;
- } else {
- doc = (DocumentImpl) getOwnerDocument();
- }
- newComment = new CommentImpl(doc, importedComment.getValue(),
- this.factory);
- return newComment;
- }
- case (OMNode.DTD_NODE): {
- OMDocType importedDocType = (OMDocType) child;
- OMDocType newDocType = this.factory.createOMDocType(this,
- importedDocType.getValue());
- return newDocType;
- }
- default: {
- throw new UnsupportedOperationException(
- "Not Implemented Yet for the given node type");
+ for (Node child = getFirstChild(); child != null; child = child.getNextSibling()) {
+ ((NodeImpl)child).clone(options, clone, true, namespaceRepairing);
}
}
+ return clone;
}
+ abstract ParentNode shallowClone(OMCloneOptions options, ParentNode targetParent, boolean namespaceRepairing);
+
public String getTextContent() throws DOMException {
Node child = getFirstChild();
if (child != null) {
@@ -629,19 +577,19 @@ public abstract class ParentNode extends
}
public XMLStreamReader getXMLStreamReader(boolean cache) {
- return OMContainerHelper.getXMLStreamReader(this, cache);
+ return OMContainerHelper.getXMLStreamReader((OMContainer)this, cache);
}
public XMLStreamReader getXMLStreamReader(boolean cache, OMXMLStreamReaderConfiguration configuration) {
- return OMContainerHelper.getXMLStreamReader(this, cache, configuration);
+ return OMContainerHelper.getXMLStreamReader((OMContainer)this, cache, configuration);
}
public SAXSource getSAXSource(boolean cache) {
- return new OMSource(this);
+ return new OMSource((OMContainer)this);
}
void notifyChildComplete() {
- if (!this.done && builder == null) {
+ if (!this.isComplete() && getBuilder() == null) {
Iterator iterator = getChildren();
while (iterator.hasNext()) {
OMNode node = (OMNode) iterator.next();
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ProcessingInstructionImpl.java Sat Jul 7 18:24:00 2012
@@ -22,7 +22,6 @@ package org.apache.axiom.om.impl.dom;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMProcessingInstruction;
@@ -31,29 +30,21 @@ import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
-public class ProcessingInstructionImpl extends ChildNode implements ProcessingInstruction, OMProcessingInstruction, OMNodeEx {
+public class ProcessingInstructionImpl extends LeafNode implements ProcessingInstruction, OMProcessingInstruction, OMNodeEx {
private String target;
private String value;
- public ProcessingInstructionImpl(DocumentImpl ownerDocument, String target, String value,
- OMFactory factory) {
+ public ProcessingInstructionImpl(String target, String value, OMFactory factory) {
- super(ownerDocument, factory);
+ super(factory);
this.target = target;
this.value = value;
- done = true;
}
public int getType() {
return OMNode.PI_NODE;
}
- public void setType(int nodeType) throws OMException {
- if (nodeType != OMNode.PI_NODE) {
- throw new OMException("Can't change the type of a ProcessingInstruction node");
- }
- }
-
public short getNodeType() {
return Node.PROCESSING_INSTRUCTION_NODE;
}
@@ -93,4 +84,8 @@ public class ProcessingInstructionImpl e
public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException {
writer.writeProcessingInstruction(target + " ", value);
}
+
+ LeafNode createClone() {
+ return new ProcessingInstructionImpl(target, value, factory);
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java Sat Jul 7 18:24:00 2012
@@ -26,43 +26,32 @@ import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.w3c.dom.Node;
public class TextImpl extends TextNodeImpl {
private boolean isWhitespace;
- public TextImpl(DocumentImpl ownerNode, char[] value, OMFactory factory) {
- super(ownerNode, value, factory);
+ public TextImpl(char[] value, OMFactory factory) {
+ super(value, factory);
}
- public TextImpl(DocumentImpl ownerNode, Object dataHandler, boolean optimize, OMFactory factory) {
- super(ownerNode, dataHandler, optimize, factory);
+ public TextImpl(Object dataHandler, boolean optimize, OMFactory factory) {
+ super(dataHandler, optimize, factory);
}
- public TextImpl(DocumentImpl ownerNode, String contentID,
+ public TextImpl(String contentID,
DataHandlerProvider dataHandlerProvider, boolean optimize, OMFactory factory) {
- super(ownerNode, contentID, dataHandlerProvider, optimize, factory);
+ super(contentID, dataHandlerProvider, optimize, factory);
}
- public TextImpl(DocumentImpl ownerNode, OMFactory factory) {
- super(ownerNode, factory);
+ public TextImpl(OMFactory factory) {
+ super(factory);
}
- public TextImpl(DocumentImpl ownerNode, String value, OMFactory factory) {
- super(ownerNode, value, factory);
- }
-
- public TextImpl(DocumentImpl ownerNode, String value, int nodeType, OMFactory factory) {
- super(ownerNode, value, factory);
+ public TextImpl(String value, int nodeType, OMFactory factory) {
+ super(value, factory);
isWhitespace = nodeType == SPACE_NODE;
}
- public TextImpl(DocumentImpl ownerNode, String value, String mimeType, boolean optimize,
- OMFactory factory) {
- super(ownerNode, value, mimeType, optimize, factory);
- }
-
public TextImpl(OMContainer parent, QName text, int nodeType, OMFactory factory) {
super(parent, text, nodeType, factory);
}
@@ -71,13 +60,8 @@ public class TextImpl extends TextNodeIm
super(parent, text, factory);
}
- public TextImpl(OMContainer parent, TextNodeImpl source, OMFactory factory) {
- super(parent, source, factory);
- }
-
- public TextImpl(String contentID, OMContainer parent, OMXMLParserWrapper builder,
- OMFactory factory) {
- super(contentID, parent, builder, factory);
+ public TextImpl(TextNodeImpl source, OMFactory factory) {
+ super(source, factory);
}
public TextImpl(String text, OMFactory factory) {
@@ -97,22 +81,7 @@ public class TextImpl extends TextNodeIm
return isWhitespace ? OMNode.SPACE_NODE : OMNode.TEXT_NODE;
}
- public void setType(int nodeType) throws OMException {
- switch (nodeType) {
- case OMNode.TEXT_NODE:
- isWhitespace = false;
- break;
- case OMNode.SPACE_NODE:
- isWhitespace = true;
- break;
- default:
- throw new UnsupportedOperationException();
- }
- }
-
- public Node cloneNode(boolean deep) {
- TextImpl textImpl = new TextImpl(this.textValue, this.factory);
- textImpl.setOwnerDocument(ownerDocument());
- return textImpl;
+ LeafNode createClone() {
+ return new TextImpl(textValue, factory);
}
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java Sat Jul 7 18:24:00 2012
@@ -21,14 +21,13 @@ package org.apache.axiom.om.impl.dom;
import org.apache.axiom.attachments.utils.DataHandlerUtils;
import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
+import org.apache.axiom.om.OMCloneOptions;
import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.common.OMNamespaceImpl;
import org.apache.axiom.util.UIDGenerator;
import org.apache.axiom.util.base64.Base64Utils;
import org.apache.axiom.util.stax.XMLStreamWriterUtils;
@@ -73,24 +72,6 @@ public abstract class TextNodeImpl exten
//this.textValue = (text != null) ? new StringBuffer(text)
// : new StringBuffer("");
this.textValue = (text != null) ? text : "";
- this.done = true;
- }
-
- /**
- * @param contentID
- * @param parent
- * @param builder Used when the builder is encountered with a XOP:Include tag Stores a
- * reference to the builder and the content-id. Supports deffered parsing of
- * MIME messages
- */
- public TextNodeImpl(String contentID, OMContainer parent,
- OMXMLParserWrapper builder, OMFactory factory) {
- super((DocumentImpl) ((ParentNode) parent).getOwnerDocument(), factory);
- this.contentID = contentID;
- this.optimize = true;
- this.isBinary = true;
- this.done = true;
- this.builder = builder;
}
/**
@@ -100,9 +81,8 @@ public abstract class TextNodeImpl exten
* @param source TextImpl
* @param factory
*/
- public TextNodeImpl(OMContainer parent, TextNodeImpl source, OMFactory factory) {
- super((DocumentImpl) ((ParentNode) parent).getOwnerDocument(), factory);
- this.done = true;
+ public TextNodeImpl(TextNodeImpl source, OMFactory factory) {
+ super(factory);
// Copy the value of the text
if (source.textValue != null) {
@@ -150,13 +130,12 @@ public abstract class TextNodeImpl exten
* @param dataHandler
* @param optimize To send binary content. Created progrmatically.
*/
- public TextNodeImpl(DocumentImpl ownerNode, Object dataHandler, boolean optimize,
+ public TextNodeImpl(Object dataHandler, boolean optimize,
OMFactory factory) {
- super(ownerNode, factory);
+ super(factory);
this.dataHandlerObject = dataHandler;
this.isBinary = true;
this.optimize = optimize;
- done = true;
}
/**
@@ -167,51 +146,25 @@ public abstract class TextNodeImpl exten
* @param optimize
* @param factory
*/
- public TextNodeImpl(DocumentImpl ownerNode, String contentID, DataHandlerProvider
+ public TextNodeImpl(String contentID, DataHandlerProvider
dataHandlerProvider, boolean optimize, OMFactory factory) {
- super(ownerNode, factory);
+ super(factory);
this.contentID = contentID;
dataHandlerObject = dataHandlerProvider;
isBinary = true;
this.optimize = optimize;
- done = true;
- }
-
- /**
- * @param ownerNode
- */
- public TextNodeImpl(DocumentImpl ownerNode, OMFactory factory) {
- super(ownerNode, factory);
- this.done = true;
}
/**
* @param ownerNode
- * @param value
*/
- public TextNodeImpl(DocumentImpl ownerNode, String value, OMFactory factory) {
- super(ownerNode, value, factory);
- this.done = true;
+ public TextNodeImpl(OMFactory factory) {
+ super(factory);
}
-
- public TextNodeImpl(DocumentImpl ownerNode, char[] value, OMFactory factory) {
- super(ownerNode, factory);
+ public TextNodeImpl(char[] value, OMFactory factory) {
+ super(factory);
this.charArray = value;
- this.done = true;
- }
-
- /**
- * @param ownerNode
- * @param value
- */
- public TextNodeImpl(DocumentImpl ownerNode, String value, String mimeType,
- boolean optimize, OMFactory factory) {
- this(ownerNode, value, factory);
- this.mimeType = mimeType;
- this.optimize = optimize;
- this.isBinary = true;
- done = true;
}
public TextNodeImpl(OMContainer parent, QName text, OMFactory factory) {
@@ -221,11 +174,10 @@ public abstract class TextNodeImpl exten
public TextNodeImpl(OMContainer parent, QName text, int nodeType,
OMFactory factory) {
- this(((ElementImpl) parent).ownerDocument(), factory);
+ this(factory);
this.textNS =
((ElementImpl) parent).handleNamespace(text.getNamespaceURI(), text.getPrefix());
this.textValue = textNS == null ? text.getLocalPart() : textNS.getPrefix() + ":" + text.getLocalPart();
- this.done = true;
}
/**
@@ -251,7 +203,7 @@ public abstract class TextNodeImpl exten
ParentNode parentNode = parentNode();
if (parentNode != null) {
- newText.setParent(parentNode);
+ newText.setParent((OMContainer)parentNode);
}
this.insertSiblingAfter(newText);
@@ -286,12 +238,6 @@ public abstract class TextNodeImpl exten
}
}
- public void discard() throws OMException {
- if (done) {
- this.detach();
- }
- }
-
/**
* Writes the relevant output.
*
@@ -520,4 +466,12 @@ public abstract class TextNodeImpl exten
public void setContentID(String cid) {
this.contentID = cid;
}
+
+ void beforeClone(OMCloneOptions options) {
+ if (isBinary && options.isFetchDataHandlers()) {
+ // Force loading of the reference to the DataHandler and ensure that its content is
+ // completely fetched into memory (or temporary storage).
+ ((DataHandler)getDataHandler()).getDataSource();
+ }
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java Sat Jul 7 18:24:00 2012
@@ -28,7 +28,6 @@ import org.apache.axiom.om.OMDocType;
import org.apache.axiom.om.OMDocument;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMHierarchyException;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.axiom.om.OMNamespace;
@@ -37,6 +36,9 @@ import org.apache.axiom.om.OMProcessingI
import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.OMText;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.OMContainerEx;
+import org.apache.axiom.om.impl.builder.OMFactoryEx;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
import org.apache.axiom.om.impl.dom.AttrImpl;
import org.apache.axiom.om.impl.dom.CDATASectionImpl;
@@ -57,7 +59,7 @@ import javax.xml.namespace.QName;
* OM factory implementation for DOOM. It creates nodes that implement
* DOM as defined by the interfaces in {@link org.w3c.dom}.
*/
-public class OMDOMFactory implements OMFactory {
+public class OMDOMFactory implements OMFactoryEx {
private final OMDOMMetaFactory metaFactory;
public OMDOMFactory(OMDOMMetaFactory metaFactory) {
@@ -77,8 +79,7 @@ public class OMDOMFactory implements OMF
}
public OMElement createOMElement(String localName, OMNamespace ns) {
- return new ElementImpl(null,
- localName, (OMNamespaceImpl) ns, this);
+ return new ElementImpl(null, localName, ns, null, this, true);
}
public OMElement createOMElement(String localName, OMNamespace ns,
@@ -86,14 +87,18 @@ public class OMDOMFactory implements OMF
if (parent == null) {
return createOMElement(localName, ns);
} else {
- return new ElementImpl((ParentNode) parent, localName, (OMNamespaceImpl) ns, this);
+ return new ElementImpl((ParentNode) parent, localName, ns, null, this, true);
}
}
/** Creates an OMElement with the builder. */
- public OMElement createOMElement(String localName, OMNamespace ns,
- OMContainer parent, OMXMLParserWrapper builder) {
- return new ElementImpl((ParentNode) parent, localName, (OMNamespaceImpl) ns, builder, this);
+ public OMElement createOMElement(String localName, OMContainer parent,
+ OMXMLParserWrapper builder) {
+ return new ElementImpl((ParentNode) parent, localName, null, builder, this, false);
+ }
+
+ public OMSourcedElement createOMElement(OMDataSource source) {
+ throw new UnsupportedOperationException("Not supported for DOM");
}
/* (non-Javadoc)
@@ -191,6 +196,10 @@ public class OMDOMFactory implements OMF
}
public OMText createOMText(OMContainer parent, String text, int type) {
+ return createOMText(parent, text, type, false);
+ }
+
+ public OMText createOMText(OMContainer parent, String text, int type, boolean fromBuilder) {
if (parent == null) {
return createOMText(text, type);
} else if (parent instanceof DocumentImpl) {
@@ -199,22 +208,24 @@ public class OMDOMFactory implements OMF
} else {
TextNodeImpl txt;
if (type == OMNode.CDATA_SECTION_NODE) {
- txt = new CDATASectionImpl(null, text, this);
+ txt = new CDATASectionImpl(text, this);
} else {
- txt = new TextImpl(null, text, type, this);
+ txt = new TextImpl(text, type, this);
}
- parent.addChild(txt);
+ ((OMContainerEx)parent).addChild(txt, fromBuilder);
return txt;
}
}
public OMText createOMText(OMContainer parent, OMText source) {
- return new TextImpl(parent, (TextImpl) source, this);
+ TextImpl text = new TextImpl((TextImpl) source, this);
+ parent.addChild(text);
+ return text;
}
public OMText createOMText(OMContainer parent, char[] charArary, int type) {
- TextImpl txt = new TextImpl(null, charArary, this);
+ TextImpl txt = new TextImpl(charArary, this);
parent.addChild(txt);
return txt;
}
@@ -225,7 +236,7 @@ public class OMDOMFactory implements OMF
* @see org.apache.axiom.om.OMFactory#createOMText(String)
*/
public OMText createOMText(String s) {
- return new TextImpl(null, s, this);
+ return new TextImpl(s, this);
}
/**
@@ -235,9 +246,9 @@ public class OMDOMFactory implements OMF
*/
public OMText createOMText(String text, int type) {
if (type == OMNode.CDATA_SECTION_NODE) {
- return new CDATASectionImpl(null, text, this);
+ return new CDATASectionImpl(text, this);
} else {
- return new TextImpl(null, text, this);
+ return new TextImpl(text, this);
}
}
@@ -248,7 +259,7 @@ public class OMDOMFactory implements OMF
* @see org.apache.axiom.om.OMFactory#createOMText(String, String, boolean)
*/
public OMText createOMText(String text, String mimeType, boolean optimize) {
- return new TextImpl(null, text, mimeType, optimize, this);
+ return new TextImpl(text, mimeType, optimize, this);
}
/**
@@ -258,12 +269,21 @@ public class OMDOMFactory implements OMF
* @see org.apache.axiom.om.OMFactory#createOMText(Object, boolean)
*/
public OMText createOMText(Object dataHandler, boolean optimize) {
- return new TextImpl(null, dataHandler, optimize, this);
+ return createOMText(null, dataHandler, optimize, false);
+ }
+
+ public OMText createOMText(OMContainer parent, Object dataHandler, boolean optimize,
+ boolean fromBuilder) {
+ TextImpl text = new TextImpl(dataHandler, optimize, this);
+ if (parent != null) {
+ ((OMContainerEx)parent).addChild(text, fromBuilder);
+ }
+ return text;
}
public OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider,
boolean optimize) {
- return new TextImpl(null, contentID, dataHandlerProvider, optimize, this);
+ return new TextImpl(contentID, dataHandlerProvider, optimize, this);
}
/**
@@ -274,14 +294,7 @@ public class OMDOMFactory implements OMF
*/
public OMText createOMText(OMContainer parent, String s, String mimeType,
boolean optimize) {
- TextImpl text = new TextImpl(null, s, mimeType, optimize, this);
- parent.addChild(text);
- return text;
- }
-
- public OMText createOMText(String contentID, OMContainer parent,
- OMXMLParserWrapper builder) {
- TextImpl text = new TextImpl(contentID, parent, builder, this);
+ TextImpl text = new TextImpl(s, mimeType, optimize, this);
parent.addChild(text);
return text;
}
@@ -300,26 +313,41 @@ public class OMDOMFactory implements OMF
}
public OMDocType createOMDocType(OMContainer parent, String content) {
- DocumentTypeImpl docType = new DocumentTypeImpl(null, this);
+ return createOMDocType(parent, content, false);
+ }
+
+ public OMDocType createOMDocType(OMContainer parent, String content, boolean fromBuilder) {
+ DocumentTypeImpl docType = new DocumentTypeImpl(this);
docType.setValue(content);
- parent.addChild(docType);
+ if (parent != null) {
+ ((OMContainerEx)parent).addChild(docType, fromBuilder);
+ }
return docType;
}
public OMProcessingInstruction createOMProcessingInstruction(
OMContainer parent, String piTarget, String piData) {
+ return createOMProcessingInstruction(parent, piTarget, piData, false);
+ }
+
+ public OMProcessingInstruction createOMProcessingInstruction(
+ OMContainer parent, String piTarget, String piData, boolean fromBuilder) {
ProcessingInstructionImpl pi =
- new ProcessingInstructionImpl(null, piTarget, piData, this);
+ new ProcessingInstructionImpl(piTarget, piData, this);
if (parent != null) {
- parent.addChild(pi);
+ ((OMContainerEx)parent).addChild(pi, fromBuilder);
}
return pi;
}
public OMComment createOMComment(OMContainer parent, String content) {
- CommentImpl comment = new CommentImpl(null, content, this);
+ return createOMComment(parent, content, false);
+ }
+
+ public OMComment createOMComment(OMContainer parent, String content, boolean fromBuilder) {
+ CommentImpl comment = new CommentImpl(content, this);
if (parent != null) {
- parent.addChild(comment);
+ ((OMContainerEx)parent).addChild(comment, fromBuilder);
}
return comment;
}
@@ -327,4 +355,61 @@ public class OMDOMFactory implements OMF
public OMDocument createOMDocument(OMXMLParserWrapper builder) {
return new DocumentImpl(builder, this);
}
+
+ /**
+ * This method is intended only to be used by Axiom intenals when merging Objects from different
+ * Axiom implementations to the DOOM implementation.
+ *
+ * @param child
+ */
+ public OMNode importNode(OMNode child) {
+ int type = child.getType();
+ switch (type) {
+ case (OMNode.ELEMENT_NODE): {
+ OMElement childElement = (OMElement) child;
+ OMElement newElement = (new StAXOMBuilder(this,
+ childElement.getXMLStreamReader()))
+ .getDocumentElement();
+ newElement.build();
+ return newElement;
+ }
+ case (OMNode.TEXT_NODE): {
+ OMText importedText = (OMText) child;
+ OMText newText;
+ if (importedText.isBinary()) {
+ boolean isOptimize = importedText.isOptimized();
+ newText = createOMText(importedText
+ .getDataHandler(), isOptimize);
+ } else if (importedText.isCharacters()) {
+ newText = new TextImpl(importedText.getTextCharacters(), this);
+ } else {
+ newText = new TextImpl(importedText.getText(), this);
+ }
+ return newText;
+ }
+
+ case (OMNode.PI_NODE): {
+ OMProcessingInstruction importedPI = (OMProcessingInstruction) child;
+ OMProcessingInstruction newPI =
+ createOMProcessingInstruction(null, importedPI.getTarget(),
+ importedPI.getValue());
+ return newPI;
+ }
+ case (OMNode.COMMENT_NODE): {
+ OMComment importedComment = (OMComment) child;
+ OMComment newComment = createOMComment(null, importedComment.getValue());
+ newComment = new CommentImpl(importedComment.getValue(), this);
+ return newComment;
+ }
+ case (OMNode.DTD_NODE): {
+ OMDocType importedDocType = (OMDocType) child;
+ OMDocType newDocType = createOMDocType(null, importedDocType.getValue());
+ return newDocType;
+ }
+ default: {
+ throw new UnsupportedOperationException(
+ "Not Implemented Yet for the given node type");
+ }
+ }
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPBodyImpl.java Sat Jul 7 18:24:00 2012
@@ -22,8 +22,10 @@ package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMConstants;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPBody;
@@ -35,10 +37,6 @@ import org.apache.axiom.soap.SOAPProcess
public abstract class SOAPBodyImpl extends SOAPElement implements SOAPBody,
OMConstants {
-
- /** Field hasSOAPFault */
- protected boolean hasSOAPFault = false;
-
/** @param envelope */
public SOAPBodyImpl(SOAPEnvelope envelope, SOAPFactory factory)
throws SOAPProcessingException {
@@ -46,15 +44,9 @@ public abstract class SOAPBodyImpl exten
}
- /**
- * Constructor SOAPBodyImpl
- *
- * @param envelope
- * @param builder
- */
- public SOAPBodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(envelope, SOAPConstants.BODY_LOCAL_NAME, builder, factory);
+ public SOAPBodyImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, SOAPConstants.BODY_LOCAL_NAME, ns, builder, factory, generateNSDecl);
}
/**
@@ -75,22 +67,15 @@ public abstract class SOAPBodyImpl exten
* <code>SOAPBody</code> object; <code>false</code> otherwise
*/
public boolean hasFault() {
- if (hasSOAPFault) {
- return true;
+ OMElement element = getFirstElement();
+ if (element != null
+ && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element.getLocalName())) {
+ OMNamespace ns = element.getNamespace();
+ return ns != null &&
+ (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()) ||
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()));
} else {
- OMElement element = getFirstElement();
- if (element != null
- && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element
- .getLocalName())
- && (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
- .equals(element.getNamespace().getNamespaceURI()) ||
- SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
- .equals(element.getNamespace().getNamespaceURI()))) { //added this line
- hasSOAPFault = true;
- return true;
- } else {
- return false;
- }
+ return false;
}
}
@@ -101,20 +86,19 @@ public abstract class SOAPBodyImpl exten
*/
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().getNamespaceURI()) || SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI
- .equals(element.getNamespace().getNamespaceURI()))) { //added this line
- hasSOAPFault = true;
- return (SOAPFault) element;
+ if (element != null
+ && SOAPConstants.SOAPFAULT_LOCAL_NAME.equals(element.getLocalName())) {
+ OMNamespace ns = element.getNamespace();
+ if (ns != null &&
+ (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()) ||
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(ns.getNamespaceURI()))) {
+ return (SOAPFault) element;
+ } else {
+ return null;
+ }
} else {
return null;
}
-
}
/**
@@ -124,13 +108,12 @@ public abstract class SOAPBodyImpl exten
* @throws OMException
*/
public void addFault(SOAPFault soapFault) throws OMException {
- if (hasSOAPFault) {
+ if (hasFault()) {
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 {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPElement.java Sat Jul 7 18:24:00 2012
@@ -20,10 +20,9 @@
package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.common.OMNamespaceImpl;
-import org.apache.axiom.om.impl.dom.DocumentImpl;
import org.apache.axiom.om.impl.dom.ElementImpl;
import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.soap.SOAPFactory;
@@ -31,16 +30,12 @@ import org.apache.axiom.soap.SOAPProcess
public abstract class SOAPElement extends ElementImpl {
- public SOAPElement(SOAPFactory factory) {
- super(factory);
- }
-
/** @param parent */
protected SOAPElement(OMElement parent,
String localName,
boolean extractNamespaceFromParent,
SOAPFactory factory) throws SOAPProcessingException {
- super((ParentNode) parent, localName, null, factory);
+ super((ParentNode) parent, localName, null, null, factory, true);
if (parent == null) {
throw new SOAPProcessingException(
" Can not create " + localName +
@@ -54,26 +49,20 @@ public abstract class SOAPElement extend
this.localName = localName;
}
-
- protected SOAPElement(OMElement parent,
- String localName,
- OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super((ParentNode) parent, localName, null, builder, factory);
- }
-
- protected SOAPElement(DocumentImpl doc, String localName, OMNamespace ns,
- SOAPFactory factory) {
- super(doc, localName, (OMNamespaceImpl) ns, factory);
- }
-
- protected SOAPElement(DocumentImpl ownerDocument, String tagName,
- OMNamespaceImpl ns, OMXMLParserWrapper builder, SOAPFactory factory) {
- super(ownerDocument, tagName, ns, builder, factory);
+ public SOAPElement(ParentNode parentNode, String localName, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, localName, ns, builder, factory, generateNSDecl);
}
/** This has to be implemented by all the derived classes to check for the correct parent. */
protected abstract void checkParent(OMElement parent)
throws SOAPProcessingException;
+ protected void setParent(ParentNode parent, boolean useDomSemantics) {
+ super.setParent(parent, useDomSemantics);
+
+ if (!useDomSemantics && parent instanceof OMElement) {
+ checkParent((OMElement) parent);
+ }
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java Sat Jul 7 18:24:00 2012
@@ -19,15 +19,18 @@
package org.apache.axiom.soap.impl.dom;
+import org.apache.axiom.om.OMCloneOptions;
import org.apache.axiom.om.OMConstants;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
-import org.apache.axiom.om.impl.dom.ChildNode;
import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.NodeImpl;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP11Version;
@@ -53,22 +56,9 @@ public class SOAPEnvelopeImpl extends SO
private static final QName HEADER_QNAME = new QName(SOAPConstants.HEADER_LOCAL_NAME);
- /** @param builder */
- public SOAPEnvelopeImpl(OMXMLParserWrapper builder, SOAPFactory factory) {
- super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, builder, factory);
- }
-
- public SOAPEnvelopeImpl(DocumentImpl doc, OMXMLParserWrapper builder, SOAPFactory factory) {
- super(
- doc,
- SOAPConstants.SOAPENVELOPE_LOCAL_NAME,
- null,
- builder, factory);
- }
-
- /** @param ns */
- public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) {
- super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory);
+ public SOAPEnvelopeImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, builder, factory, generateNSDecl);
}
public SOAPVersion getVersion() {
@@ -110,7 +100,7 @@ public class SOAPEnvelopeImpl extends SO
}
}
- public void addChild(OMNode child) {
+ public void addChild(OMNode child, boolean fromBuilder) {
// SOAP 1.1 allows for arbitrary elements after SOAPBody so do NOT check for
// node types when appending to SOAP 1.1 envelope.
if (getVersion() instanceof SOAP12Version) {
@@ -147,7 +137,7 @@ public class SOAPEnvelopeImpl extends SO
}
}
}
- super.addChild(child);
+ super.addChild(child, fromBuilder);
}
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
@@ -241,11 +231,11 @@ public class SOAPEnvelopeImpl extends SO
OMSerializerUtil.serializeStartpart(this, writer);
OMElement header = getHeader();
if ((header != null) && (header.getFirstOMChild() != null)) {
- serializeInternally((ChildNode) header, writer);
+ serializeInternally((NodeImpl) header, writer);
}
SOAPBody body = getBody();
if (body != null) {
- serializeInternally((ChildNode) body, writer);
+ serializeInternally((NodeImpl) body, writer);
}
OMSerializerUtil.serializeEndpart(writer);
} else {
@@ -254,9 +244,9 @@ public class SOAPEnvelopeImpl extends SO
}
}
- private void serializeInternally(ChildNode child, MTOMXMLStreamWriter writer)
+ private void serializeInternally(NodeImpl child, MTOMXMLStreamWriter writer)
throws XMLStreamException {
- if ((!(child instanceof OMElement)) || child.isComplete() || child.builder == null) {
+ if ((!(child instanceof OMElement)) || child.isComplete() || child.getBuilder() == null) {
child.internalSerialize(writer, false);
} else {
OMElement element = (OMElement) child;
@@ -331,4 +321,7 @@ public class SOAPEnvelopeImpl extends SO
return null;
}
+ protected OMElement createClone(OMCloneOptions options, ParentNode targetParent, boolean generateNSDecl) {
+ return new SOAPEnvelopeImpl(targetParent, namespace, null, factory, generateNSDecl);
+ }
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultCodeImpl.java Sat Jul 7 18:24:00 2012
@@ -19,7 +19,10 @@
package org.apache.axiom.soap.impl.dom;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.util.ElementHelper;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPFactory;
@@ -30,17 +33,10 @@ import org.apache.axiom.soap.SOAPFaultVa
import org.apache.axiom.soap.SOAPProcessingException;
public abstract class SOAPFaultCodeImpl extends SOAPElement implements SOAPFaultCode {
-
- /**
- * Constructor OMElementImpl
- *
- * @param parent
- * @param builder
- */
- public SOAPFaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(parent, factory.getSOAPVersion().getFaultCodeQName().getLocalPart(), builder,
- factory);
+ public SOAPFaultCodeImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, ((SOAPFactory)factory).getSOAPVersion().getFaultCodeQName().getLocalPart(),
+ ns, builder, factory, generateNSDecl);
}
/** @param parent */
@@ -66,5 +62,4 @@ public abstract class SOAPFaultCodeImpl
public SOAPFaultSubCode getSubCode() {
return (SOAPFaultSubCode)getFirstChildWithName(SOAP12Constants.QNAME_FAULT_SUBCODE);
}
-
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultDetailImpl.java Sat Jul 7 18:24:00 2012
@@ -20,7 +20,10 @@
package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPFault;
@@ -32,25 +35,18 @@ import javax.xml.stream.XMLStreamWriter;
import java.util.Iterator;
public abstract class SOAPFaultDetailImpl extends SOAPElement implements SOAPFaultDetail {
-
-
- protected SOAPFaultDetailImpl(SOAPFault parent,
- boolean extractNamespaceFromParent, SOAPFactory factory)
- throws SOAPProcessingException {
- super(parent,
- factory.getSOAPVersion().getFaultDetailQName().getLocalPart(),
- extractNamespaceFromParent, factory);
- }
-
- protected SOAPFaultDetailImpl(SOAPFactory factory) {
- super(factory);
+ public SOAPFaultDetailImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, ((SOAPFactory)factory).getSOAPVersion().getFaultDetailQName().getLocalPart(),
+ ns, builder, factory, generateNSDecl);
}
protected SOAPFaultDetailImpl(SOAPFault parent,
- OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(parent, factory.getSOAPVersion().getFaultDetailQName().getLocalPart(), builder,
- factory);
+ boolean extractNamespaceFromParent,
+ SOAPFactory factory) throws SOAPProcessingException {
+ super(parent,
+ factory.getSOAPVersion().getFaultDetailQName().getLocalPart(),
+ extractNamespaceFromParent, factory);
}
public void addDetailEntry(OMElement detailElement) {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultImpl.java Sat Jul 7 18:24:00 2012
@@ -22,6 +22,8 @@ package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMConstants;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.dom.ElementImpl;
import org.apache.axiom.om.impl.dom.ParentNode;
@@ -71,15 +73,9 @@ public abstract class SOAPFaultImpl exte
super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, true, factory);
}
- /**
- * Constructor SOAPFaultImpl
- *
- * @param parent
- * @param builder
- */
- public SOAPFaultImpl(SOAPBody parent, OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, builder, factory);
+ public SOAPFaultImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, SOAPConstants.SOAPFAULT_LOCAL_NAME, ns, builder, factory, generateNSDecl);
}
protected abstract SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault)
@@ -137,7 +133,7 @@ public abstract class SOAPFaultImpl exte
}
OMElement faultDetailEnty = new ElementImpl((ParentNode)detail,
SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY,
- null, this.factory);
+ null, null, this.factory, true);
faultDetailEnty.setText(sw.getBuffer().toString());
}
@@ -199,5 +195,4 @@ public abstract class SOAPFaultImpl exte
protected abstract void serializeFaultNode(
XMLStreamWriter writer)
throws XMLStreamException;
-
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultNodeImpl.java Sat Jul 7 18:24:00 2012
@@ -19,7 +19,10 @@
package org.apache.axiom.soap.impl.dom;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
import org.apache.axiom.soap.SOAP12Constants;
@@ -38,10 +41,9 @@ public abstract class SOAPFaultNodeImpl
super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, true, factory);
}
- public SOAPFaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(parent, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, builder,
- factory);
+ public SOAPFaultNodeImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, ns, builder, factory, generateNSDecl);
}
public void setFaultNodeValue(String uri) {
@@ -104,5 +106,4 @@ public abstract class SOAPFaultNodeImpl
}
-
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultReasonImpl.java Sat Jul 7 18:24:00 2012
@@ -20,11 +20,13 @@
package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.util.ElementHelper;
import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPFault;
import org.apache.axiom.soap.SOAPFaultReason;
import org.apache.axiom.soap.SOAPFaultText;
import org.apache.axiom.soap.SOAPProcessingException;
@@ -37,16 +39,10 @@ public abstract class SOAPFaultReasonImp
SOAPFaultReason {
protected SOAPFaultText text;
- /**
- * Constructor OMElementImpl
- *
- * @param parent
- * @param builder
- */
- public SOAPFaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(parent, factory.getSOAPVersion().getFaultReasonQName().getLocalPart(), builder,
- factory);
+ public SOAPFaultReasonImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, ((SOAPFactory)factory).getSOAPVersion().getFaultReasonQName().getLocalPart(),
+ ns, builder, factory, generateNSDecl);
}
/** @param parent */
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultRoleImpl.java Sat Jul 7 18:24:00 2012
@@ -19,7 +19,10 @@
package org.apache.axiom.soap.impl.dom;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.impl.serialize.StreamWriterToContentHandlerConverter;
import org.apache.axiom.om.impl.util.OMSerializerUtil;
import org.apache.axiom.soap.SOAPFactory;
@@ -30,7 +33,6 @@ import org.apache.axiom.soap.SOAPProcess
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
-
public abstract class SOAPFaultRoleImpl extends SOAPElement implements
SOAPFaultRole {
@@ -41,12 +43,9 @@ public abstract class SOAPFaultRoleImpl
super(parent, localName, extractNamespaceFromParent, factory);
}
- public SOAPFaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(parent,
- factory.getSOAPVersion().getFaultRoleQName().getLocalPart(),
- builder,
- factory);
+ public SOAPFaultRoleImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, ((SOAPFactory)factory).getSOAPVersion().getFaultRoleQName().getLocalPart(), ns, builder, factory, generateNSDecl);
}
public void setRoleValue(String uri) {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultSubCodeImpl.java Sat Jul 7 18:24:00 2012
@@ -20,7 +20,10 @@
package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.om.util.ElementHelper;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPFactory;
@@ -39,11 +42,9 @@ public abstract class SOAPFaultSubCodeIm
super(parent, localName, true, factory);
}
- protected SOAPFaultSubCodeImpl(OMElement parent,
- String localName,
- OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(parent, localName, builder, factory);
+ public SOAPFaultSubCodeImpl(ParentNode parentNode, String localName, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, localName, ns, builder, factory, generateNSDecl);
}
public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultTextImpl.java Sat Jul 7 18:24:00 2012
@@ -20,10 +20,12 @@
package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.dom.AttrImpl;
import org.apache.axiom.om.impl.dom.DocumentImpl;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPFaultReason;
@@ -46,16 +48,15 @@ public abstract class SOAPFaultTextImpl
SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX);
}
- protected SOAPFaultTextImpl(SOAPFaultReason parent,
- OMXMLParserWrapper builder, SOAPFactory factory) {
- super(parent, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, builder,
- factory);
+ public SOAPFaultTextImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME, ns, builder, factory, generateNSDecl);
+ // TODO Auto-generated constructor stub
this.langNamespace = factory.createOMNamespace(
SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_URI,
SOAP12Constants.SOAP_FAULT_TEXT_LANG_ATTR_NS_PREFIX);
}
-
public void setLang(String lang) {
langAttr =
new AttrImpl((DocumentImpl)getOwnerDocument(),
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPFaultValueImpl.java Sat Jul 7 18:24:00 2012
@@ -20,7 +20,10 @@
package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.impl.dom.ParentNode;
import org.apache.axiom.soap.SOAP12Constants;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPFaultValue;
@@ -34,9 +37,8 @@ public abstract class SOAPFaultValueImpl
factory);
}
- protected SOAPFaultValueImpl(OMElement parent, OMXMLParserWrapper builder,
- SOAPFactory factory) {
- super(parent, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, builder,
- factory);
+ public SOAPFaultValueImpl(ParentNode parentNode, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME, ns, builder, factory, generateNSDecl);
}
}
Modified: webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java?rev=1358610&r1=1358609&r2=1358610&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java (original)
+++ webservices/axiom/branches/AXIOM-201/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java Sat Jul 7 18:24:00 2012
@@ -20,8 +20,10 @@
package org.apache.axiom.soap.impl.dom;
import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMCloneOptions;
import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.common.OMNamespaceImpl;
@@ -29,9 +31,8 @@ import org.apache.axiom.om.impl.dom.Attr
import org.apache.axiom.om.impl.dom.DocumentImpl;
import org.apache.axiom.om.impl.dom.ElementImpl;
import org.apache.axiom.om.impl.dom.ParentNode;
+import org.apache.axiom.soap.SOAPCloneOptions;
import org.apache.axiom.soap.SOAPConstants;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPHeader;
import org.apache.axiom.soap.SOAPHeaderBlock;
import org.apache.axiom.soap.SOAPProcessingException;
@@ -41,36 +42,9 @@ public abstract class SOAPHeaderBlockImp
private boolean processed = false;
- /**
- * @param localName
- * @param ns
- * @param parent
- */
- public SOAPHeaderBlockImpl(String localName, OMNamespace ns,
- SOAPHeader parent, SOAPFactory factory)
- throws SOAPProcessingException {
- super((ParentNode) parent, localName, (OMNamespaceImpl) ns, factory);
- this.setNamespace(ns);
- }
-
- public SOAPHeaderBlockImpl(String localName, OMNamespace ns,
- SOAPFactory factory) throws SOAPProcessingException {
- super(null, localName, (OMNamespaceImpl) ns, factory);
- this.setNamespace(ns);
- }
-
- /**
- * Constructor SOAPHeaderBlockImpl.
- *
- * @param localName
- * @param ns
- * @param parent
- * @param builder
- */
- public SOAPHeaderBlockImpl(String localName, OMNamespace ns,
- OMElement parent, OMXMLParserWrapper builder, SOAPFactory factory) {
- super((ParentNode) parent, localName, (OMNamespaceImpl) ns, builder, factory);
- this.setNamespace(ns);
+ public SOAPHeaderBlockImpl(ParentNode parentNode, String localName, OMNamespace ns,
+ OMXMLParserWrapper builder, OMFactory factory, boolean generateNSDecl) {
+ super(parentNode, localName, ns, builder, factory, generateNSDecl);
}
/**
@@ -122,10 +96,34 @@ public abstract class SOAPHeaderBlockImp
}
public boolean isExpanded() {
- throw new UnsupportedOperationException();
+ return true;
}
public OMDataSource setDataSource(OMDataSource dataSource) {
throw new UnsupportedOperationException();
}
+
+ public Object getObject(Class dataSourceClass) {
+ throw new UnsupportedOperationException();
+ }
+
+ protected abstract void checkParent(OMElement parent)
+ throws SOAPProcessingException;
+
+ protected void setParent(ParentNode parent, boolean useDomSemantics) {
+ super.setParent(parent, useDomSemantics);
+
+ if (!useDomSemantics && parent instanceof OMElement) {
+ checkParent((OMElement) parent);
+ }
+ }
+
+ protected final void copyData(OMCloneOptions options, SOAPHeaderBlock targetSHB) {
+ // Copy the processed flag. The other SOAPHeaderBlock information
+ // (e.g. role, mustUnderstand) are attributes on the tag and are copied elsewhere.
+ Boolean processedFlag = options instanceof SOAPCloneOptions ? ((SOAPCloneOptions)options).getProcessedFlag() : null;
+ if ((processedFlag == null && isProcessed()) || (processedFlag != null && processedFlag.booleanValue())) {
+ targetSHB.setProcessed();
+ }
+ }
}