[jboss-cvs] JBossAS SVN: r67718 - in trunk/ejb3/src/main/org/jboss/ejb3: mdb and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Dec 1 13:26:57 EST 2007


Author: ALRubinger
Date: 2007-12-01 13:26:57 -0500 (Sat, 01 Dec 2007)
New Revision: 67718

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
   trunk/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java
Log:
[EJBTHREE-1123] Made "getBusinessInterfaces" of ProxyFactoryHelper *optionally* include superclasses' business interfaces, instructred MDB to not include supers.  Currently exposes Classloading/ConcurrentModificationException error when run

Modified: trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2007-12-01 18:18:06 UTC (rev 67717)
+++ trunk/ejb3/src/main/org/jboss/ejb3/ProxyFactoryHelper.java	2007-12-01 18:26:57 UTC (rev 67718)
@@ -243,7 +243,7 @@
 
    /**
     * Resolve the potential business interfaces on an enterprise bean.
-    * Returns all interfaces implemented by this class and it's supers which
+    * Returns all interfaces implemented by this class and its supers which
     * are potentially a business interface.
     *
     * Note: for normal operation call container.getBusinessInterfaces().
@@ -255,11 +255,34 @@
    public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass)
    {
       // Obtain all business interfaces implemented by this bean class and its superclasses
-      return getBusinessInterfaces(beanClass, new HashSet<Class<?>>()); 
+      return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>()); 
    }
    
+   /**
+    * Resolve the potential business interfaces on an enterprise bean.
+    * Returns all interfaces implemented by this class and, optionally, its supers which
+    * are potentially a business interface.
+    *
+    * Note: for normal operation call container.getBusinessInterfaces().
+    *
+    * @param    beanClass   the EJB implementation class
+    * @param    includeSupers Whether or not to include superclasses of the specified beanClass in this check
+    * @return   a list of potential business interfaces
+    * @see      org.jboss.ejb3.EJBContainer#getBusinessInterfaces()
+    */
+   public static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, boolean includeSupers)
+   {
+      // Obtain all business interfaces implemented by this bean class and optionally, its superclass
+      return ProxyFactoryHelper.getBusinessInterfaces(beanClass, new HashSet<Class<?>>(), includeSupers);
+   }
+   
    private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces)
    {
+      return ProxyFactoryHelper.getBusinessInterfaces(beanClass, interfaces, true);
+   }
+   
+   private static Set<Class<?>> getBusinessInterfaces(Class<?> beanClass, Set<Class<?>> interfaces, boolean includeSupers)
+   {
       /*
        * 4.6.6:
        * The following interfaces are excluded when determining whether the bean class has
@@ -281,9 +304,9 @@
          
          interfaces.add(intf);
       }
-
-      // If there's no superclass, return
-      if (beanClass.getSuperclass() == null)
+      
+      // If there's no superclass, or we shouldn't check the superclass, return
+      if (!includeSupers || beanClass.getSuperclass() == null)
       {
          return interfaces;
       }

Modified: trunk/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java	2007-12-01 18:18:06 UTC (rev 67717)
+++ trunk/ejb3/src/main/org/jboss/ejb3/mdb/MDB.java	2007-12-01 18:26:57 UTC (rev 67718)
@@ -53,11 +53,11 @@
    /**
     * Default destination type. Used when no message-driven-destination is given
     * in ejb-jar, and a lookup of destinationJNDI from jboss.xml is not
-    * successfull. Default value: javax.jms.Topic.
+    * successful. Default value: javax.jms.Topic.
     */
    protected final static String DEFAULT_DESTINATION_TYPE = "javax.jms.Topic";
    
-   protected Class messagingType = null;
+   protected Class<?> messagingType = null;
    
    public MDB(String ejbName, AspectManager manager, ClassLoader cl, String beanClassName, Hashtable ctxProperties,
               InterceptorInfoRepository interceptorRepository, Ejb3Deployment deployment)
@@ -73,7 +73,7 @@
          messagingType = annotation.messageListenerInterface();
          if (messagingType.getName().equals(Object.class.getName()))
          {
-            Set<Class<?>> businessInterfaces = ProxyFactoryHelper.getBusinessInterfaces(clazz);
+            Set<Class<?>> businessInterfaces = ProxyFactoryHelper.getBusinessInterfaces(clazz,false);
             if (businessInterfaces.size() > 1 || businessInterfaces.size() == 0) 
                throw new RuntimeException("Unable to choose messagingType interface for MDB " + getEjbName() + " from " + businessInterfaces);
             messagingType = businessInterfaces.iterator().next();




More information about the jboss-cvs-commits mailing list