You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/05/25 06:45:29 UTC

svn commit: r1745441 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/ axiom-api/ axiom-api/src/main/java/org/apache/axiom/om/ axiom-api/src/main/java/org/apache/axiom/om/impl/ axiom-api/src/main/java...

Author: veithen
Date: Wed May 25 06:45:29 2016
New Revision: 1745441

URL: http://svn.apache.org/viewvc?rev=1745441&view=rev
Log:
Remove the XMLStreamWriterFilter API introduced by AXIS2-4791; see the release notes for details.

Removed:
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilter.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterFilterBase.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/util/XMLStreamWriterRemoveIllegalChars.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestSerializeWithXmlStreamWriterFilter.java
Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java
    webservices/axiom/trunk/axiom-api/pom.xml
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
    webservices/axiom/trunk/src/site/markdown/release-notes/1.3.0.md
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java?rev=1745441&r1=1745440&r2=1745441&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/stream/stax/MTOMXMLStreamWriterImpl.java Wed May 25 06:45:29 2016
@@ -38,7 +38,6 @@ import org.apache.axiom.om.impl.OMMultip
 import org.apache.axiom.om.impl.stream.xop.CompletionListener;
 import org.apache.axiom.om.impl.stream.xop.XOPEncodingFilterHandler;
 import org.apache.axiom.om.util.CommonUtils;
-import org.apache.axiom.om.util.XMLStreamWriterFilter;
 import org.apache.axiom.util.io.IOUtils;
 import org.apache.axiom.util.stax.xop.ContentIDGenerator;
 import org.apache.commons.logging.Log;
@@ -53,9 +52,6 @@ public class MTOMXMLStreamWriterImpl ext
     private boolean isEndDocument = false; // has endElement been called
     private boolean isComplete = false;    // have the attachments been written
     private int depth = 0;                 // current element depth
-    
-    // Set the filter object if provided
-    private XMLStreamWriterFilter xmlStreamWriterFilter  = null;
 
     public MTOMXMLStreamWriterImpl(XMLStreamWriter xmlWriter, OMOutputFormat format) {
         this.xmlWriter = xmlWriter;
@@ -156,15 +152,6 @@ public class MTOMXMLStreamWriterImpl ext
         }
         
         xmlWriter = new XmlHandlerStreamWriter(handler, serializer);
-
-        xmlStreamWriterFilter = format.getXmlStreamWriterFilter();
-        if (xmlStreamWriterFilter != null) {
-            if (log.isDebugEnabled()) {
-                log.debug("Installing XMLStreamWriterFilter " + xmlStreamWriterFilter);
-            }
-            xmlStreamWriterFilter.setDelegate(xmlWriter);
-            xmlWriter = xmlStreamWriterFilter;
-        }
     }
 
     /**
@@ -175,12 +162,8 @@ public class MTOMXMLStreamWriterImpl ext
      *         supplied)
      */
     private XmlHandler getHandler() {
-        XMLStreamWriter writer = xmlWriter;
-        while (writer instanceof XMLStreamWriterFilter) {
-            writer = ((XMLStreamWriterFilter)writer).getDelegate();
-        }
-        if (writer instanceof XmlHandlerStreamWriter) {
-            return ((XmlHandlerStreamWriter)writer).getHandler();
+        if (xmlWriter instanceof XmlHandlerStreamWriter) {
+            return ((XmlHandlerStreamWriter)xmlWriter).getHandler();
         } else {
             return null;
         }
@@ -419,15 +402,6 @@ public class MTOMXMLStreamWriterImpl ext
     
     @Override
     public OutputStream getOutputStream() throws XMLStreamException {  
-        
-        if (xmlStreamWriterFilter != null) {
-            if (log.isDebugEnabled()) {
-                log.debug("getOutputStream returning null due to presence of XMLStreamWriterFilter " + 
-                        xmlStreamWriterFilter);
-            }
-            return null;
-        }
-        
         OutputStream outputStream;
         XmlHandler handler = getHandler();
         // Remove the XOPEncodingFilterHandler wrapper if necessary
@@ -453,33 +427,4 @@ public class MTOMXMLStreamWriterImpl ext
         }
         return outputStream;
     }
-    
-    @Override
-    public void setFilter(XMLStreamWriterFilter filter) {
-        if (filter != null) {
-            if (log.isDebugEnabled()) {
-                log.debug("setting filter " + filter.getClass());
-            }
-            xmlStreamWriterFilter = filter;
-            filter.setDelegate(xmlWriter);
-            xmlWriter = filter;
-        }
-    }
-    
-    @Override
-    public XMLStreamWriterFilter removeFilter() {
-        XMLStreamWriterFilter filter = null;
-        if (xmlStreamWriterFilter != null) {
-            filter = xmlStreamWriterFilter;
-            if (log.isDebugEnabled()) {
-                log.debug("removing filter " + filter.getClass());
-            }
-            xmlWriter = xmlStreamWriterFilter.getDelegate();
-            filter.setDelegate(null);
-            xmlStreamWriterFilter = (xmlWriter instanceof XMLStreamWriterFilter) ? 
-                        (XMLStreamWriterFilter) xmlWriter : 
-                                null;
-        }
-        return filter;
-    }
 }

