You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2013/01/19 15:27:14 UTC

svn commit: r1435557 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/intercept/ main/java/org/apache/webbeans/intercept/ejb/ test/java/org/apache/webbeans/test/unittests/exception/ test...

Author: struberg
Date: Sat Jan 19 14:27:13 2013
New Revision: 1435557

URL: http://svn.apache.org/viewvc?rev=1435557&view=rev
Log:
OWB-344 remove interceptorStack from InjectionTargetBean

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/ManagedBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.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=1435557&r1=1435556&r2=1435557&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 Sat Jan 19 14:27:13 2013
@@ -20,14 +20,11 @@ package org.apache.webbeans.component;
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Set;
 
 import javax.enterprise.inject.spi.AnnotatedType;
 
 import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.intercept.InterceptorData;
 
 import javax.enterprise.inject.spi.InjectionTarget;
 
@@ -44,14 +41,6 @@ public abstract class InjectionTargetBea
 {    
     /**Annotated type for bean*/
     private AnnotatedType<T> annotatedType;
-    
-    /**
-     * Holds the all of the interceptor related data, contains around-invoke,
-     * post-construct and pre-destroy
-     * @deprecated old InterceptorData based config
-     */
-    protected List<InterceptorData> interceptorStack = new ArrayList<InterceptorData>();
-
 
     protected InjectionTargetBean(WebBeansContext webBeansContext,
                                   WebBeansType webBeansType,
@@ -93,14 +82,6 @@ public abstract class InjectionTargetBea
     /**
      * {@inheritDoc}
      */
-    public List<InterceptorData> getInterceptorStack()
-    {
-        return interceptorStack;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     public AnnotatedType<T> getAnnotatedType()
     {
         return annotatedType;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java?rev=1435557&r1=1435556&r2=1435557&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java Sat Jan 19 14:27:13 2013
@@ -27,7 +27,6 @@ import java.util.Set;
 import javax.enterprise.inject.spi.AnnotatedType;
 
 import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.intercept.InterceptorData;
 
 /**
  * Managed bean implementation of the {@link javax.enterprise.inject.spi.Bean}.
@@ -96,19 +95,8 @@ public class ManagedBean<T> extends Inje
         }
         if(Serializable.class.isAssignableFrom(getReturnType()))
         {
+            //X TODO add proper serialisation checks for all decorators and interceptors!
 
-            for(InterceptorData interceptorData : interceptorStack)
-            {
-                if(interceptorData.isDefinedInInterceptorClass())
-                {
-                    Class<?> interceptor = interceptorData.getInterceptorClass();
-                    if(!Serializable.class.isAssignableFrom(interceptor))
-                    {
-                        isPassivationCapable = Boolean.FALSE;
-                        return false;
-                    }
-                }
-            }
 
             isPassivationCapable = Boolean.TRUE;
             return true;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=1435557&r1=1435556&r2=1435557&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java Sat Jan 19 14:27:13 2013
@@ -509,28 +509,6 @@ public final class InterceptorUtil
         return false;
     }
 
-    /**
-     * Filter bean interceptor stack.
-     * @param stack interceptor stack
-     * @param method called method on proxy
-     */
-    public void filterCommonInterceptorStackList(List<InterceptorData> stack, Method method)
-    {
-        if (stack.size() > 0)
-        {
-            Iterator<InterceptorData> it = stack.iterator();
-            while (it.hasNext())
-            {
-                InterceptorData data = it.next();
-
-                if (shouldRemoveInterceptorCommon(data, method))
-                {
-                    it.remove();
-                }
-            }
-        }
-    }
-
 
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java?rev=1435557&r1=1435556&r2=1435557&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java Sat Jan 19 14:27:13 2013
@@ -19,6 +19,7 @@
 package org.apache.webbeans.intercept.ejb;
 
 import java.lang.reflect.Method;
+import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
@@ -55,9 +56,8 @@ public final class EJBInterceptorConfig
      * Configures the given class for applicable interceptors.
      *
      * @param annotatedType to configure interceptors for
-     * @param interceptorStack to fill
      */
-    public void configure(AnnotatedType<?> annotatedType, List<InterceptorData> interceptorStack)
+    public void configure(AnnotatedType<?> annotatedType)
     {
         Asserts.assertNotNull(annotatedType);
 
@@ -69,14 +69,14 @@ public final class EJBInterceptorConfig
 
             for (Class<?> intClass : interceptorClasses)
             {
-                configureInterceptorAnnots(webBeansContext.getAnnotatedElementFactory().newAnnotatedType(intClass), interceptorStack, false, null);
+                configureInterceptorAnnots(webBeansContext.getAnnotatedElementFactory().newAnnotatedType(intClass), Collections.EMPTY_LIST, false, null);
             }
 
         }
-        configureBeanAnnots(annotatedType, interceptorStack);
+        configureBeanAnnots(annotatedType, Collections.EMPTY_LIST);
 
         Class clazz = annotatedType.getJavaClass();
-        webBeansContext.getInterceptorUtil().filterOverridenLifecycleInterceptor(clazz, interceptorStack);
+        webBeansContext.getInterceptorUtil().filterOverridenLifecycleInterceptor(clazz, Collections.EMPTY_LIST);
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java?rev=1435557&r1=1435556&r2=1435557&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java Sat Jan 19 14:27:13 2013
@@ -211,7 +211,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<MoreThanOnePostConstructComponent> component = defineManagedBean(MoreThanOnePostConstructComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -229,7 +229,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<PostContructMethodHasParameterComponent> component = defineManagedBean(PostContructMethodHasParameterComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -247,7 +247,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(PostContructMethodHasReturnTypeComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -265,7 +265,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(PostContructMethodHasCheckedExceptionComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -283,7 +283,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(PostContructMethodHasStaticComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -301,7 +301,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(MoreThanOneAroundInvokeComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -318,7 +318,7 @@ public class ExceptionComponentTest exte
         defineManagedBean(AroundInvokeWithSameMethodNameComponent.class);
         Bean<?> comp = getComponents().get(0);
 
-        Assert.assertEquals(0, ((InjectionTargetBean<?>) comp).getInterceptorStack().size());
+        //X TODO reimplement with new test suite: Assert.assertEquals(0, ((InjectionTargetBean<?>) comp).getInterceptorStack().size());
     }
 
     @Test
@@ -329,7 +329,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(AroundInvokeWithoutParameterComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -347,7 +347,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(AroundInvokeWithoutReturnTypeComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -365,7 +365,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(AroundInvokeWithWrongReturnTypeComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -383,7 +383,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(AroundInvokeWithStaticMethodComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -401,7 +401,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(AroundInvokeWithFinalMethodComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {
@@ -419,7 +419,7 @@ public class ExceptionComponentTest exte
             clear();
             InjectionTargetBean<?> component = defineManagedBean(NoArgConstructorInterceptorComponent.class);
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java?rev=1435557&r1=1435556&r2=1435557&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.java Sat Jan 19 14:27:13 2013
@@ -51,7 +51,7 @@ public class EJBInterceptorExceptionComp
             InjectionTargetBean<MultpleInterceptor> component = defineManagedBean(MultpleInterceptor.class);
 
             AnnotatedType annotatedType = getWebBeansContext().getAnnotatedElementFactory().newAnnotatedType(component.getReturnType());
-            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType, component.getInterceptorStack());
+            getWebBeansContext().getEJBInterceptorConfig().configure(annotatedType);
         }
         catch (WebBeansConfigurationException e)
         {