openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1607156 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: container/ intercept/ portable/
Date Tue, 01 Jul 2014 18:17:52 GMT
Author: arne
Date: Tue Jul  1 18:17:52 2014
New Revision: 1607156

URL: http://svn.apache.org/r1607156
Log:
Fixed interceptor order (superclass first)

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1607156&r1=1607155&r2=1607156&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Tue Jul  1 18:17:52 2014
@@ -1092,8 +1092,8 @@ public class BeanManagerImpl implements 
                         type,
                         factory.createInjectionPoints(null),
                         webBeansContext,
-                        interceptorUtil.getLifecycleMethods(type, PostConstruct.class, true),
-                        interceptorUtil.getLifecycleMethods(type, PreDestroy.class, true));
+                        interceptorUtil.getLifecycleMethods(type, PostConstruct.class),
+                        interceptorUtil.getLifecycleMethods(type, PreDestroy.class));
         try
         {
             webBeansContext.getWebBeansUtil().validate(injectionTarget.getInjectionPoints(),
false);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java?rev=1607156&r1=1607155&r2=1607156&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
Tue Jul  1 18:17:52 2014
@@ -83,11 +83,11 @@ public class InjectionTargetFactoryImpl<
 
     protected List<AnnotatedMethod<?>> getPostConstructMethods()
     {
-        return webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType, PostConstruct.class,
true);
+        return webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType, PostConstruct.class);
     }
 
     protected List<AnnotatedMethod<?>> getPreDestroyMethods()
     {
-        return webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType, PreDestroy.class,
false);
+        return webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType, PreDestroy.class);
     }
 }

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=1607156&r1=1607155&r2=1607156&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
Tue Jul  1 18:17:52 2014
@@ -166,8 +166,7 @@ public class InterceptorResolutionServic
                 allUsedCdiInterceptors,
                 allUsedEjbInterceptors,
                 classLevelEjbInterceptors,
-                classInterceptorBindings,
-                true);
+                classInterceptorBindings);
 
         addLifecycleMethods(
                 lifecycleMethodInterceptorInfos,
@@ -177,8 +176,7 @@ public class InterceptorResolutionServic
                 allUsedCdiInterceptors,
                 allUsedEjbInterceptors,
                 classLevelEjbInterceptors,
-                classInterceptorBindings,
-                true);
+                classInterceptorBindings);
 
         List<Interceptor<?>> cdiInterceptors = new ArrayList<Interceptor<?>>(allUsedCdiInterceptors);
         Collections.sort(cdiInterceptors, new InterceptorComparator(webBeansContext));
@@ -324,13 +322,12 @@ public class InterceptorResolutionServic
                                      Set<Interceptor<?>> allUsedCdiInterceptors,
                                      Set<Interceptor<?>> allUsedEjbInterceptors,
                                      List<Interceptor<?>> classLevelEjbInterceptors,
-                                     Set<Annotation> classInterceptorBindings,
-                                     boolean parentFirst)
+                                     Set<Annotation> classInterceptorBindings)
     {
         List<AnnotatedMethod<?>> foundMethods = new ArrayList<AnnotatedMethod<?>>();
         BusinessMethodInterceptorInfo methodInterceptorInfo = new BusinessMethodInterceptorInfo();
 
-        List<AnnotatedMethod<?>> lifecycleMethodCandidates = webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType,
lifeycleAnnotation, parentFirst);
+        List<AnnotatedMethod<?>> lifecycleMethodCandidates = webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType,
lifeycleAnnotation);
 
         for (AnnotatedMethod<?> lifecycleMethod : lifecycleMethodCandidates)
         {

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=1607156&r1=1607155&r2=1607156&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
Tue Jul  1 18:17:52 2014
@@ -60,7 +60,7 @@ public final class InterceptorUtil
     }
 
 
