Author: veithen
Date: Thu Nov  8 21:30:30 2012
New Revision: 1407272

URL: http://svn.apache.org/viewvc?rev=1407272&view=rev
Log:
Removed the org.apache.axis.components.image stuff and just use the Java 1.4 
ImageIO API.

Removed:
    
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/components/image/
Modified:
    
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/AttachmentPart.java
    
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/ImageDataSource.java
    
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/encoding/ser/ImageDataHandlerDeserializer.java
    
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/utils/JavaUtils.java
    
axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource.properties
    
axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource_ja.properties

Modified: 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/AttachmentPart.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/AttachmentPart.java?rev=1407272&r1=1407271&r2=1407272&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/AttachmentPart.java
 (original)
+++ 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/AttachmentPart.java
 Thu Nov  8 21:30:30 2012
@@ -17,7 +17,6 @@ package org.apache.axis.attachments;
 
 import org.apache.axis.Part;
 import org.apache.axis.components.logger.LogFactory;
-import org.apache.axis.components.image.ImageIOFactory;
 import org.apache.axis.transport.http.HTTPConstants;
 import org.apache.axis.utils.Messages;
 import org.apache.axis.utils.SessionUtils;
@@ -25,6 +24,7 @@ import org.apache.axis.utils.IOUtils;
 import org.apache.commons.logging.Log;
 
 import javax.activation.DataHandler;
+import javax.imageio.ImageIO;
 import javax.xml.soap.SOAPException;
 import javax.xml.transform.stream.StreamSource;
 import java.util.Iterator;
