Author: veithen
Date: Sun Oct 24 16:33:13 2010
New Revision: 1026835

URL: http://svn.apache.org/viewvc?rev=1026835&view=rev
Log:
Eliminated a package cycle in axiom-api, so that we now again have a perfect 
API layering: ext - util - mime - om+soap+attachments - osgi.

Added:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/activation/DataHandlerReaderUtils.java
      - copied, changed from r1026815, 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java
Modified:
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
    
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPUtils.java

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java?rev=1026835&r1=1026834&r2=1026835&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/OMConstants.java
 Sun Oct 24 16:33:13 2010
@@ -61,21 +61,21 @@ public interface OMConstants {
     /**
      * @deprecated
      * 
-     * @see org.apache.axiom.om.impl.builder.DataHandlerReaderUtils
+     * @see org.apache.axiom.util.activation.DataHandlerReaderUtils
      */
     String IS_BINARY = "Axiom.IsBinary";
     
     /**
      * @deprecated
      * 
-     * @see org.apache.axiom.om.impl.builder.DataHandlerReaderUtils
+     * @see org.apache.axiom.util.activation.DataHandlerReaderUtils
      */
     String DATA_HANDLER = "Axiom.DataHandler";
     
     /**
      * @deprecated
      * 
-     * @see org.apache.axiom.om.impl.builder.DataHandlerReaderUtils
+     * @see org.apache.axiom.util.activation.DataHandlerReaderUtils
      */
     String IS_DATA_HANDLERS_AWARE = "IsDatahandlersAwareParsing"; 
 

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java?rev=1026835&r1=1026834&r2=1026835&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/SwitchingWrapper.java
 Sun Oct 24 16:33:13 2010
@@ -52,9 +52,9 @@ import org.apache.axiom.om.OMSourcedElem
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.om.impl.OMNavigator;
-import org.apache.axiom.om.impl.builder.DataHandlerReaderUtils;
 import org.apache.axiom.om.impl.builder.StAXBuilder;
 import org.apache.axiom.om.impl.exception.OMStreamingException;
+import org.apache.axiom.util.activation.DataHandlerReaderUtils;
 import org.apache.axiom.util.namespace.MapBasedNamespaceContext;
 import org.apache.axiom.util.stax.AbstractXMLStreamReader;
 import org.apache.axiom.util.stax.DummyLocation;

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java?rev=1026835&r1=1026834&r2=1026835&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java
 Sun Oct 24 16:33:13 2010
@@ -19,168 +19,21 @@
 
 package org.apache.axiom.om.impl.builder;
 
-import javax.activation.DataHandler;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerReader;
-import org.apache.axiom.om.OMConstants;
-import org.apache.axiom.om.OMException;
 
 /**
- * Utility class to work with the {...@link XMLStreamReader} 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.
+ * @deprecated Use {...@link 
org.apache.axiom.util.activation.DataHandlerReaderUtils} instead.
  */
 public class DataHandlerReaderUtils {
     private DataHandlerReaderUtils() {}
     
-    /**
-     * 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.
-     * 
-     * @param reader
-     *            the stream reader to get the {...@link DataHandlerReader} 
extension from
-     * @return the implementation of the extension, or <code>null</code> if the
-     *         {...@link XMLStreamReader} doesn't expose base64 encoded binary 
content as
-     *         {...@link DataHandler} objects.
-     */
     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(OMConstants.IS_DATA_HANDLERS_AWARE);
-        } catch (IllegalArgumentException ex) {
-            return null;
-        }
-        if (isDataHandlerAware != null && isDataHandlerAware.booleanValue()) {
-            return new DataHandlerReader() {
-                public boolean isBinary() {
-                    return 
((Boolean)reader.getProperty(OMConstants.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(OMConstants.DATA_HANDLER);
-                }
-
-                public DataHandlerProvider getDataHandlerProvider() {
-                    throw new UnsupportedOperationException();
-                }
-            };
-        } else {
-            return null;
-        }
+        return 
org.apache.axiom.util.activation.DataHandlerReaderUtils.getDataHandlerReader(reader);
     }
     
-    /**
-     * Helper method to implement {...@link 
XMLStreamReader#getProperty(String)}. This method
-     * processed 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.
-     * 
-     * @param extension
-     *            the reference to the {...@link DataHandlerReader} extension 
for the
-     *            {...@link XMLStreamReader} implementation
-     * @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
-     */
     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(OMConstants.IS_DATA_HANDLERS_AWARE)) {
-            return Boolean.TRUE;
-        } else if (propertyName.equals(OMConstants.IS_BINARY)) {
-            return Boolean.valueOf(extension.isBinary());
-        } else if (propertyName.equals(OMConstants.DATA_HANDLER)) {
-            try {
-                return extension.getDataHandler();
-            } catch (XMLStreamException ex) {
-                throw new OMException(ex);
-            }
-        } else {
-            return null;
-        }
+        return 
org.apache.axiom.util.activation.DataHandlerReaderUtils.processGetProperty(extension,
 propertyName);
     }
 }

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java?rev=1026835&r1=1026834&r2=1026835&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXBuilder.java
 Sun Oct 24 16:33:13 2010
