axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eran Chinthaka <chinth...@opensource.lk>
Subject Re:[Axis2] svn commit: r291167 - in /webservices/axis2/trunk/java/modules: integration/test/org/apache/axis2/mtom/ saaj/src/org/apache/axis2/saaj/ samples/src/sample/mtom/imagetransfer/service/ xml/src/org/apache/axis2/attachments/ xml/src/org/apache/axis2/om/ xm...
Date Fri, 23 Sep 2005 17:04:17 GMT
Thilina,

Can you resolve Axis2-126 also with this commit.

Thanks,
Chinthaka

thilina@apache.org wrote:

>Author: thilina
>Date: Fri Sep 23 09:30:06 2005
>New Revision: 291167
>
>URL: http://svn.apache.org/viewcvs?rev=291167&view=rev
>Log:
>Making the AXIOM work without Java Mail & Activation
>Changed the method signatures which contained DataHandler to Objects.. 
>Related to Axis2-126
>
>Added:
>    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/DataHandlerUtils.java
>Modified:
>    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
>    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
>    webservices/axis2/trunk/java/modules/samples/src/sample/mtom/imagetransfer/service/MTOMService.java
>    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java
>    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java
>    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java
>    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
>    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
>    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
>    webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java
>    webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilderTest.java
>
>Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
(original)
>+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/mtom/EchoRawMTOMTest.java
Fri Sep 23 09:30:06 2005
>@@ -176,7 +176,7 @@
>         
>         // Save the image
>         DataHandler actualDH;
>-        actualDH = binaryNode.getDataHandler();
>+        actualDH = (DataHandler)binaryNode.getDataHandler();
>         Image actualObject = new ImageIO().loadImage(actualDH.getDataSource()
>                 .getInputStream());
> //        FileOutputStream imageOutStream = new FileOutputStream("target/testout.jpg");
>
>Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
(original)
>+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java
Fri Sep 23 09:30:06 2005
>@@ -128,7 +128,7 @@
>     		OMNode child = (OMNode)childIter.next();
>     		if(child instanceof OMText){
>     			OMText binaryNode = (OMText)child;
>-    			DataHandler actualDH = binaryNode.getDataHandler();
>+    			DataHandler actualDH = (DataHandler)binaryNode.getDataHandler();
>     			if(actualDH != null){
>     				AttachmentPart ap = soapMsg.createAttachmentPart(actualDH);
>     				String contentId = SessionUtils.generateSessionId();
>
>Modified: webservices/axis2/trunk/java/modules/samples/src/sample/mtom/imagetransfer/service/MTOMService.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/samples/src/sample/mtom/imagetransfer/service/MTOMService.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/samples/src/sample/mtom/imagetransfer/service/MTOMService.java
(original)
>+++ webservices/axis2/trunk/java/modules/samples/src/sample/mtom/imagetransfer/service/MTOMService.java
Fri Sep 23 09:30:06 2005
>@@ -36,7 +36,7 @@
>         String fileName = imageName.getText();
>         //Extracting the data and saving
>         DataHandler actualDH;
>-        actualDH = binaryNode.getDataHandler();
>+        actualDH = (DataHandler)binaryNode.getDataHandler();
>         Image actualObject = new ImageIO().loadImage(actualDH.getDataSource()
>                 .getInputStream());
>         FileOutputStream imageOutStream = new FileOutputStream(fileName);
>
>Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java
(original)
>+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/ByteArrayDataSource.java
Fri Sep 23 09:30:06 2005
>@@ -16,13 +16,12 @@
> 
> package org.apache.axis2.attachments;
> 
>-import javax.activation.DataSource;
> import java.io.ByteArrayInputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.io.OutputStream;
> 
>-public class ByteArrayDataSource implements DataSource {
>+public class ByteArrayDataSource implements javax.activation.DataSource {
> 
>     private byte[] data;
> 
>
>Added: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/DataHandlerUtils.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/DataHandlerUtils.java?rev=291167&view=auto
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/DataHandlerUtils.java
(added)
>+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/attachments/DataHandlerUtils.java
Fri Sep 23 09:30:06 2005
>@@ -0,0 +1,33 @@
>+/*
>+ * Copyright  2004 The Apache Software Foundation.
>+ *
>+ *  Licensed 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.axis2.attachments;
>+
>+public class DataHandlerUtils {
>+
>+  public static Object getDataHandlerFromText(String value, String mimeType)
>+  {
>+      org.apache.axis2.attachments.ByteArrayDataSource dataSource;
>+      byte[] data = Base64.decode(value);
>+      if (mimeType != null) {
>+          dataSource = new org.apache.axis2.attachments.ByteArrayDataSource(data, mimeType);
>+      } else {
>+          // Assumes type as application/octet-stream
>+          dataSource = new org.apache.axis2.attachments.ByteArrayDataSource(data);
>+      }
>+      return new javax.activation.DataHandler(dataSource);
>+  }
>+}
>
>Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java (original)
>+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMFactory.java Fri
Sep 23 09:30:06 2005
>@@ -16,7 +16,6 @@
> 
> package org.apache.axis2.om;
> 
>-import javax.activation.DataHandler;
> import javax.xml.namespace.QName;
> 
> /**
>@@ -108,7 +107,7 @@
> 
>     public OMText createText(String s, String mimeType, boolean optimize);
> 
>-    public OMText createText(DataHandler dataHandler, boolean optimize);
>+    public OMText createText(Object dataHandler, boolean optimize);
> 
>     public OMText createText(OMElement parent, String s, String mimeType,
>                              boolean optimize);
>
>Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java (original)
>+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/OMText.java Fri Sep
23 09:30:06 2005
>@@ -16,7 +16,6 @@
> 
> package org.apache.axis2.om;
> 
>-import javax.activation.DataHandler;
> 
> /**
>  * Interface OMText
>@@ -33,7 +32,7 @@
>      * get the datahandler
>      * @return datahandler
>      */
>-    DataHandler getDataHandler();
>+    Object getDataHandler();
> 
>     /**
>      * @return boolean flag saying whether the node contains
>
>Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
(original)
>+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/MIMEOutputUtils.java
Fri Sep 23 09:30:06 2005
>@@ -21,7 +21,6 @@
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> 
>-import javax.activation.DataHandler;
> import javax.mail.MessagingException;
> import javax.mail.internet.MimeBodyPart;
> import java.io.IOException;
>@@ -40,7 +39,7 @@
>         try {
>             startWritingMime(outStream, boundary);
> 
>-            DataHandler dh = new DataHandler(bufferedSoapOutStream.toString(),
>+            javax.activation.DataHandler dh = new javax.activation.DataHandler(bufferedSoapOutStream.toString(),
>                     "text/xml");
>             MimeBodyPart rootMimeBodyPart = new MimeBodyPart();
>             rootMimeBodyPart.setDataHandler(dh);
>@@ -70,7 +69,7 @@
>     public static MimeBodyPart createMimeBodyPart(OMText node)
>             throws MessagingException {
>         MimeBodyPart mimeBodyPart = new MimeBodyPart();
>-        mimeBodyPart.setDataHandler(node.getDataHandler());
>+        mimeBodyPart.setDataHandler((javax.activation.DataHandler)node.getDataHandler());
>         mimeBodyPart.addHeader("content-id", "<"+node.getContentID()+">");
>         mimeBodyPart.addHeader("content-type", "application/octet-stream");
>         mimeBodyPart.addHeader("content-transfer-encoding", "binary");
>@@ -136,5 +135,4 @@
>         sb.append("start-info=\""+SOAPContentType+"\"");
>         return sb.toString();
>     }
>-
> }
>
>Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
(original)
>+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
Fri Sep 23 09:30:06 2005
>@@ -16,8 +16,15 @@
> 
> package org.apache.axis2.om.impl.llom;
> 
>+
>+import java.io.IOException;
>+import java.io.InputStream;
>+
>+import javax.xml.stream.XMLStreamException;
>+import javax.xml.stream.XMLStreamWriter;
>+
>+
> import org.apache.axis2.attachments.Base64;
>-import org.apache.axis2.attachments.ByteArrayDataSource;
> import org.apache.axis2.om.OMAttribute;
> import org.apache.axis2.om.OMConstants;
> import org.apache.axis2.om.OMElement;
>@@ -29,12 +36,6 @@
> import org.apache.axis2.om.impl.llom.mtom.MTOMStAXSOAPModelBuilder;
> import org.apache.axis2.util.UUIDGenerator;
> 
>-import javax.activation.DataHandler;
>-import javax.xml.stream.XMLStreamException;
>-import javax.xml.stream.XMLStreamWriter;
>-import java.io.IOException;
>-import java.io.InputStream;
>-
> public class OMTextImpl extends OMNodeImpl implements OMText, OMConstants {
>     protected String value = null;
> 
>@@ -51,9 +52,11 @@
>     private String contentID = null;
> 
>     /**
>-     * Field dataHandler
>+     * Field dataHandler contains the DataHandler
>+     * Declaring as Object to remove the depedency on 
>+     * Javax.activation.DataHandler
>      */
>-    private DataHandler dataHandler = null;
>+    private Object dataHandlerObject = null;
> 
>     /**
>      * Field nameSpace used when serialising Binary stuff as MTOM optimised
>@@ -124,6 +127,7 @@
>         this(parent, s);
>         this.mimeType = mimeType;
>         this.optimize = optimize;
>+        this.isBinary = true;
>         done = true;
>         this.nodeType = TEXT_NODE;
>     }
>@@ -131,7 +135,7 @@
>     /**
>      * @param dataHandler To send binary optimised content Created programatically.
>      */
>-    public OMTextImpl(DataHandler dataHandler) {
>+    public OMTextImpl(Object dataHandler) {
>         this(dataHandler, true);
>     }
> 
>@@ -139,8 +143,8 @@
>      * @param dataHandler
>      * @param optimize    To send binary content. Created progrmatically.
>      */
>-    public OMTextImpl(DataHandler dataHandler, boolean optimize) {
>-        this.dataHandler = dataHandler;
>+    public OMTextImpl(Object dataHandler, boolean optimize) {
>+        this.dataHandlerObject = dataHandler;
>         this.isBinary = true;
>         this.optimize = optimize;
>         done = true;
>@@ -235,37 +239,28 @@
> 	}
>     }
> 
>+    
>     /**
>-     * @return
>-     * @throws org.apache.axis2.om.OMException
>-     *
>-     * @throws OMException
>+     * To get the datahandler
>+     * @return javax.activation.DataHandler
>      */
>-    public DataHandler getDataHandler() {
>+    public Object getDataHandler() {
>         /*
>          * this should return a DataHandler containing the binary data
>          * reperesented by the Base64 strings stored in OMText
>          */
>-        if (value != null) {
>-            ByteArrayDataSource dataSource;
>-            byte[] data = Base64.decode(value);
>-            if (mimeType != null) {
>-                dataSource = new ByteArrayDataSource(data, mimeType);
>-            } else {
>-                // Assumes type as application/octet-stream
>-                dataSource = new ByteArrayDataSource(data);
>-            }
>-            return new DataHandler(dataSource);
>+        if (value != null & isBinary) {
>+            return org.apache.axis2.attachments.DataHandlerUtils.getDataHandlerFromText(value,mimeType);
>         } else {
> 
>-            if (dataHandler == null) {
>+            if (dataHandlerObject == null) {
>                 if (contentID == null) {
>                     throw new RuntimeException("ContentID is null");
>                 }
>-                dataHandler = ((MTOMStAXSOAPModelBuilder) builder)
>+                dataHandlerObject = ((MTOMStAXSOAPModelBuilder) builder)
>                         .getDataHandler(contentID);
>             }
>-            return dataHandler;
>+            return dataHandlerObject;
>         }
>     }
> 
>@@ -275,10 +270,11 @@
> 
>     public java.io.InputStream getInputStream() throws OMException {
>         if (isBinary) {
>-            if (dataHandler == null) {
>+            if (dataHandlerObject == null) {
>                 getDataHandler();
>             }
>             InputStream inStream;
>+            javax.activation.DataHandler dataHandler = (javax.activation.DataHandler)dataHandlerObject;
>             try {
>                 inStream = dataHandler.getDataSource().getInputStream();
>             } catch (IOException e) {
>
>Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
(original)
>+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/factory/OMLinkedListImplFactory.java
Fri Sep 23 09:30:06 2005
>@@ -37,7 +37,6 @@
> import org.apache.axis2.om.impl.llom.OMProcessingInstructionImpl;
> import org.apache.axis2.om.impl.llom.OMTextImpl;
> 
>-import javax.activation.DataHandler;
> import javax.xml.namespace.QName;
> 
> /**
>@@ -161,7 +160,7 @@
>      * @param optimize
>      * @return text
>      */
>-    public OMText createText(DataHandler dataHandler, boolean optimize) {
>+    public OMText createText(Object dataHandler, boolean optimize) {
>         return new OMTextImpl(dataHandler, optimize);
>     }
> 
>
>Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java
(original)
>+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/attachments/ImageSampleTest.java
Fri Sep 23 09:30:06 2005
>@@ -132,7 +132,7 @@
>          */
> 
>         DataHandler actualDH;
>-        actualDH = blob.getDataHandler();
>+        actualDH = (DataHandler)blob.getDataHandler();
>         Image actualObject = new ImageIO().loadImage(actualDH.getDataSource()
>                 .getInputStream());
>         FileOutputStream imageOutStream = new FileOutputStream(
>
>Modified: webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilderTest.java
>URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilderTest.java?rev=291167&r1=291166&r2=291167&view=diff
>==============================================================================
>--- webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilderTest.java
(original)
>+++ webservices/axis2/trunk/java/modules/xml/test/org/apache/axis2/om/impl/llom/mtom/MTOMStAXSOAPModelBuilderTest.java
Fri Sep 23 09:30:06 2005
>@@ -83,7 +83,7 @@
>         byte[] expectedObject = new byte[]{13, 56, 65, 32, 12, 12, 7, -3, -2,
>                                            -1, 98};
>         DataHandler actualDH;
>-        actualDH = blob.getDataHandler();
>+        actualDH = (DataHandler)blob.getDataHandler();
>         //ByteArrayInputStream object = (ByteArrayInputStream) actualDH
>         //.getContent();
>         //byte[] actualObject= null;
>
>
>
>
>  
>


Mime
View raw message