Modified: webservices/axiom/trunk/axiom-api/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/pom.xml?rev=1745441&r1=1745440&r2=1745441&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/pom.xml (original)
+++ webservices/axiom/trunk/axiom-api/pom.xml Wed May 25 06:45:29 2016
@@ -317,8 +317,6 @@
                                 org.apache.axiom.om.OMMetaFactory -> org.apache.axiom.om.util.StAXParserConfiguration,
                                 org.apache.axiom.om.OMXMLBuilderFactory -> org.apache.axiom.om.util.StAXParserConfiguration,
                                 org.apache.axiom.om.OMOutputFormat -> org.apache.axiom.om.util.StAXWriterConfiguration,
-                                org.apache.axiom.om.OMOutputFormat -> org.apache.axiom.om.util.XMLStreamWriterFilter,
-                                org.apache.axiom.om.impl.MTOMXMLStreamWriter -> org.apache.axiom.om.util.XMLStreamWriterFilter,
                                 <!-- StAXUtils is in the wrong package (should be o.a.a.util.stax) -->
                                 org.apache.axiom.om.ds.AbstractPushOMDataSource -> org.apache.axiom.om.util.StAXUtils,
                                 org.apache.axiom.om.ds.BlobOMDataSource -> org.apache.axiom.om.util.StAXUtils,

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java?rev=1745441&r1=1745440&r2=1745441&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java (original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMOutputFormat.java Wed May 25 06:45:29 2016
@@ -26,14 +26,12 @@ import org.apache.axiom.mime.MultipartWr
 import org.apache.axiom.mime.impl.axiom.AxiomMultipartWriterFactory;
 import org.apache.axiom.om.impl.MTOMConstants;
 import org.apache.axiom.om.util.StAXWriterConfiguration;
-import org.apache.axiom.om.util.XMLStreamWriterFilter;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.util.UIDGenerator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-
 /**
  * Formats options for OM Output.
  * <p>
@@ -72,8 +70,6 @@ public class OMOutputFormat {
 
     public static final String ACTION_PROPERTY = "action";
     
-    private XMLStreamWriterFilter xmlStreamWriterFilter = null;
-    
     private StAXWriterConfiguration writerConfiguration;
     
     private MultipartWriterFactory multipartWriterFactory;
@@ -132,7 +128,6 @@ public class OMOutputFormat {
         }
         ignoreXMLDeclaration = format.ignoreXMLDeclaration;
         autoCloseWriter = format.autoCloseWriter;
-        xmlStreamWriterFilter = format.xmlStreamWriterFilter;
         writerConfiguration = format.writerConfiguration;
         multipartWriterFactory = format.multipartWriterFactory;
         if (format.map != null) {
@@ -460,20 +455,6 @@ public class OMOutputFormat {
     public int getOptimizedThreshold() {
         return optimizedThreshold;
     }
-    
-    /**
-     * @return the xmlStreamWriterFilter
-     */
-    public XMLStreamWriterFilter getXmlStreamWriterFilter() {
-        return xmlStreamWriterFilter;
-    }
-
-    /**
-     * @param xmlStreamWriterFilter the xmlStreamWriterFilter to set
-     */
-    public void setXmlStreamWriterFilter(XMLStreamWriterFilter xmlStreamWriterFilter) {
-        this.xmlStreamWriterFilter = xmlStreamWriterFilter;
-    }
 
     /**
      * Get the currently configured StAX writer configuration.

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java?rev=1745441&r1=1745440&r2=1745441&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java (original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java Wed May 25 06:45:29 2016
@@ -28,7 +28,6 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerWriter;
 import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.util.XMLStreamWriterFilter;
 import org.apache.axiom.util.stax.XMLStreamWriterUtils;
 
 /**
@@ -124,8 +123,4 @@ public abstract class MTOMXMLStreamWrite
      * @return the underlying byte stream, or <code>null</code> if the stream is not accessible
      */
     public abstract OutputStream getOutputStream() throws XMLStreamException;
-    
-    public abstract void setFilter(XMLStreamWriterFilter filter);
-    
-    public abstract XMLStreamWriterFilter removeFilter();
 }

