[jboss-cvs] JBossAS SVN: r110916 - in projects/jboss-jca/trunk: deployers/src/test/java/org/jboss/jca/deployers/annotations and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 15 07:58:26 EDT 2011


Author: maeste
Date: 2011-03-15 07:58:26 -0400 (Tue, 15 Mar 2011)
New Revision: 110916

Modified:
   projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java
   projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/annotations/AnnotationsTestCase.java
Log:
jbjca-512

Modified: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java	2011-03-15 11:47:59 UTC (rev 110915)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java	2011-03-15 11:58:26 UTC (rev 110916)
@@ -59,12 +59,16 @@
 import org.jboss.jca.common.spi.annotations.repository.Annotation;
 import org.jboss.jca.common.spi.annotations.repository.AnnotationRepository;
 
-import java.lang.reflect.Array;
+import java.io.Externalizable;
+import java.io.Serializable;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.resource.spi.Activation;
@@ -192,7 +196,7 @@
       //md = processAuthenticationMechanism(md, annotationRepository);
 
       // @AdministeredObject
-      ArrayList<AdminObject> adminObjs = processAdministeredObject(annotationRepository);
+      ArrayList<AdminObject> adminObjs = processAdministeredObject(annotationRepository, classLoader);
 
       //log.debug("ConnectorMetadata " + md);
 
@@ -725,10 +729,12 @@
     * Process: @AdministeredObject
     * @param md The metadata
     * @param annotationRepository The annotation repository
+    * @param classLoader the classloadedr used to load annotated class
     * @return The updated metadata
     * @exception Exception Thrown if an error occurs
     */
-   private ArrayList<AdminObject> processAdministeredObject(AnnotationRepository annotationRepository)
+   private ArrayList<AdminObject> processAdministeredObject(AnnotationRepository annotationRepository,
+      ClassLoader classLoader)
       throws Exception
    {
       ArrayList<AdminObject> adminObjs = null;
@@ -743,12 +749,28 @@
             if (trace)
                log.trace("Processing: " + a);
             String aoName = null;
-            String aoClassName = null;
-            if (a.adminObjectInterfaces().length > 0)
+            String aoClassName = annotation.getClassName();
+            Class<?> aClass = Class.forName(aoClassName, true, classLoader);
+            List<Class<?>> declaredInterfaces = null;
+            if (aClass.getInterfaces() != null && aClass.getInterfaces().length != 0) {
+               declaredInterfaces = Arrays.asList(aClass.getInterfaces());
+
+            } else {
+               declaredInterfaces = Collections.emptyList();
+            }
+            if (a.adminObjectInterfaces() != null && a.adminObjectInterfaces().length > 0)
             {
-               aoName = ((Class) Array.get(a.adminObjectInterfaces(), 0)).getName();
+               for (Class<?> annotatedInterface : a.adminObjectInterfaces())
+            {
+                  if (declaredInterfaces.contains(annotatedInterface) &&
+                      !annotatedInterface.equals(Serializable.class) &&
+                      !annotatedInterface.equals(Externalizable.class))
+                  {
+                     aoName = annotatedInterface.getName();
+                     break;
+                  }
+               }
             }
-            aoClassName = annotation.getClassName();
             XsdString adminobjectInterface = new XsdString(aoName, null);
             XsdString adminobjectClass = new XsdString(aoClassName, null);
 

Modified: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/annotations/AnnotationsTestCase.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/annotations/AnnotationsTestCase.java	2011-03-15 11:47:59 UTC (rev 110915)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/deployers/annotations/AnnotationsTestCase.java	2011-03-15 11:58:26 UTC (rev 110916)
@@ -244,6 +244,7 @@
       }
       catch (Throwable t)
       {
+         t.printStackTrace();
          fail(t.getMessage());
       }
    }



More information about the jboss-cvs-commits mailing list