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/03/05 23:22:26 UTC

svn commit: r1733772 - in /webservices/axiom/branches/stax-stream: ./ axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderUtils.java src/site/markdown/release-notes/1.3.0.md

Author: veithen
Date: Sat Mar  5 22:22:25 2016
New Revision: 1733772

URL: http://svn.apache.org/viewvc?rev=1733772&view=rev
Log:
Merge latest changes from trunk.

Modified:
    webservices/axiom/branches/stax-stream/   (props changed)
    webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java
    webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderUtils.java
    webservices/axiom/branches/stax-stream/src/site/markdown/release-notes/1.3.0.md

Propchange: webservices/axiom/branches/stax-stream/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Mar  5 22:22:25 2016
@@ -14,4 +14,4 @@
 /webservices/axiom/branches/maven-site-plugin-3.5:1731125-1732708
 /webservices/axiom/branches/namespaceURIInterning:1293148-1293587
 /webservices/axiom/branches/osgi-redesign:1180368-1180596
-/webservices/axiom/trunk:1733528-1733745
+/webservices/axiom/trunk:1733528-1733771

Modified: webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java?rev=1733772&r1=1733771&r2=1733772&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java (original)
+++ webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java Sat Mar  5 22:22:25 2016
@@ -69,27 +69,6 @@ public interface OMConstants {
     
     /**
      * @deprecated
-     * 
-     * @see org.apache.axiom.util.stax.XMLStreamReaderUtils
-     */
-    String IS_BINARY = "Axiom.IsBinary";
-    
-    /**
-     * @deprecated
-     * 
-     * @see org.apache.axiom.util.stax.XMLStreamReaderUtils
-     */
-    String DATA_HANDLER = "Axiom.DataHandler";
-    
-    /**
-     * @deprecated
-     * 
-     * @see org.apache.axiom.util.stax.XMLStreamReaderUtils
-     */
-    String IS_DATA_HANDLERS_AWARE = "IsDatahandlersAwareParsing"; 
-
-    /**
-     * @deprecated
      */
     String DEFAULT_DEFAULT_NAMESPACE = "\"\"";
     

Modified: webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderUtils.java
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderUtils.java?rev=1733772&r1=1733771&r2=1733772&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderUtils.java (original)
+++ webservices/axiom/branches/stax-stream/axiom-api/src/main/java/org/apache/axiom/util/stax/XMLStreamReaderUtils.java Sat Mar  5 22:22:25 2016
@@ -33,7 +33,6 @@ import org.apache.axiom.blob.Blobs;
 import org.apache.axiom.blob.MemoryBlob;
 import org.apache.axiom.ext.stax.CharacterDataReader;
 import org.apache.axiom.ext.stax.DelegatingXMLStreamReader;
-import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerReader;
 import org.apache.axiom.util.activation.EmptyDataSource;
 import org.apache.axiom.util.base64.Base64DecodingOutputStreamWriter;
@@ -42,75 +41,16 @@ import org.apache.commons.logging.LogFac
 
 /**
  * Contains utility methods to work with {@link XMLStreamReader} objects, including the extension
- * defined by {@link DataHandlerReader}. In addition to {@link DataHandlerReader} support, this
- * class also provides support for the legacy extension mechanism described below.
- * 
- * <h3>Legacy XMLStreamReader extensions for optimized base64 handling</h3>
- * 
- * <p>
- * {@link XMLStreamReader} instances supporting the legacy extension must conform to the following
- * requirements:
- * </p>
- * <ol>
- * <li>{@link XMLStreamReader#getProperty(String)} must return {@link Boolean#TRUE} for the
- * property identified by {@link org.apache.axiom.om.OMConstants#IS_DATA_HANDLERS_AWARE},
- * regardless of the current event. The property is assumed to be immutable and its value must not
- * change during the lifetime of the {@link XMLStreamReader} implementation.</li>
- * <li>
- * <p>
- * If the {@link XMLStreamReader} wishes to expose base64 encoded content using a
- * {@link javax.activation.DataHandler} object, it must do so using a single
- * {@link XMLStreamConstants#CHARACTERS} event.
- * </p>
- * <p>
- * To maintain compatibility with consumers that are unaware of the extensions described here, the
- * implementation should make sure that {@link XMLStreamReader#getText()},
- * {@link XMLStreamReader#getTextStart()}, {@link XMLStreamReader#getTextLength()},
- * {@link XMLStreamReader#getTextCharacters()},
- * {@link XMLStreamReader#getTextCharacters(int, char[], int, int)} and
- * {@link XMLStreamReader#getElementText()} behave as expected for this type of event, i.e. return
- * the base64 representation of the binary content.
- * </p>
- * </li>
- * <li>{@link XMLStreamReader#getProperty(String)} must return {@link Boolean#TRUE} for the
- * property identified by {@link org.apache.axiom.om.OMConstants#IS_BINARY} if the current event is
- * a {@link XMLStreamConstants#CHARACTERS} event representing base64 encoded binary content and for
- * which a {@link javax.activation.DataHandler} is available. For all other events, the returned
- * value must be {@link Boolean#FALSE}.</li>
- * <li>
- * <p>
- * If for a given event, the implementation returned {@link Boolean#TRUE} for the
- * {@link org.apache.axiom.om.OMConstants#IS_BINARY} property, then a call to
- * {@link XMLStreamReader#getProperty(String)} with argument
- * {@link org.apache.axiom.om.OMConstants#DATA_HANDLER} must return the corresponding
- * {@link javax.activation.DataHandler} object.
- * </p>
- * <p>
- * The {@link org.apache.axiom.om.OMConstants#DATA_HANDLER} property is undefined for any other type
- * of event. This implies that the consumer of the {@link XMLStreamReader} must check the
- * {@link org.apache.axiom.om.OMConstants#IS_BINARY} property before retrieving the
- * {@link org.apache.axiom.om.OMConstants#DATA_HANDLER} property.
- * </p>
- * </li>
- * </ol>
- * The extension mechanism described here has been deprecated mainly because it doesn't support
- * deferred loading of the binary content.
+ * defined by {@link DataHandlerReader}.
  */
 public class XMLStreamReaderUtils {
-    // Legacy property names; should be removed in Axiom 1.3
-    private static final String IS_BINARY = "Axiom.IsBinary";
-    private static final String DATA_HANDLER = "Axiom.DataHandler";
-    private static final String IS_DATA_HANDLERS_AWARE = "IsDatahandlersAwareParsing"; 
-    
     private static final Log log = LogFactory.getLog(XMLStreamReaderUtils.class);
     
     private XMLStreamReaderUtils() {}
     
     /**
      * Get the {@link DataHandlerReader} extension for a given {@link XMLStreamReader}, if
-     * available. If the {@link XMLStreamReader} only supports the legacy extension (as described
-     * above), then this method will return a compatibility wrapper. Note that this wrapper doesn't
-     * support deferred loading of the binary content.
+     * available.
      * 
      * @param reader
      *            the stream reader to get the {@link DataHandlerReader} extension from
@@ -120,58 +60,15 @@ public class XMLStreamReaderUtils {
      */
     public static DataHandlerReader getDataHandlerReader(final XMLStreamReader reader) {
         try {
-            DataHandlerReader dhr = (DataHandlerReader)reader.getProperty(
-                    DataHandlerReader.PROPERTY);
-            if (dhr != null) {
-                return dhr;
-            }
-        } catch (IllegalArgumentException ex) {
-            // Just continue
-        }
-        Boolean isDataHandlerAware;
-        try {
-            isDataHandlerAware = (Boolean)reader.getProperty(IS_DATA_HANDLERS_AWARE);
+            return (DataHandlerReader)reader.getProperty(DataHandlerReader.PROPERTY);
         } catch (IllegalArgumentException ex) {
             return null;
         }
-        if (isDataHandlerAware != null && isDataHandlerAware.booleanValue()) {
-            return new DataHandlerReader() {
-                public boolean isBinary() {
-                    return ((Boolean)reader.getProperty(IS_BINARY)).booleanValue();
-                }
-
-                public boolean isOptimized() {
-                    // This is compatible with the old StAXBuilder implementation
-                    return true;
-                }
-
-                public boolean isDeferred() {
-                    return false;
-                }
-
-                public String getContentID() {
-                    return null;
-                }
-
-                public DataHandler getDataHandler() {
-                    return (DataHandler)reader.getProperty(DATA_HANDLER);
-                }
-
-                public DataHandlerProvider getDataHandlerProvider() {
-                    throw new UnsupportedOperationException();
-                }
-            };
-        } else {
-            return null;
-        }
     }
     
     /**
      * Helper method to implement {@link XMLStreamReader#getProperty(String)}. This method
-     * processes the properties defined by {@link DataHandlerReader#PROPERTY} and the legacy
-     * extension mechanism (as described above). It can therefore be used to make a
-     * {@link XMLStreamReader} implementation compatible with code that expects it to implement this
-     * legacy extension.
+     * processes the property defined by {@link DataHandlerReader#PROPERTY}.
      * 
      * @param extension
      *            the reference to the {@link DataHandlerReader} extension for the
@@ -179,24 +76,14 @@ public class XMLStreamReaderUtils {
      * @param propertyName
      *            the name of the property, as passed to the
      *            {@link XMLStreamReader#getProperty(String)} method
-     * @return the property value as specified by the {@link DataHandlerReader} or legacy extension;
-     *         <code>null</code> if the property is not specified by any of these two extensions
+     * @return the property value as specified by the {@link DataHandlerReader} extension;
+     *         <code>null</code> if the property doesn't match
      */
     public static Object processGetProperty(DataHandlerReader extension, String propertyName) {
         if (extension == null || propertyName == null) {
             throw new IllegalArgumentException();
         } else if (propertyName.equals(DataHandlerReader.PROPERTY)) {
             return extension;
-        } else if (propertyName.equals(IS_DATA_HANDLERS_AWARE)) {
-            return Boolean.TRUE;
-        } else if (propertyName.equals(IS_BINARY)) {
-            return Boolean.valueOf(extension.isBinary());
-        } else if (propertyName.equals(DATA_HANDLER)) {
-            try {
-                return extension.getDataHandler();
-            } catch (XMLStreamException ex) {
-                throw new RuntimeException(ex);
-            }
         } else {
             return null;
         }

Modified: webservices/axiom/branches/stax-stream/src/site/markdown/release-notes/1.3.0.md
URL: http://svn.apache.org/viewvc/webservices/axiom/branches/stax-stream/src/site/markdown/release-notes/1.3.0.md?rev=1733772&r1=1733771&r2=1733772&view=diff
==============================================================================
--- webservices/axiom/branches/stax-stream/src/site/markdown/release-notes/1.3.0.md (original)
+++ webservices/axiom/branches/stax-stream/src/site/markdown/release-notes/1.3.0.md Sat Mar  5 22:22:25 2016
@@ -148,4 +148,8 @@ Changes in this release
 *   The `OMAttachmentAccessor` and `OMXMLStreamReader` interfaces have been
     removed because all if their usages were already deprecated in 1.2.x.
 
+*   Support for the legacy `XMLStreamReader` extension for optimized base64
+    handling has been removed. The only supported mechanism in Axiom 1.3.x is
+    defined by the `DataHandlerReader` API.
+
 [AXIOM-474]: https://issues.apache.org/jira/browse/AXIOM-474