openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1468134 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/InjectionTargetBean.java component/InterceptorBean.java component/SelfInterceptorBean.java intercept/InterceptorResolutionService.java
Date Mon, 15 Apr 2013 16:03:50 GMT
Author: rmannibucau
Date: Mon Apr 15 16:03:50 2013
New Revision: 1468134

URL: http://svn.apache.org/r1468134
Log:
OWB-836 auto interception (alone)

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java?rev=1468134&r1=1468133&r2=1468134&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
Mon Apr 15 16:03:50 2013
@@ -123,17 +123,11 @@ public abstract class InjectionTargetBea
 
                 if (mii.getEjbInterceptors() != null)
                 {
-                    for (Interceptor<?> i : mii.getEjbInterceptors())
-                    {
-                        activeInterceptors.add(i);
-                    }
+                    Collections.addAll(activeInterceptors, mii.getEjbInterceptors());
                 }
                 if (mii.getCdiInterceptors() != null)
                 {
-                    for (Interceptor<?> i : mii.getCdiInterceptors())
-                    {
-                        activeInterceptors.add(i);
-                    }
+                    Collections.addAll(activeInterceptors, mii.getCdiInterceptors());
                 }
                 if (interceptorInfo.getSelfInterceptorBean() != null)
                 {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java?rev=1468134&r1=1468133&r2=1468134&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptorBean.java
Mon Apr 15 16:03:50 2013
@@ -53,7 +53,7 @@ public abstract class InterceptorBean<T>
     /**
      * This is for performance reasons
      */
-    private Method aroundInvokeMethod = null;
+    protected Method aroundInvokeMethod = null;
 
     protected InterceptorBean(WebBeansContext webBeansContext,
                                   AnnotatedType<T> annotatedType,

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java?rev=1468134&r1=1468133&r2=1468134&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/SelfInterceptorBean.java
Mon Apr 15 16:03:50 2013
@@ -52,6 +52,11 @@ public class SelfInterceptorBean<T> exte
                 new InjectionTargetFactoryImpl<T>(annotatedType, webBeansContext));
     }
 
+    public boolean isAroundInvoke()
+    {
+        return aroundInvokeMethod != null;
+    }
+
     /**
      * @return always an empty Set as this interceptor doesn't have any InterceptorBindings
      */

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1468134&r1=1468133&r2=1468134&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
Mon Apr 15 16:03:50 2013
@@ -116,6 +116,8 @@ public class InterceptorResolutionServic
 
         List<Method> nonInterceptedMethods = new ArrayList<Method>();
 
+        SelfInterceptorBean<T> selfInterceptorBean = resolveSelfInterceptorBean(annotatedType);
+
         // iterate over all methods and build up the interceptor/decorator stack
         for (AnnotatedMethod annotatedMethod : interceptableAnnotatedMethods)
         {
@@ -127,7 +129,7 @@ public class InterceptorResolutionServic
 
             calculateCdiMethodDecorators(methodInterceptorInfo, decorators, annotatedMethod);
 
-            if (methodInterceptorInfo.isEmpty())
+            if (methodInterceptorInfo.isEmpty() && (selfInterceptorBean == null ||
!selfInterceptorBean.isAroundInvoke()))
             {
                 nonInterceptedMethods.add(annotatedMethod.getJavaMember());
                 continue;
@@ -164,8 +166,6 @@ public class InterceptorResolutionServic
         List<Interceptor<?>> cdiInterceptors = new ArrayList<Interceptor<?>>(allUsedCdiInterceptors);
         Collections.sort(cdiInterceptors, new InterceptorComparator(webBeansContext));
 
-        SelfInterceptorBean<T> selfInterceptorBean = resolveSelfInterceptorBean(annotatedType);
-
         if (Modifier.isFinal(annotatedType.getJavaClass().getModifiers()) &&
             (allUsedEjbInterceptors.size() > 0 || 
              allUsedCdiInterceptors.size() > 0 || 
@@ -227,7 +227,7 @@ public class InterceptorResolutionServic
             return null;
         }
 
-        return (SelfInterceptorBean<T>) sibb.getBean();
+        return sibb.getBean();
     }
 
     private void addLifecycleMethods(Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos,



Mime
View raw message