Author: veithen Date: Tue Apr 10 16:02:37 2012 New Revision: 1311808 URL: http://svn.apache.org/viewvc?rev=1311808&view=rev Log: More code for AXIOM-412.
Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java?rev=1311808&r1=1311807&r2=1311808&view=diff ============================================================================== --- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java (original) +++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ElementImpl.java Tue Apr 10 16:02:37 2012 @@ -34,7 +34,6 @@ import org.apache.axiom.om.impl.common.O import org.apache.axiom.om.impl.common.OMDescendantsIterator; import org.apache.axiom.om.impl.common.OMElementImplUtil; import org.apache.axiom.om.impl.common.OMNamespaceImpl; -import org.apache.axiom.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.om.impl.traverse.OMQNameFilterIterator; import org.apache.axiom.om.impl.traverse.OMQualifiedNameFilterIterator; import org.apache.axiom.om.impl.util.EmptyIterator; @@ -141,7 +140,7 @@ public class ElementImpl extends ParentN public ElementImpl(ParentNode parentNode, String tagName, OMNamespaceImpl ns, OMFactory factory) { - this((DocumentImpl) parentNode.getOwnerDocument(), tagName, null, factory); + this(null, tagName, null, factory); parentNode.addChild(this); this.done = true; namespace = handleNamespace(ns); @@ -169,7 +168,6 @@ public class ElementImpl extends ParentN public ElementImpl(OMFactory factory) { super(factory); - setOwnerDocument(((OMDOMFactory) factory).getDocument()); } private OMNamespace handleNamespace(OMNamespace ns) { @@ -708,7 +706,7 @@ public class ElementImpl extends ParentN } } } - return addAttribute(new AttrImpl(ownerDocument(), localName, ns, value, factory)); + return addAttribute(new AttrImpl(null, localName, ns, value, factory)); } public OMNamespace addNamespaceDeclaration(String uri, String prefix) { Modified: webservices/axiom/branches/AXIOM-412/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-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?rev=1311808&r1=1311807&r2=1311808&view=diff ============================================================================== --- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java (original) +++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java Tue Apr 10 16:02:37 2012 @@ -197,12 +197,11 @@ public class OMDOMFactory implements OMF throw new OMHierarchyException( "DOM doesn't support text nodes as children of a document"); } else { - DocumentImpl ownerDocument = (DocumentImpl)((ElementImpl)parent).getOwnerDocument(); TextNodeImpl txt; if (type == OMNode.CDATA_SECTION_NODE) { - txt = new CDATASectionImpl(ownerDocument, text, this); + txt = new CDATASectionImpl(null, text, this); } else { - txt = new TextImpl(ownerDocument, text, type, this); + txt = new TextImpl(null, text, type, this); } parent.addChild(txt); return txt; @@ -215,10 +214,8 @@ public class OMDOMFactory implements OMF } public OMText createOMText(OMContainer parent, char[] charArary, int type) { - ElementImpl parentElem = (ElementImpl) parent; - TextImpl txt = new TextImpl((DocumentImpl) parentElem - .getOwnerDocument(), charArary, this); - parentElem.addChild(txt); + TextImpl txt = new TextImpl(null, charArary, this); + parent.addChild(txt); return txt; } @@ -277,8 +274,7 @@ public class OMDOMFactory implements OMF */ public OMText createOMText(OMContainer parent, String s, String mimeType, boolean optimize) { - TextImpl text = new TextImpl((DocumentImpl) ((ElementImpl) parent) - .getOwnerDocument(), s, mimeType, optimize, this); + TextImpl text = new TextImpl(null, s, mimeType, optimize, this); parent.addChild(text); return text; } @@ -300,11 +296,11 @@ public class OMDOMFactory implements OMF ns = new OMNamespaceImpl(namespaceURI, OMSerializerUtil.getNextNSPrefix()); } } - return new AttrImpl(this.getDocument(), localName, ns, value, this); + return new AttrImpl(null, localName, ns, value, this); } public OMDocType createOMDocType(OMContainer parent, String content) { - DocumentTypeImpl docType = new DocumentTypeImpl(this.getDocument(), this); + DocumentTypeImpl docType = new DocumentTypeImpl(null, this); docType.setValue(content); parent.addChild(docType); return docType; @@ -313,7 +309,7 @@ public class OMDOMFactory implements OMF public OMProcessingInstruction createOMProcessingInstruction( OMContainer parent, String piTarget, String piData) { ProcessingInstructionImpl pi = - new ProcessingInstructionImpl(getDocumentFromParent(parent), piTarget, piData, this); + new ProcessingInstructionImpl(null, piTarget, piData, this); if (parent != null) { parent.addChild(pi); } @@ -321,29 +317,14 @@ public class OMDOMFactory implements OMF } public OMComment createOMComment(OMContainer parent, String content) { - CommentImpl comment = new CommentImpl(getDocumentFromParent(parent), content, this); + CommentImpl comment = new CommentImpl(null, content, this); if (parent != null) { parent.addChild(comment); } return comment; } - public DocumentImpl getDocument() { - return (DocumentImpl) this.createOMDocument(); - } - public OMDocument createOMDocument(OMXMLParserWrapper builder) { return new DocumentImpl(builder, this); } - - private DocumentImpl getDocumentFromParent(OMContainer parent) { - if (parent == null) { - // TODO: this is really a hack; we should make OMDOMFactory stateless - return (DocumentImpl)createOMDocument(); - } else if (parent instanceof DocumentImpl) { - return (DocumentImpl) parent; - } else { - return (DocumentImpl) ((ParentNode) parent).getOwnerDocument(); - } - } } Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java?rev=1311808&r1=1311807&r2=1311808&view=diff ============================================================================== --- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java (original) +++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPEnvelopeImpl.java Tue Apr 10 16:02:37 2012 @@ -41,7 +41,6 @@ import org.apache.axiom.soap.SOAPHeader; import org.apache.axiom.soap.SOAPProcessingException; import org.apache.axiom.soap.SOAPVersion; import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder; -import org.apache.axiom.soap.impl.dom.factory.DOMSOAPFactory; import org.w3c.dom.DOMException; import org.w3c.dom.Node; @@ -69,8 +68,7 @@ public class SOAPEnvelopeImpl extends SO /** @param ns */ public SOAPEnvelopeImpl(OMNamespace ns, SOAPFactory factory) { - super(((DOMSOAPFactory) factory).getDocument(), - SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory); + super(null, SOAPConstants.SOAPENVELOPE_LOCAL_NAME, ns, factory); } public SOAPVersion getVersion() { Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java?rev=1311808&r1=1311807&r2=1311808&view=diff ============================================================================== --- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java (original) +++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/SOAPHeaderBlockImpl.java Tue Apr 10 16:02:37 2012 @@ -29,7 +29,6 @@ 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.om.impl.dom.factory.OMDOMFactory; import org.apache.axiom.soap.SOAPConstants; import org.apache.axiom.soap.SOAPFactory; import org.apache.axiom.soap.SOAPHeader; @@ -56,7 +55,7 @@ public abstract class SOAPHeaderBlockImp public SOAPHeaderBlockImpl(String localName, OMNamespace ns, SOAPFactory factory) throws SOAPProcessingException { - super(((OMDOMFactory) factory).getDocument(), localName, (OMNamespaceImpl) ns, factory); + super(null, localName, (OMNamespaceImpl) ns, factory); this.setNamespace(ns); }