@@ -343,7 +343,7 @@ public class AttachmentPart extends java
         } else if (ds.getContentType().equals("image/gif") ||
                    ds.getContentType().equals("image/jpeg")) {
             try {
-                return ImageIOFactory.getImageIO().loadImage(is);
+                return ImageIO.read(is);
             } catch (Exception ex) {
                 log.error(Messages.getMessage("javaIOException00"), ex);
                 throw new SOAPException(ex);

Modified: 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/ImageDataSource.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/ImageDataSource.java?rev=1407272&r1=1407271&r2=1407272&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/ImageDataSource.java
 (original)
+++ 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/attachments/ImageDataSource.java
 Thu Nov  8 21:30:30 2012
@@ -15,18 +15,23 @@
  */
 package org.apache.axis.attachments;
 
-import org.apache.axis.components.image.ImageIOFactory;
 import org.apache.axis.components.logger.LogFactory;
 import org.apache.axis.utils.Messages;
 import org.apache.commons.logging.Log;
 
 import javax.activation.DataSource;
+import javax.imageio.IIOImage;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageWriter;
+
 import java.awt.*;
+import java.awt.image.BufferedImage;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Iterator;
 
 public class ImageDataSource implements DataSource {
     protected static Log log =
@@ -49,7 +54,25 @@ public class ImageDataSource implements 
         os = new ByteArrayOutputStream();
         try {
             if (data != null) {
-                ImageIOFactory.getImageIO().saveImage(this.contentType, data, 
os);
+                ImageWriter writer = null;
+                Iterator iter = ImageIO.getImageWritersByMIMEType(contentType);
+                if (iter.hasNext()) {
+                    writer = (ImageWriter) iter.next();
+                }
+                writer.setOutput(ImageIO.createImageOutputStream(os));
+                BufferedImage rendImage = null;
+                if (data instanceof BufferedImage) {
+                    rendImage = (BufferedImage) data;
+                } else {
+                    MediaTracker tracker = new MediaTracker(new Component() 
{});
+                    tracker.addImage(data, 0);
+                    tracker.waitForAll();
+                    rendImage = new BufferedImage(data.getWidth(null), 
data.getHeight(null), 1);
+                    Graphics g = rendImage.createGraphics();
+                    g.drawImage(data, 0, 0, null);
+                }
+                writer.write(new IIOImage(rendImage, null, null));
+                writer.dispose();
             }
         }
         catch (Exception e) {

Modified: 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/encoding/ser/ImageDataHandlerDeserializer.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/encoding/ser/ImageDataHandlerDeserializer.java?rev=1407272&r1=1407271&r2=1407272&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/encoding/ser/ImageDataHandlerDeserializer.java
 (original)
+++ 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/encoding/ser/ImageDataHandlerDeserializer.java
 Thu Nov  8 21:30:30 2012
@@ -16,7 +16,6 @@
 
 package org.apache.axis.encoding.ser;
 
-import org.apache.axis.components.image.ImageIOFactory;
 import org.apache.axis.components.logger.LogFactory;
 import org.apache.axis.encoding.DeserializationContext;
 import org.apache.commons.logging.Log;
@@ -24,6 +23,8 @@ import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
 import javax.activation.DataHandler;
+import javax.imageio.ImageIO;
+
 import java.awt.*;
 import java.io.InputStream;
 
@@ -47,7 +48,7 @@ public class ImageDataHandlerDeserialize
                 DataHandler dh = (DataHandler) getValue();
 
                 InputStream is = dh.getInputStream();
-                Image image = ImageIOFactory.getImageIO().loadImage(is);
+                Image image = ImageIO.read(is);
                 setValue(image);
             }
             catch (Exception e) {

Modified: 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/utils/JavaUtils.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/utils/JavaUtils.java?rev=1407272&r1=1407271&r2=1407272&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/utils/JavaUtils.java
 (original)
+++ 
axis/axis1/java/trunk/axis-rt-core/src/main/java/org/apache/axis/utils/JavaUtils.java
 Thu Nov  8 21:30:30 2012
@@ -18,13 +18,12 @@ package org.apache.axis.utils;
 
 import org.apache.axis.attachments.AttachmentPart;
 import org.apache.axis.attachments.OctetStream;
-import org.apache.axis.components.image.ImageIO;
-import org.apache.axis.components.image.ImageIOFactory;
 import org.apache.axis.components.logger.LogFactory;
 import org.apache.axis.types.HexBinary;
 import org.apache.commons.logging.Log;
 
 import javax.activation.DataHandler;
+import javax.imageio.ImageIO;
 import javax.xml.soap.SOAPException;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
@@ -321,14 +320,7 @@ public class JavaUtils
                             return null;
                         }
                         else {
-                            ImageIO imageIO = ImageIOFactory.getImageIO();
-                            if (imageIO != null) {
-                                return getImageFromStream(is);
-                            }
-                            else {
-                                log.info(Messages.getMessage("needImageIO"));
-                                return arg;
-                            }
+                            return ImageIO.read(is);
                         }
                     }
                     else if (destClass == javax.xml.transform.Source.class) {
@@ -677,9 +669,12 @@ public class JavaUtils
         return false;
     }
 
+    /**
+     * @deprecated Use {@link ImageIO#read(InputStream)} instead.
+     */
     public static Image getImageFromStream(InputStream is) {
         try {
-            return ImageIOFactory.getImageIO().loadImage(is);
+            return ImageIO.read(is);
         }
         catch (Throwable t) {
             return null;

Modified: 
axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource.properties
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource.properties?rev=1407272&r1=1407271&r2=1407272&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource.properties
 (original)
+++ 
axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource.properties
 Thu Nov  8 21:30:30 2012
@@ -878,9 +878,6 @@ badTimeDuration=Invalid time string does
 
 needSimpleValueSer=Serializer class {0} does not implement 
SimpleValueSerializer, which is necessary for attributes.
 
-# NOTE:  in needImageIO, do not translate "JIMI", "java.awt.Image", 
"http://java.sun.com/products/jimi/";
-needImageIO=JIMI is necessary to use java.awt.Image attachments 
(http://java.sun.com/products/jimi/).
-
 wsddServiceName00=The WSDD service name defaults to the port name.
 
 badSource=javax.xml.transform.Source implementation not supported:  {0}.

Modified: 
axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource_ja.properties
URL: 
http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource_ja.properties?rev=1407272&r1=1407271&r2=1407272&view=diff
==============================================================================
--- 
axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource_ja.properties
 (original)
+++ 
axis/axis1/java/trunk/axis-rt-core/src/main/resources/org/apache/axis/i18n/resource_ja.properties
 Thu Nov  8 21:30:30 2012
@@ -854,9 +854,6 @@ badTimeDuration=\u30d1\u30bf\u30fc\u30f3
 
 
needSimpleValueSer=\u30af\u30e9\u30b9{0}\u306e\u30b7\u30ea\u30a2\u30e9\u30a4\u30b6\u306fSimpleValueSerializer\u3092\u5b9f\u88c5\u3057\u3066\u3044\u307e\u305b\u3093\u3001\u305d\u308c\u306f\u5c5e\u6027\u306b\u5bfe\u3057\u3066\u5fc5\u8981\u3067\u3059\u3002
 / [en]-(Serializer class {0} does not implement SimpleValueSerializer, which 
is necessary for attributes.)
 
-# NOTE:  in needImageIO, do not translate "JIMI", "java.awt.Image", 
"http://java.sun.com/products/jimi/";
-needImageIO=JIMI\u306fjava.awt.Image\u30af\u30e9\u30b9\u306e\u6dfb\u4ed8\u306b\u5fc5\u8981\u3067\u3059
 (http://java.sun.com/products/jimi/) / [en]-(JIMI is necessary to use 
java.awt.Image attachments (http://java.sun.com/products/jimi/).)
-
 
wsddServiceName00=WSDD\u30b5\u30fc\u30d3\u30b9\u540d\u306e\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u30dd\u30fc\u30c8\u540d\u3067\u3059
 / [en]-(The WSDD service name defaults to the port name.)
 
 
badSource=javax.xml.transform.Source\u306e\u5b9f\u88c5\u306f\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u305b\u3093:
  {0} / [en]-(javax.xml.transform.Source implementation not supported:  {0}.)


Reply via email to