-    public List<AnnotatedMethod<?>> getLifecycleMethods(AnnotatedType<?>
annotatedType, Class<? extends Annotation> annotation, boolean parentFirst)
+    public List<AnnotatedMethod<?>> getLifecycleMethods(AnnotatedType<?>
annotatedType, Class<? extends Annotation> annotation)
     {
         List<AnnotatedMethod<?>> lifecycleMethods = new ArrayList<AnnotatedMethod<?>>();
 
@@ -76,14 +76,7 @@ public final class InterceptorUtil
 
                 if (annotatedMethod.isAnnotationPresent(annotation))
                 {
-                    if (parentFirst)
-                    {
-                        lifecycleMethods.add(annotatedMethod);
-                    }
-                    else
-                    {
-                        lifecycleMethods.add(0, annotatedMethod);
-                    }
+                    lifecycleMethods.add(annotatedMethod);
                 }
             }
         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java?rev=1607156&r1=1607155&r2=1607156&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
Tue Jul  1 18:17:52 2014
@@ -34,7 +34,6 @@ import org.apache.webbeans.intercept.Lif
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
 import org.apache.webbeans.proxy.InterceptorHandler;
-import org.apache.webbeans.proxy.NormalScopeProxyFactory;
 import org.apache.webbeans.proxy.OwbInterceptorProxy;
 import org.apache.webbeans.proxy.OwbNormalScopeProxy;
 import org.apache.webbeans.spi.ResourceInjectionService;
@@ -57,6 +56,7 @@ import javax.enterprise.inject.spi.Inter
 import javax.inject.Inject;
 import javax.inject.Provider;
 import javax.interceptor.InvocationContext;
+
 import java.lang.annotation.Annotation;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Constructor;
@@ -322,41 +322,23 @@ public class InjectionTargetImpl<T> exte
     @Override
     public void preDestroy(T instance)
     {
+        if (instance instanceof OwbNormalScopeProxy)
+        {
+            instance = webBeansContext.getNormalScopeProxyFactory().unwrapInstance(instance);
+        }
+
         Map<Interceptor<?>, ?> interceptorInstances = null;
         T internalInstance = instance;
 
-        if (getInterceptorInfo() != null)
+        if (getInterceptorInfo() != null && instance instanceof OwbInterceptorProxy)
         {
-            if (instance instanceof OwbInterceptorProxy)
-            {
-                InterceptorDecoratorProxyFactory pf = webBeansContext.getInterceptorDecoratorProxyFactory();
-                InterceptorHandler ih = pf.getInterceptorHandler((OwbInterceptorProxy) instance);
-                if (ih instanceof DefaultInterceptorHandler)
-                {
-                    DefaultInterceptorHandler dih = (DefaultInterceptorHandler) ih;
-                    interceptorInstances = dih.getInstances();
-                    internalInstance = (T) dih.getTarget();
-                }
-            }
-            else if (instance instanceof OwbNormalScopeProxy)
+            InterceptorDecoratorProxyFactory pf = webBeansContext.getInterceptorDecoratorProxyFactory();
+            InterceptorHandler ih = pf.getInterceptorHandler((OwbInterceptorProxy) instance);
+            if (ih instanceof DefaultInterceptorHandler)
             {
-                final NormalScopeProxyFactory nspf = webBeansContext.getNormalScopeProxyFactory();
-                final Provider provider = nspf.getInstanceProvider(OwbNormalScopeProxy.class.cast(instance));
-                if (provider != null)
-                {
-                    final Object object = provider.get();
-                    if (object != null && OwbInterceptorProxy.class.isInstance(object))
-                    {
-                        final InterceptorDecoratorProxyFactory pf = webBeansContext.getInterceptorDecoratorProxyFactory();
-                        final InterceptorHandler ih = pf.getInterceptorHandler(OwbInterceptorProxy.class.cast(object));
-                        if (DefaultInterceptorHandler.class.isInstance(ih))
-                        {
-                            final DefaultInterceptorHandler dih = DefaultInterceptorHandler.class.cast(ih);
-                            interceptorInstances = dih.getInstances();
-                            internalInstance = (T) dih.getTarget();
-                        }
-                    }
-                }
+                DefaultInterceptorHandler dih = (DefaultInterceptorHandler) ih;
+                interceptorInstances = dih.getInstances();
+                internalInstance = (T) dih.getTarget();
             }
         }
         else if (preDestroyMethods == null || preDestroyMethods.size() == 0)



Mime
View raw message