@@ -36,6 +36,7 @@ import org.apache.axiom.om.impl.OMContai
 import org.apache.axiom.om.impl.OMNodeEx;
 import org.apache.axiom.om.impl.util.OMSerializerUtil;
 import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.util.activation.DataHandlerReaderUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java?rev=1026835&r1=1026834&r2=1026835&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/StAXOMBuilder.java
 Sun Oct 24 16:33:13 2010
@@ -51,7 +51,7 @@ import java.io.InputStream;
  * <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 DataHandlerReaderUtils}.
+ * defined in the documentation of {...@link 
org.apache.axiom.util.activation.DataHandlerReaderUtils}.
  * <h3>Error handling</h3>
  * Usually, code that uses StAX directly just stops processing of an XML 
document
  * once the first parsing error has been reported. However, since Axiom

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java?rev=1026835&r1=1026834&r2=1026835&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/StreamingOMSerializer.java
 Sun Oct 24 16:33:13 2010
@@ -24,8 +24,8 @@ import org.apache.axiom.ext.stax.datahan
 import org.apache.axiom.om.OMDataSource;
 import org.apache.axiom.om.OMSerializer;
 import org.apache.axiom.om.impl.OMStAXWrapper;
-import org.apache.axiom.om.impl.builder.DataHandlerReaderUtils;
 import org.apache.axiom.om.impl.util.OMSerializerUtil;
+import org.apache.axiom.util.activation.DataHandlerReaderUtils;
 import org.apache.axiom.util.stax.XMLStreamWriterUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;

Copied: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/activation/DataHandlerReaderUtils.java
 (from r1026815, 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java)
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/activation/DataHandlerReaderUtils.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/activation/DataHandlerReaderUtils.java&p1=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java&r1=1026815&r2=1026835&rev=1026835&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/builder/DataHandlerReaderUtils.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/activation/DataHandlerReaderUtils.java
 Sun Oct 24 16:33:13 2010
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.axiom.om.impl.builder;
+package org.apache.axiom.util.activation;
 
 import javax.activation.DataHandler;
 import javax.xml.stream.XMLStreamConstants;
@@ -26,8 +26,6 @@ import javax.xml.stream.XMLStreamReader;
 
 import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider;
 import org.apache.axiom.ext.stax.datahandler.DataHandlerReader;
-import org.apache.axiom.om.OMConstants;
-import org.apache.axiom.om.OMException;
 
 /**
  * Utility class to work with the {...@link XMLStreamReader} extension defined 
by
@@ -86,6 +84,11 @@ import org.apache.axiom.om.OMException;
  * deferred loading of the binary content.
  */
 public class DataHandlerReaderUtils {
+    // 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 DataHandlerReaderUtils() {}
     
     /**
@@ -112,14 +115,14 @@ public class DataHandlerReaderUtils {
         }
         Boolean isDataHandlerAware;
         try {
-            isDataHandlerAware = 
(Boolean)reader.getProperty(OMConstants.IS_DATA_HANDLERS_AWARE);
+            isDataHandlerAware = 
(Boolean)reader.getProperty(IS_DATA_HANDLERS_AWARE);
         } catch (IllegalArgumentException ex) {
             return null;
         }
         if (isDataHandlerAware != null && isDataHandlerAware.booleanValue()) {
             return new DataHandlerReader() {
                 public boolean isBinary() {
-                    return 
((Boolean)reader.getProperty(OMConstants.IS_BINARY)).booleanValue();
+                    return 
((Boolean)reader.getProperty(IS_BINARY)).booleanValue();
                 }
 
                 public boolean isOptimized() {
@@ -136,7 +139,7 @@ public class DataHandlerReaderUtils {
                 }
 
                 public DataHandler getDataHandler() {
-                    return 
(DataHandler)reader.getProperty(OMConstants.DATA_HANDLER);
+                    return (DataHandler)reader.getProperty(DATA_HANDLER);
                 }
 
                 public DataHandlerProvider getDataHandlerProvider() {
@@ -169,15 +172,15 @@ public class DataHandlerReaderUtils {
             throw new IllegalArgumentException();
         } else if (propertyName.equals(DataHandlerReader.PROPERTY)) {
             return extension;
-        } else if (propertyName.equals(OMConstants.IS_DATA_HANDLERS_AWARE)) {
+        } else if (propertyName.equals(IS_DATA_HANDLERS_AWARE)) {
             return Boolean.TRUE;
-        } else if (propertyName.equals(OMConstants.IS_BINARY)) {
+        } else if (propertyName.equals(IS_BINARY)) {
             return Boolean.valueOf(extension.isBinary());
-        } else if (propertyName.equals(OMConstants.DATA_HANDLER)) {
+        } else if (propertyName.equals(DATA_HANDLER)) {
             try {
                 return extension.getDataHandler();
             } catch (XMLStreamException ex) {
-                throw new OMException(ex);
+                throw new RuntimeException(ex);
             }
         } else {
             return null;

Modified: 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPUtils.java
URL: 
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPUtils.java?rev=1026835&r1=1026834&r2=1026835&view=diff
==============================================================================
--- 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPUtils.java
 (original)
+++ 
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/xop/XOPUtils.java
 Sun Oct 24 16:33:13 2010
@@ -26,7 +26,7 @@ import java.net.URLDecoder;
 import javax.activation.DataHandler;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.axiom.om.impl.builder.DataHandlerReaderUtils;
+import org.apache.axiom.util.activation.DataHandlerReaderUtils;
 
 /**
  * Contains utility methods related to XOP.


Reply via email to