You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by di...@apache.org on 2008/04/15 16:54:45 UTC

svn commit: r648271 - in /webservices/commons/trunk/modules/axiom: modules/axiom-api/src/main/java/org/apache/axiom/om/impl/ target-eclipse/

Author: dims
Date: Tue Apr 15 07:54:42 2008
New Revision: 648271

URL: http://svn.apache.org/viewvc?rev=648271&view=rev
Log:
roll back changes from jochen in 648212 to stabilize Axis2 trunk build. Jochen, can u please try a better patch for this functionality that does not break axis2?

Removed:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/DefaultMTOMAttachment.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMAttachment.java
    webservices/commons/trunk/modules/axiom/target-eclipse/
Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java?rev=648271&r1=648270&r2=648271&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MIMEOutputUtils.java Tue Apr 15 07:54:42 2008
@@ -94,24 +94,10 @@
             // text nodes int the binary node list)
             Iterator binaryNodeIterator = binaryNodeList.iterator();
             while (binaryNodeIterator.hasNext()) {
-                Object o = binaryNodeIterator.next();
-                /* Upwards compatibiliy: Should be an instance of
-                 * MTOMAttachment, if the user calls us via
-                 * {@link MTOMXMLStreamWriter#writeOptimized(OMText)},
-                 * or {@link MTOMXMLStreamWriter#writeOptimized(MTOMAttachment)}.
-                 * However, this is a public method and possibly someone
-                 * invokes us directly.
-                 */
-                final MTOMAttachment attachment;
-                if (o instanceof OMText) {
-                    final OMText omText = (OMText) o;
-                    attachment = new DefaultMTOMAttachment((DataHandler) omText.getDataHandler(), omText.getContentID());
-                } else {
-                    attachment = (MTOMAttachment) o;
-                }
-                writeBodyPart(outStream, createMimeBodyPart(attachment
-                        .getContentID(), attachment.getDataHandler()),
-                        boundary);
+                OMText binaryNode = (OMText) binaryNodeIterator.next();
+                writeBodyPart(outStream, createMimeBodyPart(binaryNode
+                        .getContentID(), (DataHandler) binaryNode
+                        .getDataHandler()), boundary);
             }
             finishWritingMime(outStream);
             outStream.flush();

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java?rev=648271&r1=648270&r2=648271&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/MTOMXMLStreamWriter.java Tue Apr 15 07:54:42 2008
@@ -273,46 +273,32 @@
         return format.getContentType();
     }
 
-    private boolean isAttachmentPossible(DataHandler pDataHandler) {
-        if (pDataHandler != null) {
+    public void writeOptimized(OMText node) {
+        if(log.isDebugEnabled()){
+            log.debug("Start MTOMXMLStreamWriter.writeOptimized()");
+        }
+        DataHandler dh = (DataHandler)node.getDataHandler();
+        int optimized = UNSUPPORTED;
+        if(dh!=null){
             if(log.isDebugEnabled()){
                 log.debug("DataHandler fetched, starting optimized Threshold processing");
             }
-            int optimized = BufferUtils.doesDataHandlerExceedLimit(pDataHandler, format.getOptimizedThreshold());
-            return optimized != UNSUPPORTED  &&  optimized != EXCEED_LIMIT;
-        }
-        return false;
-    }
-
-    public void writeOptimized(MTOMAttachment attachment) {
-        if (log.isDebugEnabled()){
-            log.debug("Start MTOMXMLStreamWriter.writeOptimized()");
-        }
-        if (isAttachmentPossible(attachment.getDataHandler())) {
-            binaryNodeList.add(attachment);    
-        } else {
-            throw new RuntimeException("Unable to inline an attachment.");
+            optimized= BufferUtils.doesDataHandlerExceedLimit(dh, format.getOptimizedThreshold());
         }
-        if (log.isDebugEnabled()){
-            log.debug("Exit MTOMXMLStreamWriter.writeOptimized()");
-        }
-    }
-
-    public void writeOptimized(OMText node) {
-        if (log.isDebugEnabled()){
-            log.debug("Start MTOMXMLStreamWriter.writeOptimized()");
+        if(optimized == UNSUPPORTED || optimized == EXCEED_LIMIT){
+            if(log.isDebugEnabled()){
+                log.debug("node added to binart NodeList for optimization");
+            }
+            binaryNodeList.add(node);    
         }
-        final DataHandler dh = (DataHandler) node.getDataHandler();
-        if (isAttachmentPossible(dh)) {
-            binaryNodeList.add(new DefaultMTOMAttachment(dh, node.getContentID()));
-        } else {
+        else{
             try{
                 writeOutput(node);
-            } catch(XMLStreamException e) {
+            }catch(XMLStreamException e){
                 throw new RuntimeException("XMLStreamException in writeOutput() call", e);
             }
         }
-        if (log.isDebugEnabled()){
+        if(log.isDebugEnabled()){
             log.debug("Exit MTOMXMLStreamWriter.writeOptimized()");
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org