ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1701110 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/ axiom-api/src/main/java/org/apache/axiom/om/ axiom-api/src/main/java/org/apache/axiom/om/impl/builder/ axiom-api/src/main/java...
Date Thu, 03 Sep 2015 19:06:52 GMT
Author: veithen
Date: Thu Sep  3 19:06:52 2015
New Revision: 1701110

URL: http://svn.apache.org/r1701110
Log:
Make it clear that StAXBuilder, StAXOMBuilder, XOPAwareStAXOMBuilder, StAXSOAPModelBuilder
and MTOMStAXSOAPModelBuilder are internal implementation classes that shouldn't be used directly
by application code.

Added:
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/CustomBuilderSupport.java
  (with props)
Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/factory/AbstractOMMetaFactory.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/util/CopyUtils.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/MTOMStAXSOAPModelBuilder.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMBuilder.java
    webservices/axiom/trunk/systests/integration-tests/src/test/java/org/apache/axiom/om/impl/builder/JAXBCustomBuilderTest.java

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=1701110&r1=1701109&r2=1701110&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 Sep  3 19:06:52 2015
@@ -160,7 +160,7 @@ public abstract class AbstractOMMetaFact
     }
     
     public OMXMLParserWrapper createStAXOMBuilder(OMFactory omFactory, XMLStreamReader parser)
{
-        return new StAXOMBuilder(omFactory, getXMLStreamReader(parser));
+        return new StAXOMBuilder(omFactory, getXMLStreamReader(parser), (Detachable)null,
(Closeable)null);
     }
 
     public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, StAXParserConfiguration
