openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cove...@apache.org
Subject svn commit: r1002428 - /openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java
Date Wed, 29 Sep 2010 00:29:29 GMT
Author: covener
Date: Wed Sep 29 00:29:29 2010
New Revision: 1002428

URL: http://svn.apache.org/viewvc?rev=1002428&view=rev
Log:
[OWB-463] allow EJB proxies to also be created as subclasses of EJB implementation 
classes for @LocalBean EJBs, instead of as proxies that only extend a given
@Local interface.  

Prevents java.lang.IncompatibleClassChangeError when calling 
ProxyFactory.setInterfaces() with an EJB implemenation class as
the argument.


Modified:
    openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java

Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java?rev=1002428&r1=1002427&r2=1002428&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java
(original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java
Wed Sep 29 00:29:29 2010
@@ -47,6 +47,15 @@ public final class EjbDefinitionUtility
         creator.defineApiType();
     }
     
+    /**
+     * 
+     * @param <T> EJB bean implementation class
+     * @param bean The Enterprise bean to create a proxy for
+     * @param iface The @Local interface the proxy should implement or the 
+     *              @Localbean class the proxy should extend.
+     * @param creationalContext 
+     * @return
+     */
     @SuppressWarnings({"unchecked"})
     public static <T> T defineEjbBeanProxy(BaseEjbBean<T> bean, Class<?>
iface, CreationalContext<?> creationalContext)
     {
@@ -57,7 +66,16 @@ public final class EjbDefinitionUtility
             if(clazz == null)
             {
                 ProxyFactory factory = new ProxyFactory();
-                factory.setInterfaces(new Class[]{iface});
+                if (iface.isInterface())
+                {
+                    factory.setInterfaces(new Class[]{iface});
+                }
+                else 
+                {
+                    // @LocalBean no-interface local view requested
+                    factory.setSuperclass(iface);
+                }
+                
                 clazz = JavassistProxyFactory.getInstance().defineEjbBeanProxyClass(bean,
iface, factory);
             }
             



Mime
View raw message