ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1728545 - in /webservices/axiom/trunk: aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/ aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/c...
Date Thu, 04 Feb 2016 19:48:05 GMT
Author: veithen
Date: Thu Feb  4 19:48:04 2016
New Revision: 1728545

URL: http://svn.apache.org/viewvc?rev=1728545&view=rev
Log:
Let the Model implementation determine the type of OMDocument to use.

Removed:
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/
Modified:
    webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaNodeMixin.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/OMFactoryEx.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java
    webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java
    webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java

Modified: webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaNodeMixin.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaNodeMixin.aj?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaNodeMixin.aj
(original)
+++ webservices/axiom/trunk/aspects/fom-aspects/src/main/java/org/apache/axiom/fom/impl/mixin/AbderaNodeMixin.aj
Thu Feb  4 19:48:04 2016
@@ -32,6 +32,9 @@ public aspect AbderaNodeMixin {
     }
     
     public final void AbderaNode.setFactory(AbderaFactory factory) {
+        if (this.factory == factory) {
+            return;
+        }
         if (this.factory != null) {
             throw new IllegalStateException();
         }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/Model.java
Thu Feb  4 19:48:04 2016
@@ -19,9 +19,12 @@
 package org.apache.axiom.om.impl.common.builder;
 
 import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 
 public interface Model {
+    Class<? extends AxiomDocument> getDocumentType();
+    
     /**
      * Determine the element type to use for the current element.
      * 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/PlainXMLModel.java
Thu Feb  4 19:48:04 2016
@@ -19,6 +19,7 @@
 package org.apache.axiom.om.impl.common.builder;
 
 import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 
 public final class PlainXMLModel implements Model {
@@ -27,6 +28,11 @@ public final class PlainXMLModel impleme
     private PlainXMLModel() {}
 
     @Override
+    public Class<? extends AxiomDocument> getDocumentType() {
+        return AxiomDocument.class;
+    }
+
+    @Override
     public Class<? extends AxiomElement> determineElementType(OMContainer parent, int
elementLevel,
             String namespaceURI, String localName) {
         return AxiomElement.class;

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/builder/StAXOMBuilder.java
Thu Feb  4 19:48:04 2016
@@ -20,6 +20,7 @@
 package org.apache.axiom.om.impl.common.builder;
 
 import org.apache.axiom.core.CoreAttribute;
+import org.apache.axiom.core.NodeFactory;
 import org.apache.axiom.ext.stax.DTDReader;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerReader;
 import org.apache.axiom.om.DeferredParsingException;
@@ -38,6 +39,7 @@ import org.apache.axiom.om.impl.builder.
 import org.apache.axiom.om.impl.builder.CustomBuilderSupport;
 import org.apache.axiom.om.impl.builder.Detachable;
 import org.apache.axiom.om.impl.intf.AxiomContainer;
+import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.OMFactoryEx;
 import org.apache.axiom.util.stax.XMLEventUtils;
@@ -96,7 +98,9 @@ public class StAXOMBuilder implements Bu
     /** Field parser */
     private XMLStreamReader parser;
 
-    /** Field omfactory */
+    private final NodeFactory nodeFactory;
+
+    // TODO: this will eventually disappear in favor of NodeFactory
     private final OMFactoryEx omfactory;
     
     private final Detachable detachable;
@@ -121,7 +125,7 @@ public class StAXOMBuilder implements Bu
 
     /** Field parserAccessed */
     private boolean parserAccessed = false;
-    private OMDocument document;
+    private AxiomDocument document;
 
     private String charEncoding = null;
     
@@ -174,8 +178,9 @@ public class StAXOMBuilder implements Bu
     
     private ArrayList<NodePostProcessor> nodePostProcessors;
     
-    private StAXOMBuilder(OMFactory omFactory, XMLStreamReader parser, String encoding,
+    private StAXOMBuilder(NodeFactory nodeFactory, OMFactory omFactory, XMLStreamReader parser,
String encoding,
             boolean autoClose, Detachable detachable, Closeable closeable, Model model, PayloadSelector
payloadSelector) {
+        this.nodeFactory = nodeFactory;
         omfactory = (OMFactoryEx)omFactory;
         this.parser = parser;
         this.autoClose = autoClose;
@@ -187,24 +192,24 @@ public class StAXOMBuilder implements Bu
         dataHandlerReader = XMLStreamReaderUtils.getDataHandlerReader(parser);
     }
     
-    protected StAXOMBuilder(OMFactory omFactory, XMLStreamReader parser, boolean autoClose,
+    protected StAXOMBuilder(NodeFactory nodeFactory, OMFactory omFactory, XMLStreamReader
parser, boolean autoClose,
             Detachable detachable, Closeable closeable, Model model, PayloadSelector payloadSelector)
{
         // The getEncoding information is only available at the START_DOCUMENT event.
-        this(omFactory, parser, parser.getEncoding(), autoClose, detachable, closeable, model,
payloadSelector);
+        this(nodeFactory, omFactory, parser, parser.getEncoding(), autoClose, detachable,
closeable, model, payloadSelector);
         
     }
     
-    public StAXOMBuilder(OMFactory omFactory, XMLStreamReader parser, boolean autoClose,
+    public StAXOMBuilder(NodeFactory nodeFactory, OMFactory omFactory, XMLStreamReader parser,
boolean autoClose,
             Detachable detachable, Closeable closeable) {
-        this(omFactory, parser, autoClose, detachable, closeable, PlainXMLModel.INSTANCE,
PayloadSelector.DEFAULT);
+        this(nodeFactory, omFactory, parser, autoClose, detachable, closeable, PlainXMLModel.INSTANCE,
PayloadSelector.DEFAULT);
     }
     
-    public StAXOMBuilder(OMFactory factory, 
+    public StAXOMBuilder(NodeFactory nodeFactory, OMFactory factory, 
                          XMLStreamReader parser, 
                          OMElement element, 
                          String characterEncoding) {
         // Use this constructor because the parser is passed the START_DOCUMENT state.
-        this(factory, parser, characterEncoding, true, null, null, PlainXMLModel.INSTANCE,
PayloadSelector.DEFAULT);  
+        this(nodeFactory, factory, parser, characterEncoding, true, null, null, PlainXMLModel.INSTANCE,
PayloadSelector.DEFAULT);  
         elementLevel = 1;
         target = (AxiomContainer)element;
         populateOMElement(element);
@@ -517,14 +522,15 @@ public class StAXOMBuilder implements Bu
     
     private void createDocumentIfNecessary() {
         if (document == null && parser.getEventType() == XMLStreamReader.START_DOCUMENT)
{
-            document = createDocument();
+            document = nodeFactory.createNode(model.getDocumentType());
             if (charEncoding != null) {
                 document.setCharsetEncoding(charEncoding);
             }
             document.setXMLVersion(parser.getVersion());
             document.setXMLEncoding(parser.getCharacterEncodingScheme());
             document.setStandalone(parser.isStandalone() ? "yes" : "no");
-            target = (AxiomContainer)document;
+            document.coreSetBuilder(this);
+            target = document;
             postProcessNode(document);
         }
     }
@@ -597,10 +603,6 @@ public class StAXOMBuilder implements Bu
         }
     }
     
-    protected OMDocument createDocument() {
-        return omfactory.createOMDocument(this);
-    }
-
     /**
      * Forwards the parser one step further, if parser is not completed yet. If this is called
after
      * parser is done, then throw an OMException. If the cache is set to false, then returns
the
@@ -674,7 +676,9 @@ public class StAXOMBuilder implements Bu
                 default :
                     throw new OMException();
             }
-            postProcessNode(node);
+            if (node != null) {
+                postProcessNode(node);
+            }
             
             if (target == null && !done) {
                 // We get here if the document has been discarded (by getDocumentElement(true)

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
Thu Feb  4 19:48:04 2016
@@ -31,11 +31,13 @@ import javax.xml.transform.dom.DOMSource
 import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.axiom.core.NodeFactory;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.builder.Detachable;
+import org.apache.axiom.om.impl.common.builder.PlainXMLModel;
 import org.apache.axiom.om.impl.common.builder.StAXOMBuilder;
 import org.apache.axiom.om.util.StAXParserConfiguration;
 import org.apache.axiom.om.util.StAXUtils;
@@ -44,7 +46,6 @@ import org.apache.axiom.soap.SOAPFactory
 import org.apache.axiom.soap.SOAPMessage;
 import org.apache.axiom.soap.SOAPModelBuilder;
 import org.apache.axiom.soap.SOAPProcessingException;
-import org.apache.axiom.soap.impl.builder.OMMetaFactoryEx;
 import org.apache.axiom.soap.impl.common.builder.StAXSOAPModelBuilder;
 import org.apache.axiom.soap.impl.intf.AxiomSOAPMessage;
 import org.apache.axiom.util.stax.XMLEventUtils;
@@ -58,7 +59,7 @@ import org.xml.sax.InputSource;
  * Base class for {@link OMMetaFactory} implementations that make use of the standard builders
  * ({@link org.apache.axiom.om.impl.builder.StAXOMBuilder} and its subclasses).
  */
-public abstract class AbstractOMMetaFactory implements OMMetaFactoryEx {
+public abstract class AbstractOMMetaFactory implements OMMetaFactory {
     private final static class SourceInfo {
         private final XMLStreamReader reader;
         private final Detachable detachable;
@@ -83,6 +84,12 @@ public abstract class AbstractOMMetaFact
         }
     }
     
+    private final NodeFactory nodeFactory;
+    
+    public AbstractOMMetaFactory(NodeFactory nodeFactory) {
+        this.nodeFactory = nodeFactory;
+    }
+    
     private static SourceInfo createXMLStreamReader(StAXParserConfiguration configuration,
             InputSource is, boolean makeDetachable) {
         XMLStreamReader reader;
@@ -160,12 +167,12 @@ public abstract class AbstractOMMetaFact
     }
     
     public OMXMLParserWrapper createStAXOMBuilder(OMFactory omFactory, XMLStreamReader parser)
{
-        return new StAXOMBuilder(omFactory, getXMLStreamReader(parser), false, (Detachable)null,
(Closeable)null);
+        return new StAXOMBuilder(nodeFactory, omFactory, getXMLStreamReader(parser), false,
(Detachable)null, (Closeable)null);
     }
 
     public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, StAXParserConfiguration
configuration, InputSource is) {
         SourceInfo sourceInfo = createXMLStreamReader(configuration, is, true);
-        return new StAXOMBuilder(omFactory, sourceInfo.getReader(), true,
+        return new StAXOMBuilder(nodeFactory, omFactory, sourceInfo.getReader(), true,
                 sourceInfo.getDetachable(), sourceInfo.getCloseable());
     }
     
@@ -188,7 +195,7 @@ public abstract class AbstractOMMetaFact
                     toInputSource((StreamSource)source));
         } else {
             try {
-                return new StAXOMBuilder(omFactory, StAXUtils.getXMLInputFactory().createXMLStreamReader(source),
true, (Detachable)null, (Closeable)null);
+                return new StAXOMBuilder(nodeFactory, omFactory, StAXUtils.getXMLInputFactory().createXMLStreamReader(source),
true, (Detachable)null, (Closeable)null);
             } catch (XMLStreamException ex) {
                 throw new OMException(ex);
             }
@@ -197,18 +204,19 @@ public abstract class AbstractOMMetaFact
 
     public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Node node,
             boolean expandEntityReferences) {
-        return new StAXOMBuilder(omFactory, new DOMXMLStreamReader(node, expandEntityReferences),
true, (Detachable)null, (Closeable)null);
+        return new StAXOMBuilder(nodeFactory, omFactory, new DOMXMLStreamReader(node, expandEntityReferences),
true, (Detachable)null, (Closeable)null);
     }
 
     public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, SAXSource source,
             boolean expandEntityReferences) {
-        return new SAXOMBuilder(omFactory, source, expandEntityReferences);
+        return new SAXOMBuilder(nodeFactory, omFactory, PlainXMLModel.INSTANCE, source, expandEntityReferences);
     }
 
     public OMXMLParserWrapper createOMBuilder(StAXParserConfiguration configuration,
             OMFactory omFactory, InputSource rootPart, MimePartProvider mimePartProvider)
{
         SourceInfo sourceInfo = createXMLStreamReader(configuration, rootPart, false);
         return new StAXOMBuilder(
+                nodeFactory, 
                 omFactory,
                 new XOPDecodingStreamReader(sourceInfo.getReader(), mimePartProvider),
                 true,
@@ -217,12 +225,12 @@ public abstract class AbstractOMMetaFact
     }
 
     public SOAPModelBuilder createStAXSOAPModelBuilder(XMLStreamReader parser) {
-        return new StAXSOAPModelBuilder(this, getXMLStreamReader(parser), false, null, null);
+        return new StAXSOAPModelBuilder(nodeFactory, this, getXMLStreamReader(parser), false,
null, null);
     }
 
     public SOAPModelBuilder createSOAPModelBuilder(StAXParserConfiguration configuration,
InputSource is) {
         SourceInfo sourceInfo = createXMLStreamReader(configuration, is, true);
-        return new StAXSOAPModelBuilder(this, sourceInfo.getReader(), true,
+        return new StAXSOAPModelBuilder(nodeFactory, this, sourceInfo.getReader(), true,
                 sourceInfo.getDetachable(), sourceInfo.getCloseable());
     }
 
@@ -231,13 +239,13 @@ public abstract class AbstractOMMetaFact
             // TODO: supporting this will require some refactoring of the builders
             throw new UnsupportedOperationException();
         } else if (source instanceof DOMSource) {
-            return new StAXSOAPModelBuilder(this, new DOMXMLStreamReader(((DOMSource)source).getNode(),
true), true, (Detachable)null, (Closeable)null);
+            return new StAXSOAPModelBuilder(nodeFactory, this, new DOMXMLStreamReader(((DOMSource)source).getNode(),
true), true, (Detachable)null, (Closeable)null);
         } else if (source instanceof StreamSource) {
             return createSOAPModelBuilder(StAXParserConfiguration.SOAP,
                     toInputSource((StreamSource)source));
         } else {
             try {
-                return new StAXSOAPModelBuilder(this, StAXUtils.getXMLInputFactory().createXMLStreamReader(source),
true, (Detachable)null, (Closeable)null);
+                return new StAXSOAPModelBuilder(nodeFactory, this, StAXUtils.getXMLInputFactory().createXMLStreamReader(source),
true, (Detachable)null, (Closeable)null);
             } catch (XMLStreamException ex) {
                 throw new OMException(ex);
             }
@@ -248,6 +256,7 @@ public abstract class AbstractOMMetaFact
             SOAPFactory soapFactory, InputSource rootPart, MimePartProvider mimePartProvider)
{
         SourceInfo sourceInfo = createXMLStreamReader(configuration, rootPart, false);
         StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(
+                nodeFactory,
                 soapFactory.getMetaFactory(),
                 new XOPDecodingStreamReader(sourceInfo.getReader(), mimePartProvider),
                 true,

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/OMFactoryImpl.java
Thu Feb  4 19:48:04 2016
@@ -89,12 +89,6 @@ public class OMFactoryImpl implements OM
         return createNode(AxiomDocument.class);
     }
 
-    public final OMDocument createOMDocument(OMXMLParserWrapper builder) {
-        AxiomDocument document = createNode(AxiomDocument.class);
-        document.coreSetBuilder(builder);
-        return document;
-    }
-
     public final OMDocType createOMDocType(OMContainer parent, String rootName,
             String publicId, String systemId, String internalSubset) {
         return createOMDocType(parent, rootName, publicId, systemId, internalSubset, false);

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/SAXOMBuilder.java
Thu Feb  4 19:48:04 2016
@@ -19,6 +19,7 @@
 
 package org.apache.axiom.om.impl.common.factory;
 
+import org.apache.axiom.core.NodeFactory;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
@@ -27,7 +28,9 @@ import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.common.OMContentHandler;
 import org.apache.axiom.om.impl.common.builder.BuilderUtil;
+import org.apache.axiom.om.impl.common.builder.Model;
 import org.apache.axiom.om.impl.intf.AxiomContainer;
+import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.OMFactoryEx;
 import org.xml.sax.SAXException;
@@ -38,20 +41,25 @@ import java.io.IOException;
 import javax.xml.transform.sax.SAXSource;
 
 public class SAXOMBuilder extends OMContentHandler implements OMXMLParserWrapper {
+    private final NodeFactory nodeFactory;
+    private final Model model;
     private final SAXSource source;
     
-    private OMDocument document;
+    private AxiomDocument document;
     
     private final OMFactoryEx factory;
 
-    public SAXOMBuilder(OMFactory factory, SAXSource source, boolean expandEntityReferences)
{
+    public SAXOMBuilder(NodeFactory nodeFactory, OMFactory factory, Model model, SAXSource
source, boolean expandEntityReferences) {
         super(expandEntityReferences);
+        this.nodeFactory = nodeFactory;
         this.factory = (OMFactoryEx)factory;
+        this.model = model;
         this.source = source;
     }
     
     protected OMContainer doStartDocument() {
-        document = factory.createOMDocument(this);
+        document = nodeFactory.createNode(model.getDocumentType());
+        document.coreSetBuilder(this);
         return document;
     }
 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/OMFactoryEx.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/OMFactoryEx.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/OMFactoryEx.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/intf/OMFactoryEx.java
Thu Feb  4 19:48:04 2016
@@ -21,11 +21,8 @@ package org.apache.axiom.om.impl.intf;
 import org.apache.axiom.om.OMComment;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMDocType;
-import org.apache.axiom.om.OMDocument;
-import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMEntityReference;
 import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMProcessingInstruction;
 import org.apache.axiom.om.OMText;
@@ -37,8 +34,6 @@ import org.apache.axiom.om.OMXMLParserWr
  */
 public interface OMFactoryEx extends OMFactory {
 
-    OMDocument createOMDocument(OMXMLParserWrapper builder);
-
     <T extends AxiomElement> T createAxiomElement(Class<T> type, String localName,
             OMContainer parent, OMXMLParserWrapper builder);
 

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomSourcedElementSupport.aj
Thu Feb  4 19:48:04 2016
@@ -250,7 +250,7 @@ public aspect AxiomSourcedElementSupport
                 // Set the builder for this element. Note that the StAXOMBuilder constructor
will also
                 // update the namespace of the element, so we don't need to do that here.
                 isExpanded = true;
-                coreSetBuilder(new StAXOMBuilder(getOMFactory(), readerFromDS, this, characterEncoding));
+                coreSetBuilder(new StAXOMBuilder(coreGetNodeFactory(), getOMFactory(), readerFromDS,
this, characterEncoding));
                 setComplete(false);
             }
         }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAPModel.java
Thu Feb  4 19:48:04 2016
@@ -22,11 +22,13 @@ package org.apache.axiom.soap.impl.commo
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.impl.common.builder.Model;
+import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPConstants;
 import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axiom.soap.impl.intf.AxiomSOAPMessage;
 import org.apache.axiom.soap.impl.intf.SOAPHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -48,6 +50,11 @@ public final class SOAPModel implements
     private SOAPBuilderHelper builderHelper;
 
     @Override
+    public Class<? extends AxiomDocument> getDocumentType() {
+        return AxiomSOAPMessage.class;
+    }
+
+    @Override
     public Class<? extends AxiomElement> determineElementType(OMContainer parent,
             int elementLevel, String namespaceURI, String localName) {
         Class<? extends AxiomElement> elementType;

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/soap/impl/common/builder/StAXSOAPModelBuilder.java
Thu Feb  4 19:48:04 2016
@@ -21,7 +21,7 @@ package org.apache.axiom.soap.impl.commo
 
 import java.io.Closeable;
 
-import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.core.NodeFactory;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMNode;
@@ -34,7 +34,6 @@ import org.apache.axiom.soap.SOAPFactory
 import org.apache.axiom.soap.SOAPMessage;
 import org.apache.axiom.soap.SOAPModelBuilder;
 import org.apache.axiom.soap.SOAPProcessingException;
-import org.apache.axiom.soap.impl.builder.OMMetaFactoryEx;
 import org.apache.axiom.soap.impl.intf.AxiomSOAPEnvelope;
 import org.apache.axiom.soap.impl.intf.AxiomSOAPMessage;
 
@@ -44,17 +43,10 @@ import javax.xml.stream.XMLStreamReader;
  * Internal implementation class.
  */
 public class StAXSOAPModelBuilder extends StAXOMBuilder implements SOAPModelBuilder {
-    /**
-     * The meta factory used to get the SOAPFactory implementation when SOAP version detection
-     * is enabled. This is only used if <code>soapFactory</code> is <code>null</code>.
-     */
-    private OMMetaFactory metaFactory;
-
-    public StAXSOAPModelBuilder(OMMetaFactory metaFactory, XMLStreamReader parser,
+    public StAXSOAPModelBuilder(NodeFactory nodeFactory, OMMetaFactory metaFactory, XMLStreamReader
parser,
             boolean autoClose, Detachable detachable, Closeable closeable) {
-        super(metaFactory.getOMFactory(), parser, autoClose, detachable, closeable, new SOAPModel(),
+        super(nodeFactory, metaFactory.getOMFactory(), parser, autoClose, detachable, closeable,
new SOAPModel(),
                 SOAPPayloadSelector.INSTANCE);
-        this.metaFactory = metaFactory;
         // The SOAPFactory instance linked to the SOAPMessage is unknown until we reach the
         // SOAPEnvelope. Register a post-processor that does the necessary updates on the
         // SOAPMessage.
@@ -76,10 +68,6 @@ public class StAXSOAPModelBuilder extend
         return (SOAPEnvelope)getDocumentElement();
     }
 
-    protected OMDocument createDocument() {
-        return ((OMMetaFactoryEx)metaFactory).createSOAPMessage(this);
-    }
-
     /** Method createDTD. Overriding the default behaviour as a SOAPMessage should not have
a DTD. */
     protected OMNode createDTD() throws OMException {
         throw new SOAPProcessingException("SOAP message MUST NOT contain a Document Type
Declaration(DTD)");

Modified: webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactory.java
Thu Feb  4 19:48:04 2016
@@ -41,7 +41,9 @@ public class OMDOMMetaFactory extends Ab
     private final SOAPFactory soap11Factory = new SOAP11Factory(this, DOOMNodeFactory.INSTANCE);
     private final SOAPFactory soap12Factory = new SOAP12Factory(this, DOOMNodeFactory.INSTANCE);
 
-    private OMDOMMetaFactory() {}
+    private OMDOMMetaFactory() {
+        super(DOOMNodeFactory.INSTANCE);
+    }
     
     public OMFactory getOMFactory() {
         return omFactory;

Modified: webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
(original)
+++ webservices/axiom/trunk/implementations/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactory.java
Thu Feb  4 19:48:04 2016
@@ -37,7 +37,9 @@ public class OMLinkedListMetaFactory ext
     private final SOAPFactory soap11Factory = new SOAP11Factory(this, LLOMNodeFactory.INSTANCE);
     private final SOAPFactory soap12Factory = new SOAP12Factory(this, LLOMNodeFactory.INSTANCE);
     
-    private OMLinkedListMetaFactory() {}
+    private OMLinkedListMetaFactory() {
+        super(LLOMNodeFactory.INSTANCE);
+    }
     
     public OMFactory getOMFactory() {
         return omFactory;

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
Thu Feb  4 19:48:04 2016
@@ -26,8 +26,12 @@ import org.apache.abdera.model.Element;
 import org.apache.abdera.parser.ParseException;
 import org.apache.abdera.parser.ParserOptions;
 import org.apache.abdera.util.Constants;
+import org.apache.axiom.fom.AbderaNode;
+import org.apache.axiom.fom.impl.FOMNodeFactory;
 import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.impl.builder.Detachable;
+import org.apache.axiom.om.impl.common.builder.NodePostProcessor;
 import org.apache.axiom.om.impl.common.builder.PayloadSelector;
 import org.apache.axiom.om.impl.common.builder.StAXOMBuilder;
 
@@ -37,11 +41,17 @@ public class FOMBuilder extends StAXOMBu
     private final FOMFactory fomfactory;
     private final ParserOptions parserOptions;
 
-    public FOMBuilder(FOMFactory factory, XMLStreamReader parser, ParserOptions parserOptions)
{
-        super(factory, new FOMStAXFilter(parser, parserOptions), false, (Detachable)null,
(Closeable)null,
+    public FOMBuilder(final FOMFactory factory, XMLStreamReader parser, ParserOptions parserOptions)
{
+        super(FOMNodeFactory.INSTANCE, factory, new FOMStAXFilter(parser, parserOptions),
false, (Detachable)null, (Closeable)null,
                 factory, PayloadSelector.DEFAULT);
         this.parserOptions = parserOptions;
         this.fomfactory = factory;
+        addNodePostProcessor(new NodePostProcessor() {
+            @Override
+            public void postProcessNode(OMSerializable node) {
+                ((AbderaNode)node).setFactory(factory);
+            }
+        });
     }
 
     public ParserOptions getParserOptions() {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
Thu Feb  4 19:48:04 2016
@@ -62,6 +62,7 @@ import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.common.builder.Model;
 import org.apache.axiom.om.impl.common.factory.OMFactoryImpl;
+import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.util.xml.QNameMap;
 
 @SuppressWarnings( {"unchecked", "deprecation"})
@@ -510,6 +511,11 @@ public class FOMFactory extends OMFactor
     }
 
     @Override
+    public Class<? extends AxiomDocument> getDocumentType() {
+        return FOMDocument.class;
+    }
+
+    @Override
     public Class<? extends FOMElement> determineElementType(OMContainer parent, int
elementLevel, String namespaceURI, String localName) {
         Class<? extends FOMElement> elementType = elementTypeMap.get(namespaceURI,
localName);
         if (elementType != null) {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java?rev=1728545&r1=1728544&r2=1728545&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMMetaFactory.java
Thu Feb  4 19:48:04 2016
@@ -17,6 +17,7 @@
  */
 package org.apache.abdera.parser.stax;
 
+import org.apache.axiom.fom.impl.FOMNodeFactory;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.impl.common.factory.AbstractOMMetaFactory;
 import org.apache.axiom.soap.SOAPFactory;
@@ -27,7 +28,9 @@ public final class FOMMetaFactory extend
     
     private final OMFactory omFactory = new FOMFactory();
     
-    private FOMMetaFactory() {}
+    private FOMMetaFactory() {
+        super(FOMNodeFactory.INSTANCE);
+    }
     
     public OMFactory getOMFactory() {
         return omFactory;




Mime
View raw message