ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1311475 - in /webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom: om/impl/dom/ om/impl/dom/factory/ soap/impl/dom/factory/ soap/impl/dom/soap11/ soap/impl/dom/soap12/
Date Mon, 09 Apr 2012 21:45:22 GMT
Author: veithen
Date: Mon Apr  9 21:45:21 2012
New Revision: 1311475

URL: http://svn.apache.org/viewvc?rev=1311475&view=rev
Log:
Made OMDOMFactory stateless.

Modified:
    webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.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/factory/DOMSOAPFactory.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
    webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java?rev=1311475&r1=1311474&r2=1311475&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DOMImplementationImpl.java
Mon Apr  9 21:45:21 2012
@@ -40,7 +40,6 @@ public class DOMImplementationImpl imple
         // TODO Handle docType stuff
         OMDOMFactory fac = new OMDOMFactory();
         DocumentImpl doc = new DocumentImpl(fac);
-        fac.setDocument(doc);
 
         new ElementImpl(doc, DOMUtil.getLocalName(qualifiedName),
                         new OMNamespaceImpl(namespaceURI, DOMUtil

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java?rev=1311475&r1=1311474&r2=1311475&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/DocumentImpl.java
Mon Apr  9 21:45:21 2012
@@ -33,7 +33,6 @@ import org.apache.axiom.om.impl.MTOMXMLS
 import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.common.OMDocumentImplUtil;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
-import org.apache.axiom.om.impl.dom.factory.OMDOMFactory;
 import org.w3c.dom.Attr;
 import org.w3c.dom.CDATASection;
 import org.w3c.dom.Comment;
@@ -78,19 +77,16 @@ public class DocumentImpl extends Parent
     /** @param ownerDocument  */
     public DocumentImpl(DocumentImpl ownerDocument, OMFactory factory) {
         super(ownerDocument, factory);
-        ((OMDOMFactory) factory).setDocument(this);
         this.done = true;
     }
 
     public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory) {
         super(factory);
         this.builder = parserWrapper;
-        ((OMDOMFactory) factory).setDocument(this);
     }
 
     public DocumentImpl(OMFactory factory) {
         super(factory);
-        ((OMDOMFactory) factory).setDocument(this);
         this.done = true;
     }
 

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=1311475&r1=1311474&r2=1311475&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
Mon Apr  9 21:45:21 2012
@@ -58,29 +58,10 @@ 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}.
- * <p>
- * Since DOM requires every node to have an owner document even if it has not yet
- * been added to a tree, this factory internally maintains a reference to a
- * {@link DocumentImpl} instance. The document can be set explicitly using the
- * {@link #OMDOMFactory(DocumentImpl)} constructor or the {@link #setDocument(DocumentImpl)}
- * method. If none is set, it will be implicitly created when the first node is created.
- * All nodes created by this factory will have this {@link DocumentImpl} instance as owner
- * document.
- * <p>
- * This has several important consequences:
- * <ul>
- *   <li>The same instance of this class should not be used to parse or construct
- *       multiple documents unless {@link #setDocument(DocumentImpl)} is used
- *       to reset the {@link DocumentImpl} instance before processing the next document.</li>
- *   <li>Instances of this class are not thread safe and using a single instance concurrently
- *       will lead to undefined results.</li>
- * </ul>
  */
 public class OMDOMFactory implements OMFactory {
     private final OMDOMMetaFactory metaFactory;
 
-    protected DocumentImpl document;
-
     public OMDOMFactory(OMDOMMetaFactory metaFactory) {
         this.metaFactory = metaFactory;
     }
@@ -89,41 +70,23 @@ public class OMDOMFactory implements OMF
         this(new OMDOMMetaFactory());
     }
 
-    public OMDOMFactory(DocumentImpl doc) {
-        this(new OMDOMMetaFactory());
-        this.document = doc;
-    }
-
     public OMMetaFactory getMetaFactory() {
         return metaFactory;
     }
 
     public OMDocument createOMDocument() {
-        if (this.document == null)
-            this.document = new DocumentImpl(this);
-
-        return this.document;
-    }
-
-    /**
-     * Configure this factory to use the given document. Use with care.
-     *
-     * @param document
-     */
-    public void setDocument(DocumentImpl document) {
-        this.document = document;
+        return new DocumentImpl(this);
     }
 
     public OMElement createOMElement(String localName, OMNamespace ns) {
-        return new ElementImpl((DocumentImpl) this.createOMDocument(),
+        return new ElementImpl(null,
                                localName, (OMNamespaceImpl) ns, this);
     }
 
     public OMElement createOMElement(String localName, OMNamespace ns,
                                      OMContainer parent) throws OMDOMException {
         if (parent == null) {
-            return new ElementImpl((DocumentImpl) this.createOMDocument(),
-                               localName, (OMNamespaceImpl) ns, this);
+            return createOMElement(localName, ns);
         }
 
         switch (((ParentNode) parent).getNodeType()) {
@@ -310,7 +273,7 @@ public class OMDOMFactory implements OMF
      * @see org.apache.axiom.om.OMFactory#createOMText(String)
      */
     public OMText createOMText(String s) {
-        return new TextImpl(this.document, s, this);
+        return new TextImpl(null, s, this);
     }
 
     /**
@@ -320,9 +283,9 @@ public class OMDOMFactory implements OMF
      */
     public OMText createOMText(String text, int type) {
         if (type == OMNode.CDATA_SECTION_NODE) {
-            return new CDATASectionImpl(document, text, this);
+            return new CDATASectionImpl(null, text, this);
         } else {
-            return new TextImpl(document, text, this);
+            return new TextImpl(null, text, this);
         }
     }
 
@@ -333,7 +296,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(this.document, text, mimeType, optimize, this);
+        return new TextImpl(null, text, mimeType, optimize, this);
     }
 
     /**
@@ -343,12 +306,12 @@ public class OMDOMFactory implements OMF
      * @see org.apache.axiom.om.OMFactory#createOMText(Object, boolean)
      */
     public OMText createOMText(Object dataHandler, boolean optimize) {
-        return new TextImpl(this.document, dataHandler, optimize, this);
+        return new TextImpl(null, dataHandler, optimize, this);
     }
 
     public OMText createOMText(String contentID, DataHandlerProvider dataHandlerProvider,
             boolean optimize) {
-        return new TextImpl(this.document, contentID, dataHandlerProvider, optimize, this);
+        return new TextImpl(null, contentID, dataHandlerProvider, optimize, this);
     }
 
     /**
@@ -415,8 +378,7 @@ public class OMDOMFactory implements OMF
     }
 
     public OMDocument createOMDocument(OMXMLParserWrapper builder) {
-        this.document = new DocumentImpl(builder, this);
-        return this.document;
+        return new DocumentImpl(builder, this);
     }
 
     private DocumentImpl getDocumentFromParent(OMContainer parent) {

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java?rev=1311475&r1=1311474&r2=1311475&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/factory/DOMSOAPFactory.java
Mon Apr  9 21:45:21 2012
@@ -52,20 +52,12 @@ public abstract class DOMSOAPFactory ext
     public DOMSOAPFactory() {
     }
 
-    public DOMSOAPFactory(DocumentImpl doc) {
-        super(doc);
-    }
-
     public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder) {
-        SOAPMessageImpl messageImpl = new SOAPMessageImpl(builder, this);
-        this.document = messageImpl;
-        return messageImpl;
+        return new SOAPMessageImpl(builder, this);
     }
 
     public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper)
{
-        SOAPMessageImpl messageImpl = new SOAPMessageImpl(envelope, parserWrapper, this);
-        this.document = messageImpl;
-        return messageImpl;
+        return new SOAPMessageImpl(envelope, parserWrapper, this);
     }
 
     public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) {

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java?rev=1311475&r1=1311474&r2=1311475&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap11/SOAP11Factory.java
Mon Apr  9 21:45:21 2012
@@ -22,7 +22,6 @@ package org.apache.axiom.soap.impl.dom.s
 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.factory.OMDOMMetaFactory;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAPBody;
@@ -55,10 +54,6 @@ public class SOAP11Factory extends DOMSO
     public SOAP11Factory() {
     }
 
-    public SOAP11Factory(DocumentImpl doc) {
-        super(doc);
-    }
-
     public String getSoapVersionURI() {
         return SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
     }

Modified: webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java?rev=1311475&r1=1311474&r2=1311475&view=diff
==============================================================================
--- webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
(original)
+++ webservices/axiom/branches/AXIOM-412/modules/axiom-dom/src/main/java/org/apache/axiom/soap/impl/dom/soap12/SOAP12Factory.java
Mon Apr  9 21:45:21 2012
@@ -22,7 +22,6 @@ package org.apache.axiom.soap.impl.dom.s
 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.factory.OMDOMMetaFactory;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPBody;
@@ -54,10 +53,6 @@ public class SOAP12Factory extends DOMSO
     public SOAP12Factory() {
     }
 
-    public SOAP12Factory(DocumentImpl doc) {
-        super(doc);
-    }
-
     public String getSoapVersionURI() {
         return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
     }



Mime
View raw message