You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by th...@apache.org on 2005/07/02 02:22:54 UTC

svn commit: r208810 - in /webservices/axis/trunk/java/modules/xml: src/org/apache/axis2/attachments/ src/org/apache/axis2/om/impl/llom/ test-resources/mtom/

Author: thilina
Date: Fri Jul  1 17:22:47 2005
New Revision: 208810

URL: http://svn.apache.org/viewcvs?rev=208810&view=rev
Log: (empty)

Modified:
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
    webservices/axis/trunk/java/modules/xml/test-resources/mtom/ImageMTOMOut.bin
    webservices/axis/trunk/java/modules/xml/test-resources/mtom/MTOMBuilderTestIn.txt

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java?rev=208810&r1=208809&r2=208810&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/MIMEHelper.java Fri Jul  1 17:22:47 2005
@@ -16,7 +16,10 @@
  */
 package org.apache.axis2.attachments;
 
-import org.apache.axis2.om.OMException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+import java.util.HashMap;
 
 import javax.activation.DataHandler;
 import javax.mail.MessagingException;
@@ -24,10 +27,8 @@
 import javax.mail.internet.ContentType;
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.ParseException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PushbackInputStream;
-import java.util.HashMap;
+
+import org.apache.axis2.om.OMException;
 
 /**
  * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
@@ -219,11 +220,10 @@
 		} else {
 			try {
 				while (true) {
-					bodyPart = this.getNextMimeBodyPart();
+					bodyPart = this.getNextPart();
 					if (bodyPart == null) {
 						return null;
 					}
-					System.out.println("blob cid : "+blobContentID);
 					if (bodyPartsMap.containsKey(blobContentID)) {
 						bodyPart = (Part) bodyPartsMap.get(blobContentID);
 						DataHandler dh = bodyPart.getDataHandler();
@@ -288,19 +288,29 @@
 		return rootMimeBodyPart;
 	}
 
-	private MimeBodyPart getNextMimeBodyPart() throws OMException {
+	private Part getNextPart() throws OMException {
 		MimeBodyPart nextMimeBodyPart;
 		nextMimeBodyPart = getMimeBodyPart();
 		if (nextMimeBodyPart != null) {
 			String partContentID;
 			try {
 				partContentID = nextMimeBodyPart.getContentID();
-				System.out.println("Mime part cid : "+partContentID);
-				bodyPartsMap.put(partContentID, nextMimeBodyPart);
-				return nextMimeBodyPart;
+				if (fileCacheEnable)
+				{
+					PartOnFile part = new PartOnFile(nextMimeBodyPart,partContentID,attachmentRepoDir);
+					return part;
+				}
+				else{
+					bodyPartsMap.put(partContentID, nextMimeBodyPart);
+					return nextMimeBodyPart;
+				}	
 			} catch (MessagingException e) {
 				throw new OMException(
 						"Error Reading Content-ID from Mime Part No "
+								+ partIndex + ". " + e);
+			} catch (Exception e) {
+				throw new OMException(
+						"Error Creating File  Storage Part"
 								+ partIndex + ". " + e);
 			}
 		} else

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java?rev=208810&r1=208809&r2=208810&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/attachments/PartOnFile.java Fri Jul  1 17:22:47 2005
@@ -1,321 +1,332 @@
-/**
- * Copyright 2001-2004 The Apache Software Foundation.
- * <p/>
- * 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
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * 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.
- * <p/>
- */
-package org.apache.axis2.attachments;
-
-import org.apache.axis2.om.OMException;
-
-import javax.activation.DataHandler;
-import javax.mail.MessagingException;
-import javax.mail.Multipart;
-import javax.mail.Part;
-import javax.mail.internet.MimeBodyPart;
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Enumeration;
-
-/**
- * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
- */
-public class PartOnFile implements Part {
-	
-	String fileName;
-	
-	Part bodyPart;
-	
-	int size;
-	
-	String contentType;
-	
-	Enumeration headers;
-	
-	String contentID;
-	
-	public PartOnFile(Part bodyPart,String contentID, String repoDir) throws Exception {
-		super();
-		size = bodyPart.getSize();
-		contentType = bodyPart.getContentType();
-		headers = bodyPart.getAllHeaders();
-		// TODO Find a better naming algorithm
-		fileName = repoDir+"/"+(new Date()).getTime() + ".tmp";
-		FileOutputStream outFileStream;
-		outFileStream = new FileOutputStream(fileName);
-		bodyPart.writeTo(outFileStream);
-		outFileStream.close();
-	}
-	
-	private Part getPartOnFile() {
-		FileInputStream inFileStream;
-		Part part=null;
-		try {
-			inFileStream = new FileInputStream(fileName);
-			
-			part = new MimeBodyPart(inFileStream);
-		} catch (FileNotFoundException e) {
-			throw new OMException("File Not Found"+e.toString());
-		} catch (MessagingException e1) {
-			throw new OMException("Cannot create MimePart from the Part read from file"+e1.toString());
-		}
-		return part;
-	}
-	
-	public String getContentID()
-	{
-		return contentID;
-	}
-	public int getSize() throws MessagingException {
-		return size;
-	}
-	
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getLineCount()
-	 */
-	public int getLineCount() throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getContentType()
-	 */
-	public String getContentType() throws MessagingException {
-		// TODO Auto-generated method stub
-		return contentType;
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#isMimeType(java.lang.String)
-	 */
-	public boolean isMimeType(String arg0) throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getDisposition()
-	 */
-	public String getDisposition() throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#setDisposition(java.lang.String)
-	 */
-	public void setDisposition(String arg0) throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getDescription()
-	 */
-	public String getDescription() throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#setDescription(java.lang.String)
-	 */
-	public void setDescription(String arg0) throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getFileName()
-	 */
-	public String getFileName() throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#setFileName(java.lang.String)
-	 */
-	public void setFileName(String arg0) throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getInputStream()
-	 */
-	public InputStream getInputStream() throws IOException, MessagingException {
-		Part part = getPartOnFile();
-		return part.getInputStream();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getDataHandler()
-	 */
-	public DataHandler getDataHandler() throws MessagingException {
-		Part part = getPartOnFile();
-		return part.getDataHandler();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getContent()
-	 */
-	public Object getContent() throws IOException, MessagingException {
-		Part part = getPartOnFile();
-		return part.getContent();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#setDataHandler(javax.activation.DataHandler)
-	 */
-	public void setDataHandler(DataHandler arg0) throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#setContent(java.lang.Object, java.lang.String)
-	 */
-	public void setContent(Object arg0, String arg1) throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#setText(java.lang.String)
-	 */
-	public void setText(String arg0) throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#setContent(javax.mail.Multipart)
-	 */
-	public void setContent(Multipart arg0) throws MessagingException {
-		throw new UnsupportedOperationException();
-		
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#writeTo(java.io.OutputStream)
-	 */
-	public void writeTo(OutputStream outStream) throws IOException,
-	MessagingException {
-		Part part = getPartOnFile();
-		part.writeTo(outStream);
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getHeader(java.lang.String)
-	 */
-	public String[] getHeader(String arg0) throws MessagingException {
-		ArrayList selectedHeader = null;
-		while (headers.hasMoreElements()) {
-			String header = (String) headers.nextElement();
-			if (arg0.equals(header)) {
-				selectedHeader.add(header);
-			}
-		}
-		String[] headerStrings = (String[]) selectedHeader.toArray();
-		return headerStrings;
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#setHeader(java.lang.String, java.lang.String)
-	 */
-	public void setHeader(String arg0, String arg1) throws MessagingException {
-		throw new UnsupportedOperationException();
-		
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#addHeader(java.lang.String, java.lang.String)
-	 */
-	public void addHeader(String arg0, String arg1) throws MessagingException {
-		throw new UnsupportedOperationException();
-		
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#removeHeader(java.lang.String)
-	 */
-	public void removeHeader(String arg0) throws MessagingException {
-		throw new UnsupportedOperationException();
-		
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getAllHeaders()
-	 */
-	public Enumeration getAllHeaders() throws MessagingException {
-		return headers;
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getMatchingHeaders(java.lang.String[])
-	 */
-	public Enumeration getMatchingHeaders(String[] arg0)
-	throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see javax.mail.Part#getNonMatchingHeaders(java.lang.String[])
-	 */
-	public Enumeration getNonMatchingHeaders(String[] arg0)
-	throws MessagingException {
-		throw new UnsupportedOperationException();
-	}
-	
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ */
+package org.apache.axis2.attachments;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Enumeration;
+
+import javax.activation.DataHandler;
+import javax.mail.BodyPart;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Part;
+import javax.mail.internet.MimeBodyPart;
+
+import org.apache.axis2.om.OMException;
+
+/**
+ * @author <a href="mailto:thilina@opensource.lk"> Thilina Gunarathne </a>
+ */
+public class PartOnFile implements Part {
+	
+	String fileName;
+	
+	Part bodyPart;
+	
+	int size;
+	
+	String contentType;
+	
+	Enumeration headers;
+	
+	String contentID;
+	
+	public PartOnFile(Part bodyPart,String contentID, String repoDir) throws Exception {
+		super();
+		size = bodyPart.getSize();
+		contentType = bodyPart.getContentType();
+		headers = bodyPart.getAllHeaders();
+		// TODO Find a better naming algorithm
+		if (repoDir==null)
+		{
+			repoDir=".";
+		}
+		fileName = repoDir+(new Date()).getTime() + ".tmp";
+		FileOutputStream outFileStream;
+		outFileStream = new FileOutputStream(fileName);
+		bodyPart.writeTo(outFileStream);
+		outFileStream.close();
+	}
+	
+	private Part getPartOnFile() {
+		FileInputStream inFileStream;
+		Part part=null;
+		try {
+			inFileStream = new FileInputStream(fileName);
+			
+			part = new MimeBodyPart(inFileStream);
+		} catch (FileNotFoundException e) {
+			throw new OMException("File Not Found"+e.toString());
+		} catch (MessagingException e1) {
+			throw new OMException("Cannot create MimePart from the Part read from file"+e1.toString());
+		}
+		return part;
+	}
+	
+	public String getContentID()
+	{
+		return contentID;
+	}
+	public int getSize() throws MessagingException {
+		return size;
+	}
+	
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getLineCount()
+	 */
+	public int getLineCount() throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getContentType()
+	 */
+	public String getContentType() throws MessagingException {
+		// TODO Auto-generated method stub
+		return contentType;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#isMimeType(java.lang.String)
+	 */
+	public boolean isMimeType(String arg0) throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getDisposition()
+	 */
+	public String getDisposition() throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#setDisposition(java.lang.String)
+	 */
+	public void setDisposition(String arg0) throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getDescription()
+	 */
+	public String getDescription() throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#setDescription(java.lang.String)
+	 */
+	public void setDescription(String arg0) throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getFileName()
+	 */
+	public String getFileName() throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#setFileName(java.lang.String)
+	 */
+	public void setFileName(String arg0) throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getInputStream()
+	 */
+	public InputStream getInputStream() throws IOException, MessagingException {
+		Part part = getPartOnFile();
+		return part.getInputStream();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getDataHandler()
+	 */
+	public DataHandler getDataHandler() throws MessagingException {
+		Part part = getPartOnFile();
+		return part.getDataHandler();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getContent()
+	 */
+	public Object getContent() throws IOException, MessagingException {
+		Part part = getPartOnFile();
+		return part.getContent();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#setDataHandler(javax.activation.DataHandler)
+	 */
+	public void setDataHandler(DataHandler arg0) throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#setContent(java.lang.Object, java.lang.String)
+	 */
+	public void setContent(Object arg0, String arg1) throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#setText(java.lang.String)
+	 */
+	public void setText(String arg0) throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#setContent(javax.mail.Multipart)
+	 */
+	public void setContent(Multipart arg0) throws MessagingException {
+		throw new UnsupportedOperationException();
+		
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#writeTo(java.io.OutputStream)
+	 */
+	public void writeTo(OutputStream outStream) throws IOException,
+	MessagingException {
+		Part part = getPartOnFile();
+		part.writeTo(outStream);
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getHeader(java.lang.String)
+	 */
+	public String[] getHeader(String arg0) throws MessagingException {
+		ArrayList selectedHeader = null;
+		while (headers.hasMoreElements()) {
+			String header = (String) headers.nextElement();
+			if (arg0.equals(header)) {
+				selectedHeader.add(header);
+			}
+		}
+		String[] headerStrings = (String[]) selectedHeader.toArray();
+		return headerStrings;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#setHeader(java.lang.String, java.lang.String)
+	 */
+	public void setHeader(String arg0, String arg1) throws MessagingException {
+		throw new UnsupportedOperationException();
+		
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#addHeader(java.lang.String, java.lang.String)
+	 */
+	public void addHeader(String arg0, String arg1) throws MessagingException {
+		throw new UnsupportedOperationException();
+		
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#removeHeader(java.lang.String)
+	 */
+	public void removeHeader(String arg0) throws MessagingException {
+		throw new UnsupportedOperationException();
+		
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getAllHeaders()
+	 */
+	public Enumeration getAllHeaders() throws MessagingException {
+		return headers;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getMatchingHeaders(java.lang.String[])
+	 */
+	public Enumeration getMatchingHeaders(String[] arg0)
+	throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see javax.mail.Part#getNonMatchingHeaders(java.lang.String[])
+	 */
+	public Enumeration getNonMatchingHeaders(String[] arg0)
+	throws MessagingException {
+		throw new UnsupportedOperationException();
+	}
+	
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java?rev=208810&r1=208809&r2=208810&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMTextImpl.java Fri Jul  1 17:22:47 2005
@@ -15,20 +15,29 @@
  */
 package org.apache.axis2.om.impl.llom;
 
-import org.apache.axis2.attachments.Base64;
-import org.apache.axis2.attachments.ByteArrayDataSource;
-import org.apache.axis2.attachments.IOUtils;
-import org.apache.axis2.om.*;
-import org.apache.axis2.om.impl.llom.mtom.MTOMStAXSOAPModelBuilder;
-
-import javax.activation.DataHandler;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Date;
 import java.util.Random;
 
+import javax.activation.DataHandler;
+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.attachments.IOUtils;
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMConstants;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMNode;
+import org.apache.axis2.om.OMOutput;
+import org.apache.axis2.om.OMText;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.mtom.MTOMStAXSOAPModelBuilder;
+
 /**
  * @author <a href="mailto:thilina@opensource.lk">Thilina Gunarathne </a>
  */
@@ -43,6 +52,8 @@
 	protected boolean optimize = false;
 
 	protected boolean isBinary = false;
+	
+	private static Random rnd = new Random(new Date().getTime());
 
 	/**
 	 * Field contentID for the mime part used when serialising Binary stuff as
@@ -238,7 +249,7 @@
 
 	/**
 	 * @return
-	 * @throws org.apache.axis2.om.OMException
+	 * @throws org.apache.axis.om.OMException
 	 * @throws OMException
 	 */
 	public DataHandler getDataHandler() {
@@ -340,8 +351,7 @@
 	{
 //		 We can use a UUID, taken using Apache commons id project.
 		// TODO change to UUID
-		this.contentID = String.valueOf(new Random(new Date().getTime())
-				.nextLong());
+		this.contentID = String.valueOf(rnd.nextLong());
 	}
 
 

Modified: webservices/axis/trunk/java/modules/xml/test-resources/mtom/ImageMTOMOut.bin
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/mtom/ImageMTOMOut.bin?rev=208810&r1=208809&r2=208810&view=diff
==============================================================================
Binary files - no diff available.

Modified: webservices/axis/trunk/java/modules/xml/test-resources/mtom/MTOMBuilderTestIn.txt
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/mtom/MTOMBuilderTestIn.txt?rev=208810&r1=208809&r2=208810&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/mtom/MTOMBuilderTestIn.txt (original)
+++ webservices/axis/trunk/java/modules/xml/test-resources/mtom/MTOMBuilderTestIn.txt Fri Jul  1 17:22:47 2005
@@ -1,16 +1,12 @@
-Content-Type: multipart/Related; type="application/xop+xml"; 
-	start="<SOAP part>"; boundary="----=_Part_0_9971081.1119397256753"
-
-------=_Part_0_9971081.1119397256753
+------=_AxIs2_Def_boundary_=42214532
 Content-Type: application/xop+xml
 Content-Transfer-Encoding: 8bit
-Content-ID: <SOAP part>
+Content-ID: <SOAPPart>
 
-<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><m:data xmlns:m="http://www.example.org/stuff"><m:name m:contentType="text/plain"><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/Include" href="cid:-4495222909959974498"></xop:Include></m:name></m:data></soap:Body></soap:Envelope>
-------=_Part_0_9971081.1119397256753
-Content-Type: application/octet-stream
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><m:data xmlns:m="http://www.example.org/stuff"><m:name m:contentType="text/plain"><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/Include" href="cid:-1609420109260943731"></xop:Include></m:name></m:data></soapenv:Body></soapenv:Envelope>
+------=_AxIs2_Def_boundary_=42214532
 Content-Transfer-Encoding: binary
-Content-ID: <-4495222909959974498>
+Content-ID: <-1609420109260943731>
 
 
8A ýþÿb
-------=_Part_0_9971081.1119397256753--
+------=_AxIs2_Def_boundary_=42214532--
\ No newline at end of file