[jbossws-commits] JBossWS SVN: r3193 - branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/xop/jaxws.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Tue May 22 15:16:54 EDT 2007


Author: heiko.braun at jboss.com
Date: 2007-05-22 15:16:54 -0400 (Tue, 22 May 2007)
New Revision: 3193

Modified:
   branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java
Log:
Scanner did miss swaref method annotations

Modified: branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java	2007-05-22 19:16:19 UTC (rev 3192)
+++ branches/jbossws-2.0/jbossws-core/src/java/org/jboss/ws/extensions/xop/jaxws/ReflectiveAttachmentRefScanner.java	2007-05-22 19:16:54 UTC (rev 3193)
@@ -21,20 +21,18 @@
 */
 package org.jboss.ws.extensions.xop.jaxws;
 
-import java.awt.Image;
+import org.jboss.ws.core.utils.JavaUtils;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlAttachmentRef;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.transform.Source;
+import java.awt.*;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
-import javax.activation.DataHandler;
-import javax.xml.bind.annotation.XmlMimeType;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttachmentRef;
-import javax.xml.transform.Source;
-
-import org.jboss.ws.core.utils.JavaUtils;
-
 /**
  * Scans data types for MTOM and swaRef declarations.
  * It basically searches for
@@ -75,7 +73,7 @@
     */
    public AttachmentScanResult scan(Class xmlRoot)
    {
-      if( isJDKType(xmlRoot) )
+      if( isJDKType(xmlRoot) )  // TODO: this fails with wrapper beans
          return null;
 
       AttachmentScanResult result = null;
@@ -106,9 +104,7 @@
 
             if(null == result) // try getter methods
             {
-               String mimeType = scanGetterAnnotation(xmlRoot, field);
-               if(mimeType!=null)
-                  result = new AttachmentScanResult(mimeType, AttachmentScanResult.Type.XOP);
+               result = scanGetterAnnotation(xmlRoot, field);               
             }
 
             // avoid recursive loops
@@ -158,17 +154,24 @@
       return clazz.getPackage()!= null ? clazz.getPackage().getName().startsWith("java") : true;
    }
 
-   private static String scanGetterAnnotation(Class owner, Field field)
+   private static AttachmentScanResult scanGetterAnnotation(Class owner, Field field)
    {
       String getterMethodName = "get"+field.getName();
       for(Method method : owner.getDeclaredMethods())
       {
-         if(method.getName().equalsIgnoreCase(getterMethodName)
-            && method.isAnnotationPresent(XmlMimeType.class))
+         if(method.getName().equalsIgnoreCase(getterMethodName))
          {
-            XmlMimeType mimeTypeDecl = method.getAnnotation(XmlMimeType.class);
-            return mimeTypeDecl.value();
+            if(method.isAnnotationPresent(XmlMimeType.class))
+            {
+               XmlMimeType mimeTypeDecl = method.getAnnotation(XmlMimeType.class);
+               return new AttachmentScanResult(mimeTypeDecl.value(), AttachmentScanResult.Type.XOP);
+            }
+            else if(method.isAnnotationPresent(XmlAttachmentRef.class))
+            {
+               return new AttachmentScanResult("application/octet-stream", AttachmentScanResult.Type.SWA_REF); 
+            }
          }
+
       }
 
       return null;




More information about the jbossws-commits mailing list