tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r895825 - in /openejb/trunk/openejb3/examples/interceptors/src: main/java/org/superbiz/interceptors/ test/java/org/superbiz/interceptors/
Date Mon, 04 Jan 2010 23:35:24 GMT
Author: jlaskowski
Date: Mon Jan  4 23:35:22 2010
New Revision: 895825

URL: http://svn.apache.org/viewvc?rev=895825&view=rev
Log:
Using Generics in EJBs as described in [1] works, but it's a workaround. The changes are to
showcase it. We should be really support generics in business interfaces. Reported as https://issues.apache.org/jira/browse/OPENEJB-1128

[1] http://download.oracle.com/docs/cd/E11035_01/wls100/ejb30/implementing.html#wp1129878

Modified:
    openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java
    openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java
    openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java
    openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java

Modified: openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java?rev=895825&r1=895824&r2=895825&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java
(original)
+++ openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyIntf.java
Mon Jan  4 23:35:22 2010
@@ -16,9 +16,9 @@
  */
 package org.superbiz.interceptors;
 
-import javax.persistence.Entity;
+import java.io.Serializable;
 import java.util.List;
 
-public interface MethodLevelInterceptorOnlyIntf {
-    public List<String> makePersistent(Entity entity);
+public interface MethodLevelInterceptorOnlyIntf<T extends Serializable> {
+    public List<T> makePersistent(T entity);
 }

Modified: openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java?rev=895825&r1=895824&r2=895825&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java
(original)
+++ openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyParent.java
Mon Jan  4 23:35:22 2010
@@ -16,12 +16,9 @@
  */
 package org.superbiz.interceptors;
 
-import javax.persistence.Entity;
 import java.util.List;
 
-public class MethodLevelInterceptorOnlyParent implements MethodLevelInterceptorOnlyIntf {
+public interface MethodLevelInterceptorOnlyParent extends MethodLevelInterceptorOnlyIntf<String>
{
 
-    public List<String> makePersistent(Entity entity) {
-        return null;
-    }
+    public List<String> makePersistent(String entity);
 }

Modified: openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java?rev=895825&r1=895824&r2=895825&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java
(original)
+++ openejb/trunk/openejb3/examples/interceptors/src/main/java/org/superbiz/interceptors/MethodLevelInterceptorOnlySLSBean.java
Mon Jan  4 23:35:22 2010
@@ -18,19 +18,16 @@
 
 import javax.ejb.Local;
 import javax.ejb.Stateless;
-import javax.interceptor.ExcludeDefaultInterceptors;
 import javax.interceptor.Interceptors;
-import javax.persistence.Entity;
 import java.util.ArrayList;
 import java.util.List;
 
-@Local(MethodLevelInterceptorOnlyIntf.class)
+@Local(MethodLevelInterceptorOnlyParent.class)
 @Stateless
-public class MethodLevelInterceptorOnlySLSBean extends MethodLevelInterceptorOnlyParent implements
MethodLevelInterceptorOnlyIntf {
+public class MethodLevelInterceptorOnlySLSBean implements MethodLevelInterceptorOnlyParent
{
 
-    @Override
     @Interceptors(MethodLevelInterceptorOne.class)
-    public List<String> makePersistent(Entity entity) {
+    public List<String> makePersistent(String entity) {
         List<String> list = new ArrayList<String>();
         list.add("makePersistent");
         return list;

Modified: openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java?rev=895825&r1=895824&r2=895825&view=diff
==============================================================================
--- openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java
(original)
+++ openejb/trunk/openejb3/examples/interceptors/src/test/java/org/superbiz/interceptors/MethodLevelInterceptorOnlyTest.java
Mon Jan  4 23:35:22 2010
@@ -42,8 +42,8 @@
     }
 
     @Test
-    public void testMethodWithDefaultInterceptorsExcluded() throws Exception {
-        MethodLevelInterceptorOnlyIntf bean = (MethodLevelInterceptorOnlyIntf) initCtx.lookup("MethodLevelInterceptorOnlySLSBeanLocal");
+    public void testInterceptedGenerifiedBusinessIntfMethod() throws Exception {
+        MethodLevelInterceptorOnlyParent bean = (MethodLevelInterceptorOnlyParent) initCtx.lookup("MethodLevelInterceptorOnlySLSBeanLocal");
 
         assert bean != null;
 



Mime
View raw message