Modified: webservices/axiom/trunk/src/site/markdown/release-notes/1.3.0.md
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/src/site/markdown/release-notes/1.3.0.md?rev=1745441&r1=1745440&r2=1745441&view=diff
==============================================================================
--- webservices/axiom/trunk/src/site/markdown/release-notes/1.3.0.md (original)
+++ webservices/axiom/trunk/src/site/markdown/release-notes/1.3.0.md Wed May 25 06:45:29 2016
@@ -167,4 +167,29 @@ Changes in this release
     interface describes the only supported interactions with the
     `MTOMXMLStreamWriter` API.
 
+*   The `XMLStreamWriterFilter` API and the support for it in `OMOutputFormat`
+    and `MTOMXMLStreamWriter` have been removed. There are multiple reasons for
+    this:
+
+    *   Since `MTOMXMLStreamWriter` is now an abstract class, it is possible to
+        create `MTOMXMLStreamWriter` wrappers to achieve essentially the same
+        result as installing an `XMLStreamWriterFilter` on an
+        `MTOMXMLStreamWriter`.
+
+    *   The API violated the API layering because `XMLStreamWriterFilter` was
+        part of a utility package (`org.apache.axiom.om.util`), but used in the
+        interface of a core API, namely `org.apache.axiom.om.OMOutputFormat`.
+
+    *   An `XMLStreamWriterFilter` specified using `OMOutputFormat` was applied
+        only when serializing to an `OutputStream`, but not to a `Writer` or
+        `XMLStreamWriter`.
+
+    *   The implementation had insufficient test coverage. In particular, the
+        `setFilter` and `removeFilter` methods in `MTOMXMLStreamWriter` had
+        no coverage at all.
+
+    *   Since the same `XMLStreamWriterFilter` instance can't be used
+        concurrently, the presence of a property of that type in
+        `OMOutputFormat` makes that class thread unsafe.
+
 [AXIOM-474]: https://issues.apache.org/jira/browse/AXIOM-474

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1745441&r1=1745440&r2=1745441&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java Wed May 25 06:45:29 2016
@@ -401,8 +401,6 @@ public class OMTestSuiteBuilder extends
         addTest(new org.apache.axiom.ts.om.element.TestSerializeAndConsumeConsumed(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestSerializeAndConsumePartiallyBuilt(metaFactory));
         addTest(new org.apache.axiom.ts.om.element.TestSerializeAndConsumeWithIncompleteDescendant(metaFactory));
-        addTest(new org.apache.axiom.ts.om.element.TestSerializeWithXmlStreamWriterFilter(metaFactory, (char)0));
-        addTest(new org.apache.axiom.ts.om.element.TestSerializeWithXmlStreamWriterFilter(metaFactory, (char)0x15));
         for (int i=0; i<3; i++) {
             Boolean declare = i == 0 ? null : Boolean.valueOf(i==2);
             boolean implicitDeclare = declare == null || declare.booleanValue();