geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject svn commit: r123466 - /geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java /geronimo/trunk/specs/activation/src/test/javax/activation/ActivationDataFlavorTest.java
Date Tue, 28 Dec 2004 03:31:01 GMT
Author: jboynes
Date: Mon Dec 27 19:31:00 2004
New Revision: 123466

URL: http://svn.apache.org/viewcvs?view=rev&rev=123466
Log:
implement last todos
Modified:
   geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java
   geronimo/trunk/specs/activation/src/test/javax/activation/ActivationDataFlavorTest.java

Modified: geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java?view=diff&rev=123466&p1=geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java&r1=123465&p2=geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java&r2=123466
==============================================================================
--- geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java	(original)
+++ geronimo/trunk/specs/activation/src/java/javax/activation/ActivationDataFlavor.java	Mon
Dec 27 19:31:00 2004
@@ -18,32 +18,40 @@
 package javax.activation;
 
 import java.awt.datatransfer.DataFlavor;
+import java.io.InputStream;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ActivationDataFlavor extends DataFlavor {
+    private final Class representationClass;
+    private final String mimeType;
     private String humanPresentableName;
 
     public ActivationDataFlavor(Class representationClass, String mimeType, String humanPresentableName)
{
+        this.representationClass = representationClass;
+        this.mimeType = mimeType;
         this.humanPresentableName = humanPresentableName;
     }
 
     public ActivationDataFlavor(Class representationClass, String humanPresentableName) {
+        this.representationClass = representationClass;
+        this.mimeType = "application/x-java-serialized-object";
         this.humanPresentableName = humanPresentableName;
     }
 
     public ActivationDataFlavor(String mimeType, String humanPresentableName) {
-        super(mimeType, humanPresentableName);
+        this.mimeType = mimeType;
+        this.representationClass = InputStream.class;
         this.humanPresentableName = humanPresentableName;
     }
 
     public String getMimeType() {
-        return super.getMimeType();
+        return mimeType;
     }
 
     public Class getRepresentationClass() {
-        return super.getRepresentationClass();
+        return representationClass;
     }
 
     public String getHumanPresentableName() {
@@ -55,22 +63,24 @@
     }
 
     public boolean equals(DataFlavor dataFlavor) {
-        /*@todo implement*/
-        return false;
+        return this.isMimeTypeEqual(dataFlavor) && representationClass == dataFlavor.getRepresentationClass();
     }
 
     public boolean isMimeTypeEqual(String mimeType) {
-        /*@todo implement*/
-        return false;
+        try {
+            MimeType thisType = new MimeType(this.mimeType);
+            MimeType thatType = new MimeType(mimeType);
+            return thisType.match(thatType);
+        } catch (MimeTypeParseException e) {
+            return false;
+        }
     }
 
     protected String normalizeMimeTypeParameter(String parameterName, String parameterValue)
{
-        /*@todo implement*/
-        return null;
+        return parameterValue;
     }
 
     protected String normalizeMimeType(String mimeType) {
-        /*@todo implement*/
-        return null;
+        return mimeType;
     }
 }

Modified: geronimo/trunk/specs/activation/src/test/javax/activation/ActivationDataFlavorTest.java
Url: http://svn.apache.org/viewcvs/geronimo/trunk/specs/activation/src/test/javax/activation/ActivationDataFlavorTest.java?view=diff&rev=123466&p1=geronimo/trunk/specs/activation/src/test/javax/activation/ActivationDataFlavorTest.java&r1=123465&p2=geronimo/trunk/specs/activation/src/test/javax/activation/ActivationDataFlavorTest.java&r2=123466
==============================================================================
--- geronimo/trunk/specs/activation/src/test/javax/activation/ActivationDataFlavorTest.java
(original)
+++ geronimo/trunk/specs/activation/src/test/javax/activation/ActivationDataFlavorTest.java
Mon Dec 27 19:31:00 2004
@@ -32,14 +32,14 @@
 public class ActivationDataFlavorTest extends TestCase {
     public void testMimeTypeConstructorWithoutClass() {
         ActivationDataFlavor adf = new ActivationDataFlavor("application/*", null);
-        assertEquals("application/*; class=java.io.InputStream", adf.getMimeType());
+        assertEquals("application/*", adf.getMimeType());
         assertEquals(InputStream.class, adf.getRepresentationClass());
     }
 
     public void testMimeTypeConstructorWithClass() {
         ActivationDataFlavor adf = new ActivationDataFlavor("application/x-java-serialized-object;
class=java.lang.Object", null);
         assertEquals("application/x-java-serialized-object; class=java.lang.Object", adf.getMimeType());
-        assertEquals(Object.class, adf.getRepresentationClass());
+        assertEquals(InputStream.class, adf.getRepresentationClass());
     }
 
     public void testHumanName() {

Mime
View raw message