configuration, InputSource is) {
@@ -190,7 +190,7 @@ public abstract class AbstractOMMetaFact
                     toInputSource((StreamSource)source));
         } else {
             try {
-                return new StAXOMBuilder(omFactory, StAXUtils.getXMLInputFactory().createXMLStreamReader(source));
+                return new StAXOMBuilder(omFactory, StAXUtils.getXMLInputFactory().createXMLStreamReader(source),
(Detachable)null, (Closeable)null);
             } catch (XMLStreamException ex) {
                 throw new OMException(ex);
             }
@@ -199,7 +199,7 @@ public abstract class AbstractOMMetaFact
 
     public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, Node node,
             boolean expandEntityReferences) {
-        return new StAXOMBuilder(omFactory, new DOMXMLStreamReader(node, expandEntityReferences));
+        return new StAXOMBuilder(omFactory, new DOMXMLStreamReader(node, expandEntityReferences),
(Detachable)null, (Closeable)null);
     }
 
     public OMXMLParserWrapper createOMBuilder(OMFactory omFactory, SAXSource source,

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMXMLBuilderFactory.java
Thu Sep  3 19:06:52 2015
@@ -28,11 +28,13 @@ import javax.xml.transform.Source;
 import javax.xml.transform.sax.SAXSource;
 
 import org.apache.axiom.attachments.Attachments;
+import org.apache.axiom.ext.stax.datahandler.DataHandlerReader;
 import org.apache.axiom.mime.ContentType;
 import org.apache.axiom.om.impl.builder.AttachmentsMimePartProvider;
 import org.apache.axiom.om.util.StAXParserConfiguration;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPModelBuilder;
+import org.apache.axiom.util.stax.XMLStreamReaderUtils;
 import org.w3c.dom.EntityReference;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
@@ -60,6 +62,10 @@ public class OMXMLBuilderFactory {
      * well defined way to build an object model from a fragment (corresponding to a single
element)
      * of the document represented by the stream reader.
      * <p>
+     * The builder supports the {@link XMLStreamReader} extension defined by
+     * {@link DataHandlerReader} as well as the legacy extension mechanism defined in the
+     * documentation of {@link XMLStreamReaderUtils}.
+     * <p>
      * The returned builder also performs namespace repairing, i.e. it adds appropriate namespace
      * declarations if undeclared namespaces appear in the StAX stream.
      * 

Added: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/CustomBuilderSupport.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/CustomBuilderSupport.java?rev=1701110&view=auto
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/CustomBuilderSupport.java
(added)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/CustomBuilderSupport.java
Thu Sep  3 19:06:52 2015
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.om.impl.builder;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Interface allowing registration of a custom builder. This is a semi-public API used by
Axis2; it
+ * is not meant for general consumption.
+ */
+public interface CustomBuilderSupport {
+    /**
+     * Register a CustomBuilder associated with the indicated QName.
+     * The CustomBuilder will be used when an element of that qname is encountered.
+     * @param qName
+     * @param maxDepth indicate the maximum depth that this qname will be found. (root =
0)
+     * @param customBuilder
+     * @return replaced CustomBuilder or null
+     */
+    CustomBuilder registerCustomBuilder(QName qName, int maxDepth, CustomBuilder customBuilder);
+    
+    /**
+     * Register a CustomBuilder for a payload.
+     * The payload is defined as the elements inside a SOAPBody or the 
+     * document element of a REST message.
+     * @param customBuilder
+     * @return replaced CustomBuilder or null
+     */
+    CustomBuilder registerCustomBuilderForPayload(CustomBuilder customBuilder);
+}

Propchange: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/CustomBuilderSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
Thu Sep  3 19:06:52 2015
@@ -52,11 +52,9 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 /**
- * OM should be able to be built from any data source. And the model it builds may be a SOAP
- * specific one or just an XML model. This class will give some common functionality of OM
Building
- * from StAX.
+ * Internal implementation class.
  */
-public abstract class StAXBuilder implements OMXMLParserWrapper {
+public abstract class StAXBuilder implements OMXMLParserWrapper, CustomBuilderSupport {
 
     private static final Log log = LogFactory.getLog(StAXBuilder.class);
     
@@ -151,23 +149,14 @@ public abstract class StAXBuilder implem
     }
     
     /**
-     * Constructor StAXBuilder.
-     * This constructor is used if the parser is at the beginning (START_DOCUMENT).
-     *
-     * @param omFactory
-     * @param parser
+     * @deprecated
      */
     protected StAXBuilder(OMFactory omFactory, XMLStreamReader parser) {
         this(omFactory, parser, null, null);
     }
     
     /**
-     * Constructor StAXBuilder.
-     * This constructor is used if the parser is not at the START_DOCUMENT.
-     *
-     * @param omFactory
-     * @param parser
-     * @param encoding
+     * @deprecated
      */
     protected StAXBuilder(OMFactory omFactory, 
                           XMLStreamReader parser, 
@@ -184,9 +173,7 @@ public abstract class StAXBuilder implem
     }
 
     /**
-     * Constructor StAXBuilder.
-     *
-     * @param parser
+     * @deprecated
      */
     protected StAXBuilder(XMLStreamReader parser) {
         this(OMAbstractFactory.getOMFactory(), parser);
@@ -668,14 +655,6 @@ public abstract class StAXBuilder implem
      */
     public abstract int next() throws OMException;
     
-    /**
-     * Register a CustomBuilder associated with the indicated QName.
-     * The CustomBuilder will be used when an element of that qname is encountered.
-     * @param qName
-     * @param maxDepth indicate the maximum depth that this qname will be found. (root =
0)
-     * @param customBuilder
-     * @return replaced CustomBuilder or null
-     */
     public CustomBuilder registerCustomBuilder(QName qName, int maxDepth, CustomBuilder customBuilder)
{
         CustomBuilder old = null;
         if (customBuilders == null) {
@@ -691,13 +670,6 @@ public abstract class StAXBuilder implem
     }
     
     
-    /**
-     * Register a CustomBuilder for a payload.
-     * The payload is defined as the elements inside a SOAPBody or the 
-     * document element of a REST message.
-     * @param customBuilder
-     * @return replaced CustomBuilder or null
-     */
     public CustomBuilder registerCustomBuilderForPayload(CustomBuilder customBuilder) {
         CustomBuilder old = null;
         this.customBuilderForPayload = customBuilder;

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
Thu Sep  3 19:06:52 2015
@@ -29,6 +29,7 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMHierarchyException;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.impl.OMContainerEx;
 import org.apache.axiom.om.impl.OMElementEx;
 import org.apache.axiom.om.util.StAXUtils;
@@ -48,37 +49,36 @@ import java.io.FileNotFoundException;
 import java.io.InputStream;
 
 /**
- * StAX based builder that produces a pure XML infoset compliant object model.
- * <p>
- * This class supports the {@link XMLStreamReader} extension defined by
- * {@link org.apache.axiom.ext.stax.datahandler.DataHandlerReader} as well as the legacy
extension mechanism
- * defined in the documentation of {@link org.apache.axiom.util.stax.XMLStreamReaderUtils}.
- * <h3>Error handling</h3>
+ * Internal implementation class.
+ */
+/* Implementation note about error handling
+ * ----------------------------------------
+ * 
  * Usually, code that uses StAX directly just stops processing of an XML document
  * once the first parsing error has been reported. However, since Axiom
  * uses deferred parsing, and client code accesses the XML infoset using
  * an object model, things are more complicated. Indeed, if the XML
  * document is not well formed, the corresponding error might be reported
  * as a runtime exception by any call to a method of an OM node.
- * <p>
+ * 
  * Typically the client code will have some error handling that will intercept
  * runtime exceptions and take appropriate action. Very often this error handling
  * code might want to access the object model again, for example to log the request that
caused the
  * failure. This causes no problem except if the runtime exception was caused by a
  * parsing error, in which case Axiom would again try to pull events from the parser.
- * <p>
+ * 
  * This would lead to a situation where Axiom accesses a parser that has reported a parsing
  * error before. While one would expect that after a first error reported by the parser,
all
  * subsequent invocations of the parser will fail, this is not the case for all parsers
  * (at least not in all situations). Instead, the parser might be left in an inconsistent
  * state after the error. E.g. AXIOM-34 describes a case where Woodstox
- * encounters an error in {@link XMLStreamReader#getText()} but continues to return
+ * encounters an error in XMLStreamReader#getText() but continues to return
  * (incorrect) events afterwards. The explanation for this behaviour might be that
  * the situation described here is quite uncommon when StAX is used directly (i.e. not through
  * Axiom).
- * <p>
+ * 
  * To avoid this, the builder remembers exceptions thrown by the parser and rethrows
- * them during a call to {@link #next()}.
+ * them during a call to next().
  */
 public class StAXOMBuilder extends StAXBuilder {
     private static final Log log = LogFactory.getLog(StAXOMBuilder.class);
@@ -107,66 +107,49 @@ public class StAXOMBuilder extends StAXB
     }
     
     /**
-     * Constructor StAXOMBuilder.
-     *
-     * @param ombuilderFactory
-     * @param parser
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXOMBuilder(OMFactory ombuilderFactory, XMLStreamReader parser) {
         super(ombuilderFactory, parser);
     }
 
     /**
-     * Constructor linked to existing element.
-     *
-     * @param factory
-     * @param parser
-     * @param element
-     * @param characterEncoding of existing element
+     * For internal use only.
      */
     public StAXOMBuilder(OMFactory factory, 
                          XMLStreamReader parser, 
                          OMElement element, 
                          String characterEncoding) {
         // Use this constructor because the parser is passed the START_DOCUMENT state.
-        super(factory, parser, characterEncoding);  
+        super(factory, parser, characterEncoding, null, null);  
         elementLevel = 1;
         target = (OMContainerEx)element;
         populateOMElement(element);
     }
     
     /**
-     * Constructor linked to existing element.
-     *
-     * @param factory
-     * @param parser
-     * @param element
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXOMBuilder(OMFactory factory, XMLStreamReader parser, OMElement element) {
         this(factory, parser, element, null);
     }
 
     /**
-     * @param filePath - Path to the XML file
-     * @throws XMLStreamException
-     * @throws FileNotFoundException
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXOMBuilder(String filePath) throws XMLStreamException, FileNotFoundException
{
         this(StAXUtils.createXMLStreamReader(new FileInputStream(filePath)));
     }
 
     /**
-     * Constructor StAXOMBuilder.
-     *
-     * @param parser
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXOMBuilder(XMLStreamReader parser) {
         this(OMAbstractFactory.getOMFactory(), parser);
     }
 
     /**
-     * @param inStream - instream which contains the XML
-     * @throws XMLStreamException
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXOMBuilder(InputStream inStream) throws XMLStreamException {
         this(StAXUtils.createXMLStreamReader(inStream));

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/XOPAwareStAXOMBuilder.java
Thu Sep  3 19:06:52 2015
@@ -23,6 +23,7 @@ import org.apache.axiom.attachments.Atta
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.util.stax.xop.MimePartProvider;
 import org.apache.axiom.util.stax.xop.XOPDecodingStreamReader;
@@ -43,10 +44,7 @@ public class XOPAwareStAXOMBuilder
     Attachments attachments;
 
     /**
-     * Constructor StAXOMBuilder.
-     *
-     * @param ombuilderFactory
-     * @param parser
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public XOPAwareStAXOMBuilder(OMFactory ombuilderFactory,
                                  XMLStreamReader parser, Attachments attachments) {
@@ -56,11 +54,7 @@ public class XOPAwareStAXOMBuilder
     }
 
     /**
-     * Constructor linked to existing element.
-     *
-     * @param factory
-     * @param parser
-     * @param element
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public XOPAwareStAXOMBuilder(OMFactory factory, XMLStreamReader parser,
                                  OMElement element, Attachments attachments) {
@@ -70,9 +64,7 @@ public class XOPAwareStAXOMBuilder
     }
 
     /**
-     * @param filePath - Path to the XML file
-     * @throws XMLStreamException
-     * @throws FileNotFoundException
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public XOPAwareStAXOMBuilder(String filePath, Attachments attachments)
             throws XMLStreamException,
@@ -83,8 +75,7 @@ public class XOPAwareStAXOMBuilder
     }
 
     /**
-     * @param inStream - instream which contains the XML
-     * @throws XMLStreamException
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public XOPAwareStAXOMBuilder(InputStream inStream, Attachments attachments)
             throws XMLStreamException {
@@ -94,9 +85,7 @@ public class XOPAwareStAXOMBuilder
     }
 
     /**
-     * Constructor StAXXOPAwareOMBuilder.
-     *
-     * @param parser
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public XOPAwareStAXOMBuilder(XMLStreamReader parser, Attachments attachments) {
         super(new XOPDecodingStreamReader(parser, new AttachmentsMimePartProvider(

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/util/CopyUtils.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/util/CopyUtils.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/util/CopyUtils.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/util/CopyUtils.java
Thu Sep  3 19:06:52 2015
@@ -22,7 +22,8 @@ import org.apache.axiom.om.OMCloneOption
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMInformationItem;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.soap.SOAPCloneOptions;
 import org.apache.axiom.soap.SOAPEnvelope;
 
@@ -79,7 +80,7 @@ public class CopyUtils {
     public static void reader2writer(XMLStreamReader reader, 
                                      XMLStreamWriter writer)
     throws XMLStreamException {
-        StAXOMBuilder builder = new StAXOMBuilder(reader);
+        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(reader);
         try {
             OMDocument omDocument = builder.getDocument();
             Iterator it = omDocument.getChildren();

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/xpath/DocumentNavigator.java
Thu Sep  3 19:06:52 2015
@@ -28,8 +28,7 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMProcessingInstruction;
 import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.jaxen.BaseXPath;
 import org.jaxen.DefaultNavigator;
 import org.jaxen.FunctionCallException;
@@ -549,7 +548,7 @@ public class DocumentNavigator extends D
                 URL url = new URL(uri);
                 in = url.openStream();
             }
-            return new StAXOMBuilder(StAXUtils.createXMLStreamReader(in)).getDocument();
+            return OMXMLBuilderFactory.createOMBuilder(in).getDocument();
         } catch (Exception e) {
             if (in != null) {
                 try {

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/MTOMStAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/MTOMStAXSOAPModelBuilder.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/MTOMStAXSOAPModelBuilder.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/MTOMStAXSOAPModelBuilder.java
Thu Sep  3 19:06:52 2015
@@ -23,6 +23,7 @@ import java.io.Closeable;
 
 import org.apache.axiom.attachments.Attachments;
 import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.impl.builder.AttachmentsMimePartProvider;
 import org.apache.axiom.om.impl.builder.Detachable;
 import org.apache.axiom.om.impl.builder.XOPBuilder;
@@ -33,11 +34,17 @@ import org.apache.axiom.util.stax.xop.XO
 import javax.activation.DataHandler;
 import javax.xml.stream.XMLStreamReader;
 
+/**
+ * Internal implementation class.
+ */
 public class MTOMStAXSOAPModelBuilder extends StAXSOAPModelBuilder implements XOPBuilder
{
     
     /** <code>Attachments</code> handles deferred parsing of incoming MIME Messages.
*/
     private final Attachments attachments;
 
+    /**
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
+     */
     public MTOMStAXSOAPModelBuilder(XMLStreamReader parser,
                                     SOAPFactory factory, Attachments attachments,
                                     String soapVersion) {
@@ -47,8 +54,7 @@ public class MTOMStAXSOAPModelBuilder ex
     }
 
     /**
-     * @param reader
-     * @param attachments
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public MTOMStAXSOAPModelBuilder(XMLStreamReader reader,
                                     Attachments attachments, String soapVersion) {
@@ -57,6 +63,9 @@ public class MTOMStAXSOAPModelBuilder ex
         this.attachments = attachments;
     }
 
+    /**
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
+     */
     public MTOMStAXSOAPModelBuilder(XMLStreamReader reader,
                                     Attachments attachments) {
         super(new XOPDecodingStreamReader(reader, new AttachmentsMimePartProvider(

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
(original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/soap/impl/builder/StAXSOAPModelBuilder.java
Thu Sep  3 19:06:52 2015
@@ -29,6 +29,7 @@ import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.impl.builder.CustomBuilder;
 import org.apache.axiom.om.impl.builder.Detachable;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
@@ -50,24 +51,7 @@ import org.apache.commons.logging.LogFac
 import javax.xml.stream.XMLStreamReader;
 
 /**
- * StAX based builder that produces a SOAP infoset model.
- * It builds SOAP specific objects such as {@link SOAPEnvelope}, {@link SOAPHeader},
- * {@link org.apache.axiom.soap.SOAPHeaderBlock} and {@link SOAPBody}.
- * <p>
- * This builder offers two different ways to handle SOAP versions:
- * <ul>
- *   <li>Either the SOAP version is specified when the builder is constructed. If the
specified
- *       version doesn't match the envelope namespace of the actual message, an exception
is
- *       triggered. This approach should be used when the SOAP version is known from information
- *       other than the content of the message. For example, in the HTTP case it is possible
- *       to identify the SOAP version based on the <tt>Content-Type</tt> header.</li>
- *   <li>If no SOAP version is specified, the builder will automatically detect it
from the
- *       envelope namespace. It will then build the object model using the
- *       {@link SOAPFactory} implementation corresponding to that SOAP version.</li>
- * </ul>
- * In both cases, the {@link SOAPFactory} is retrieved either from the {@link OMMetaFactory}
- * specified when the builder is constructed, or if none is specified, from the default
- * meta factory returned by {@link OMAbstractFactory#getMetaFactory()}.
+ * Internal implementation class.
  */
 public class StAXSOAPModelBuilder extends StAXOMBuilder implements SOAPModelBuilder {
     /**
@@ -92,24 +76,14 @@ public class StAXSOAPModelBuilder extend
     private SOAPBuilderHelper builderHelper;
 
     /**
-     * Constructor.
-     *
-     * @param parser the parser to read the SOAP message from
-     * @param soapVersion the namespace URI corresponding to the expected SOAP version
-     *                    of the message
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXSOAPModelBuilder(XMLStreamReader parser, String soapVersion) {
         this(OMAbstractFactory.getMetaFactory(), parser, soapVersion);
     }
 
     /**
-     * Constructor.
-     *
-     * @param metaFactory the meta factory used to get the appropriate {@link SOAPFactory}
-     *                    implementation
-     * @param parser the parser to read the SOAP message from
-     * @param soapVersion the namespace URI corresponding to the expected SOAP version
-     *                    of the message
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXSOAPModelBuilder(OMMetaFactory metaFactory, XMLStreamReader parser,
             String soapVersion) {
@@ -119,9 +93,7 @@ public class StAXSOAPModelBuilder extend
     }
     
     /**
-     * Constructor.
-     * 
-     * @param parser the parser to read the SOAP message from
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXSOAPModelBuilder(XMLStreamReader parser) {
         this(OMAbstractFactory.getMetaFactory(), parser);
@@ -137,11 +109,7 @@ public class StAXSOAPModelBuilder extend
     }
     
     /**
-     * Constructor.
-     * 
-     * @param metaFactory the meta factory used to get the appropriate {@link SOAPFactory}
-     *                    implementation
-     * @param parser the parser to read the SOAP message from
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXSOAPModelBuilder(OMMetaFactory metaFactory, XMLStreamReader parser) {
         this(metaFactory, parser, null, null);
@@ -158,12 +126,7 @@ public class StAXSOAPModelBuilder extend
     }
     
     /**
-     * Constructor.
-     * 
-     * @param parser the parser to read the SOAP message from
-     * @param factory the SOAP factory to use
-     * @param soapVersion the namespace URI corresponding to the expected SOAP version
-     *                    of the message
+     * @deprecated Please use the {@link OMXMLBuilderFactory} API.
      */
     public StAXSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory, String soapVersion)
{
         this(parser, factory, soapVersion, null, null);

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=1701110&r1=1701109&r2=1701110&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 Sep  3 19:06:52 2015
@@ -17,6 +17,8 @@
  */
 package org.apache.abdera.parser.stax;
 
+import java.io.Closeable;
+
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.abdera.model.Content;
@@ -29,6 +31,7 @@ import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.impl.builder.Detachable;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 
 @SuppressWarnings("unchecked")
@@ -38,7 +41,7 @@ public class FOMBuilder extends StAXOMBu
     private final ParserOptions parserOptions;
 
     public FOMBuilder(FOMFactory factory, XMLStreamReader parser, ParserOptions parserOptions)
{
-        super(factory, new FOMStAXFilter(parser, parserOptions));
+        super(factory, new FOMStAXFilter(parser, parserOptions), (Detachable)null, (Closeable)null);
         this.parserOptions = parserOptions;
         this.fomfactory = factory;
     }

Modified: webservices/axiom/trunk/systests/integration-tests/src/test/java/org/apache/axiom/om/impl/builder/JAXBCustomBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/systests/integration-tests/src/test/java/org/apache/axiom/om/impl/builder/JAXBCustomBuilderTest.java?rev=1701110&r1=1701109&r2=1701110&view=diff
==============================================================================
--- webservices/axiom/trunk/systests/integration-tests/src/test/java/org/apache/axiom/om/impl/builder/JAXBCustomBuilderTest.java
(original)
+++ webservices/axiom/trunk/systests/integration-tests/src/test/java/org/apache/axiom/om/impl/builder/JAXBCustomBuilderTest.java
Thu Sep  3 19:06:52 2015
@@ -39,6 +39,9 @@ import org.apache.axiom.om.OMAbstractFac
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMXMLBuilderFactory;
+import org.apache.axiom.om.OMXMLParserWrapper;
+import org.apache.axiom.om.util.StAXParserConfiguration;
 import org.apache.axiom.testutils.activation.RandomDataSource;
 import org.apache.axiom.testutils.activation.TestDataSource;
 import org.apache.axiom.testutils.io.IOTestUtils;
@@ -65,9 +68,9 @@ public class JAXBCustomBuilderTest {
         return document;
     }
     
-    private void test(DataHandler dh, StAXOMBuilder builder, boolean same, boolean usesAttachments,
boolean expectBareReader) throws IOException {
+    private void test(DataHandler dh, OMXMLParserWrapper builder, boolean same, boolean usesAttachments,
boolean expectBareReader) throws IOException {
         JAXBCustomBuilder customBuilder = new JAXBCustomBuilder(jaxbContext, expectBareReader);
-        builder.registerCustomBuilderForPayload(customBuilder);
+        ((CustomBuilderSupport)builder).registerCustomBuilderForPayload(customBuilder);
         builder.getDocumentElement().build();
         MyDocument myDocument = (MyDocument)customBuilder.getJaxbObject();
         if (same) {
@@ -86,14 +89,14 @@ public class JAXBCustomBuilderTest {
         OutputStream out = blob.getOutputStream();
         createTestDocument(dh).serialize(out);
         out.close();
-        test(dh, new StAXOMBuilder(blob.getInputStream()), false, false, true);
+        test(dh, OMXMLBuilderFactory.createOMBuilder(blob.getInputStream()), false, false,
true);
     }
     
     @Test
     public void testWithDataHandlerReaderExtension() throws Exception {
         DataHandler dh = new DataHandler(new TestDataSource('X', Integer.MAX_VALUE));
         OMElement document = createTestDocument(dh);
-        test(dh, new StAXOMBuilder(document.getXMLStreamReader()), true, true, false);
+        test(dh, OMXMLBuilderFactory.createStAXOMBuilder(document.getXMLStreamReader()),
true, true, false);
     }
     
     @Test
@@ -106,6 +109,6 @@ public class JAXBCustomBuilderTest {
         createTestDocument(dh).serialize(out, format);
         out.close();
         Attachments attachments = new Attachments(blob.getInputStream(), format.getContentType());
-        test(dh, new XOPAwareStAXOMBuilder(attachments.getRootPartInputStream(), attachments),
false, true, true);
+        test(dh, OMXMLBuilderFactory.createOMBuilder(StAXParserConfiguration.DEFAULT, attachments),
false, true, true);
     }
 }



Mime
View raw message