openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1433596 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/intercept/ main/java/org/apache/we...
Date Tue, 15 Jan 2013 19:30:13 GMT
Author: struberg
Date: Tue Jan 15 19:30:12 2013
New Revision: 1433596

URL: http://svn.apache.org/viewvc?rev=1433596&view=rev
Log:
OWB-344 mark parts of ProxyFactory as deprecated

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorInvocationContext.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/webbeans/WebBeansInterceptorBeanPleaseRemove.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/InjectionTargetImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducerRemove.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureInterceptor.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java?rev=1433596&r1=1433595&r2=1433596&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java
Tue Jan 15 19:30:12 2013
@@ -217,7 +217,7 @@ public abstract class BuildInOwbBean<T> 
             return actualInstance;
         }
 
-        T proxy = (T) webBeansContext.getProxyFactory().createBuildInBeanProxy(this);
+        T proxy = (T) webBeansContext.getProxyFactory().createBuildInBeanProxyRemove(this);
         if (handlerClassName.equals(PROXY_HANDLER_VALUE_DEFAULT)) 
         {
             final MethodHandler handler = new BuildInBeanMethodHandler(this, actualInstance);

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=1433596&r1=1433595&r2=1433596&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
Tue Jan 15 19:30:12 2013
@@ -131,9 +131,9 @@ public abstract class InjectionTargetBea
         if(getScope() == Dependent.class && !(this instanceof EnterpriseBeanMarker))
         {
             final ProxyFactory proxyFactory = getWebBeansContext().getProxyFactory();
-            T result = (T) proxyFactory.createDependentScopedBeanProxy(this, instance, creationalContext);
+            T result = (T) proxyFactory.createDependentScopedBeanProxyRemove(this, instance,
creationalContext);
             //Means that Dependent Bean has interceptor/decorator
-            if(proxyFactory.isProxyInstance(result))
+            if(proxyFactory.isProxyInstanceRemove(result))
             {
                 //This is a dependent scoped bean instance,
                 //Therefore we inject dependencies of this instance

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=1433596&r1=1433595&r2=1433596&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 Jan 15 19:30:12 2013
@@ -706,7 +706,7 @@ public class BeanManagerImpl implements 
             if (instance == null)
             {
                 //Create Managed Bean Proxy
-                instance = webBeansContext.getProxyFactory().createNormalScopedBeanProxy((AbstractOwbBean<?>)bean,creationalContext);
+                instance = webBeansContext.getProxyFactory().createNormalScopedBeanProxyRemove((AbstractOwbBean<?>)
bean, creationalContext);
 
                 //Cached instance
                 cacheProxies.put(bean, instance);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java?rev=1433596&r1=1433595&r2=1433596&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
Tue Jan 15 19:30:12 2013
@@ -412,7 +412,7 @@ public class WebBeansDecorator<T> extend
         WebBeansContext webBeansContext = wrappedBean.getWebBeansContext();
         Context context = webBeansContext.getBeanManagerImpl().getContext(getScope());
         Object actualInstance = context.get((Bean<Object>) wrappedBean, (CreationalContext<Object>)creationalContext);
-        T proxy = (T) webBeansContext.getProxyFactory().createDependentScopedBeanProxy(wrappedBean,
actualInstance, creationalContext);
+        T proxy = (T) webBeansContext.getProxyFactory().createDependentScopedBeanProxyRemove(wrappedBean,
actualInstance, creationalContext);
         
         return proxy;        
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorInvocationContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorInvocationContext.java?rev=1433596&r1=1433595&r2=1433596&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorInvocationContext.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorInvocationContext.java
Tue Jan 15 19:30:12 2013
@@ -50,6 +50,13 @@ public class InterceptorInvocationContex
         if (index < interceptors.size())
         {
             Interceptor interceptor = interceptors.get(index++);
+            if (!interceptor.intercepts(type))
+            {
+                // continue with next interceptor
+                // this e.g. happens for lifecycle interceptors
+                return proceed();
+            }
+
             return interceptor.intercept(type, instances.get(interceptor), this);
         }
         else

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=1433596&r1=1433595&r2=1433596&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 Jan 15 19:30:12 2013
@@ -53,7 +53,7 @@ import org.apache.webbeans.util.ClassUti
 
 /**
  * Class to calculate interceptor resolution information.
- *
+ * It also handles the proxy caching and applying.
  */
 public class InterceptorResolutionService
 {
@@ -139,7 +139,66 @@ public class InterceptorResolutionServic
             businessMethodInterceptorInfos.put(annotatedMethod.getJavaMember(), methodInterceptorInfo);
         }
 
-        return new BeanInterceptorInfo(decorators, allUsedCdiInterceptors, businessMethodInterceptorInfos,
nonInterceptedMethods);
+        Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos
+                = new HashMap<InterceptionType, LifecycleMethodInfo>();
+
+        addLifecycleMethods(
+                lifecycleMethodInterceptorInfos,
+                annotatedType,
+                InterceptionType.POST_CONSTRUCT,
+                PostConstruct.class,
+                allUsedEjbInterceptors,
+                classLevelEjbInterceptors,
+                allUsedCdiInterceptors,
+                classInterceptorBindings,
+                true);
+
+        addLifecycleMethods(
+                lifecycleMethodInterceptorInfos,
+                annotatedType,
+                InterceptionType.PRE_DESTROY,
+                PreDestroy.class,
+                allUsedEjbInterceptors,
+                classLevelEjbInterceptors,
+                allUsedCdiInterceptors,
+                classInterceptorBindings,
+                true);
+
+        return new BeanInterceptorInfo(decorators, allUsedCdiInterceptors, businessMethodInterceptorInfos,
nonInterceptedMethods, lifecycleMethodInterceptorInfos);
+    }
+
+    private void addLifecycleMethods(Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos,
+                                     AnnotatedType<?> annotatedType,
+                                     InterceptionType interceptionType,
+                                     Class<? extends Annotation> annotation,
+                                     Set<Interceptor<?>> allUsedEjbInterceptors,
+                                     List<Interceptor<?>> classLevelEjbInterceptors,
+                                     Set<Interceptor<?>> allUsedCdiInterceptors,
+                                     Set<Annotation> classInterceptorBindings,
+                                     boolean parentFirst)
+    {
+        Set<InterceptionType> it = new HashSet<InterceptionType>();
+        it.add(interceptionType);
+        List<AnnotatedMethod<?>> foundMethods = new ArrayList<AnnotatedMethod<?>>();
+        BusinessMethodInterceptorInfo methodInterceptorInfo = new BusinessMethodInterceptorInfo(it);
+
+        List<AnnotatedMethod<?>> lifecycleMethodCandidates = webBeansContext.getInterceptorUtil().getLifecycleMethods(annotatedType,
annotation, parentFirst);
+
+        for (AnnotatedMethod<?> lifecycleMethod : lifecycleMethodCandidates)
+        {
+            if (lifecycleMethod.getParameters().size() == 0)
+            {
+                foundMethods.add(lifecycleMethod);
+                calculateEjbMethodInterceptors(methodInterceptorInfo, allUsedEjbInterceptors,
classLevelEjbInterceptors, lifecycleMethod);
+
+                calculateCdiMethodInterceptors(methodInterceptorInfo, allUsedCdiInterceptors,
lifecycleMethod, classInterceptorBindings);
+            }
+        }
+
+        if (foundMethods.size() > 0 )
+        {
+            lifecycleMethodInterceptorInfos.put(interceptionType, new LifecycleMethodInfo(foundMethods,
methodInterceptorInfo));
+        }
     }
 
     private <T> void collectEjbInterceptors(List<Interceptor<?>> ejbInterceptors,
Annotated annotatedType)
@@ -363,12 +422,14 @@ public class InterceptorResolutionServic
         public BeanInterceptorInfo(List<Decorator<?>> decorators,
                                    Set<Interceptor<?>> interceptors,
                                    Map<Method, BusinessMethodInterceptorInfo> businessMethodsInfo,
-                                   List<Method> nonInterceptedMethods)
+                                   List<Method> nonInterceptedMethods,
+                                   Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos)
         {
             this.decorators = decorators;
             this.interceptors = interceptors;
             this.businessMethodsInfo = businessMethodsInfo;
             this.nonInterceptedMethods = nonInterceptedMethods;
+            this.lifecycleMethodInterceptorInfos = lifecycleMethodInterceptorInfos;
         }
 
         /**
@@ -394,6 +455,14 @@ public class InterceptorResolutionServic
          */
         private List<Method> nonInterceptedMethods = Collections.EMPTY_LIST;
 
+        /**
+         * Contains info about lifecycle methods.
+         * A method can be a 'business method' when invoked via the user but a
+         * 'lifecycle method' while invoked by the container!
+         */
+        private Map<InterceptionType, LifecycleMethodInfo> lifecycleMethodInterceptorInfos
= Collections.EMPTY_MAP;
+
+
         public List<Decorator<?>> getDecorators()
         {
             return decorators;
@@ -413,6 +482,11 @@ public class InterceptorResolutionServic
         {
             return nonInterceptedMethods;
         }
+
+        public Map<InterceptionType, LifecycleMethodInfo> getLifecycleMethodInterceptorInfos()
+        {
+            return lifecycleMethodInterceptorInfos;
+        }
     }
 
     /**
@@ -514,4 +588,27 @@ public class InterceptorResolutionServic
         }
     }
 
+
+    public static class LifecycleMethodInfo
+    {
+        private List<AnnotatedMethod<?>> methods = new ArrayList<AnnotatedMethod<?>>();
+        private BusinessMethodInterceptorInfo methodInterceptorInfo;
+
+        public LifecycleMethodInfo(List<AnnotatedMethod<?>> methods, BusinessMethodInterceptorInfo
methodInterceptorInfo)
+        {
+            this.methods = methods;
+            this.methodInterceptorInfo = methodInterceptorInfo;
+        }
+
+        public List<AnnotatedMethod<?>> getMethods()
+        {
+            return methods;
+        }
+
+        public BusinessMethodInterceptorInfo getMethodInterceptorInfo()
+        {
+            return methodInterceptorInfo;
+        }
+    }
+
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java?rev=1433596&r1=1433595&r2=1433596&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptorBeanPleaseRemove.java
Tue Jan 15 19:30:12 2013
@@ -291,7 +291,7 @@ public class WebBeansInterceptorBeanPlea
     {
         Context context = webBeansContext.getBeanManagerImpl().getContext(getScope());
         Object actualInstance = context.get((Bean<Object>) delegateBean, (CreationalContext<Object>)creationalContext);
-        T proxy = (T) webBeansContext.getProxyFactory().createDependentScopedBeanProxy(delegateBean,
actualInstance, creationalContext);
+        T proxy = (T) webBeansContext.getProxyFactory().createDependentScopedBeanProxyRemove(delegateBean,
actualInstance, creationalContext);
         
         return proxy;
     }

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=1433596&r1=1433595&r2=1433596&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 Jan 15 19:30:12 2013
@@ -40,6 +40,7 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.InjectionTarget;
 import javax.enterprise.inject.spi.InterceptionType;
+import javax.enterprise.inject.spi.Interceptor;
 import javax.inject.Inject;
 import javax.interceptor.InvocationContext;
 
@@ -81,7 +82,7 @@ public class InjectionTargetImpl<T> exte
     /**
      * static information about Interceptors and Decorators of that bean
      */
-    private BeanInterceptorInfo interceptorInfo;
+    private BeanInterceptorInfo interceptorInfo = null;
 
     public InjectionTargetImpl(AnnotatedType<T> annotatedType, Set<InjectionPoint>
points, WebBeansContext webBeansContext,
                                List<AnnotatedMethod<?>> postConstructMethods,
List<AnnotatedMethod<?>> preDestroyMethods)
@@ -108,7 +109,8 @@ public class InjectionTargetImpl<T> exte
         if (interceptorInfo != null)
         {
             // apply interceptorInfo
-            interceptorInfo.getInterceptors();
+            Set<Interceptor<?>> interceptors = interceptorInfo.getInterceptors();
+
         }
 
         return instance;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducerRemove.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducerRemove.java?rev=1433596&r1=1433595&r2=1433596&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducerRemove.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducerRemove.java
Tue Jan 15 19:30:12 2013
@@ -98,7 +98,7 @@ public class InjectionTargetProducerRemo
                 //not correct. Injection must be on actual dependent
                 //instance,so not necessary to inject on proxy
                 final ProxyFactory proxyFactory = this.bean.getWebBeansContext().getProxyFactory();
-                if(bean.getScope() == Dependent.class && proxyFactory.isProxyInstance(instance))
+                if(bean.getScope() == Dependent.class && proxyFactory.isProxyInstanceRemove(instance))
                 {
                     return;
                 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java?rev=1433596&r1=1433595&r2=1433596&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
Tue Jan 15 19:30:12 2013
@@ -53,7 +53,7 @@ import org.apache.webbeans.util.ClassUti
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
- * @deprecated TODO remove! replaced via {@link org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory}
+ *  TODO remove old proxy handling. Only InterceptorDecoratorProxyFactory and NormalScopeProxyFactory
shall remain.
  */
 public final class ProxyFactory
 {
@@ -62,10 +62,12 @@ public final class ProxyFactory
     private ConcurrentMap<OwbBean<?>, Class<?>> dependentScopedBeanProxyClasses
= new ConcurrentHashMap<OwbBean<?>, Class<?>>();    
     private ConcurrentMap<OwbBean<?>, Class<?>> interceptorProxyClasses
= new ConcurrentHashMap<OwbBean<?>, Class<?>>();
     private ConcurrentMap<ResourceBean<?, ?>, Class<?>> resourceBeanProxyClasses
= new ConcurrentHashMap<ResourceBean<?,?>, Class<?>>();
+
     // second level map is indexed on local interface
     private ConcurrentMap<OwbBean<?>, ConcurrentMap<Class<?>, Class<?>>>
ejbProxyClasses = new ConcurrentHashMap<OwbBean<?>, ConcurrentMap<Class<?>,
Class<?>>>();
     private Factory factory;
 
+
     public ProxyFactory()
     {
         this(new JavassistFactory());
@@ -89,7 +91,7 @@ public final class ProxyFactory
     }
 
 
-    public   Map<OwbBean<?>, Class<?>> getInterceptorProxyClasses()
+    private Map<OwbBean<?>, Class<?>> getInterceptorProxyClasses()
     {
         return interceptorProxyClasses;
     }
@@ -165,7 +167,11 @@ public final class ProxyFactory
 
         return proxyClass;
     }
-    
+
+
+    /**
+     * TODO rework! Still uses old proxy
+     */
     public Object createDecoratorDelegate(OwbBean<?> bean, DelegateHandler newDelegateHandler)
         throws Exception
     {
@@ -173,11 +179,11 @@ public final class ProxyFactory
         Class<?> proxyClass = this.getInterceptorProxyClasses().get(bean);
         if (proxyClass == null)
         {
-            proxyClass = createProxyClass(bean);
+            proxyClass = createProxyClassRemove(bean);
             this.getInterceptorProxyClasses().put(bean, proxyClass);
         }
 
-        final Object delegate = createProxy(proxyClass);
+        final Object delegate = createProxyRemove(proxyClass);
         setHandler(delegate, newDelegateHandler);
         return delegate;
     }
@@ -189,7 +195,7 @@ public final class ProxyFactory
             Class<?> proxyClass = resourceBeanProxyClasses.get(resourceBean);
             if (proxyClass == null)
             {
-                proxyClass = createProxyClass(resourceBean);
+                proxyClass = createProxyClassRemove(resourceBean);
 
                 Class<?> oldClazz = resourceBeanProxyClasses.putIfAbsent(resourceBean,
proxyClass);
                 if (oldClazz != null)
@@ -208,7 +214,10 @@ public final class ProxyFactory
     }
 
 
-    public  Object createNormalScopedBeanProxy(OwbBean<?> bean, CreationalContext<?>
creationalContext)
+    /**
+     * @deprecated uses old proxy
+     */
+    public  Object createNormalScopedBeanProxyRemove(OwbBean<?> bean, CreationalContext<?>
creationalContext)
     {
         Object result = null;
         try
@@ -216,16 +225,16 @@ public final class ProxyFactory
             Class<?> proxyClass = normalScopedBeanProxyClasses.get(bean);
             if (proxyClass == null)
             {
-                proxyClass = createProxyClass(bean);
+                proxyClass = createProxyClassRemove(bean);
                 normalScopedBeanProxyClasses.putIfAbsent(bean, proxyClass);
             }
 
 
-            result = createProxy(proxyClass);
+            result = createProxyRemove(proxyClass);
             
             if (!(bean instanceof WebBeansDecorator<?>) && !(bean instanceof
WebBeansInterceptorBeanPleaseRemove<?>))
             {
-                InterceptorHandlerPleaseRemove interceptorHandler = createInterceptorHandler(bean,
creationalContext);
+                InterceptorHandlerPleaseRemove interceptorHandler = createInterceptorHandlerRemove(bean,
creationalContext);
 
                 setHandler(result, interceptorHandler);
             }
@@ -238,13 +247,20 @@ public final class ProxyFactory
         return result;
     }
 
-    private Object createProxy(Class<?> proxyClass)
+
+    /**
+     * @deprecated uses old proxy
+     */
+    private Object createProxyRemove(Class<?> proxyClass)
         throws InstantiationException, IllegalAccessException
     {
         return factory.createProxy(proxyClass);
     }
 
-    private InterceptorHandlerPleaseRemove createInterceptorHandler(OwbBean<?> bean,
CreationalContext<?> creationalContext)
+    /**
+     * @deprecated uses old proxy
+     */
+    private InterceptorHandlerPleaseRemove createInterceptorHandlerRemove(OwbBean<?>
bean, CreationalContext<?> creationalContext)
     {
         String scopeClassName = bean.getScope().getName();
         Class<? extends InterceptorHandlerPleaseRemove> interceptorHandlerClass = null;
@@ -322,7 +338,10 @@ public final class ProxyFactory
         }
     }
 
-    public Object createBuildInBeanProxy(OwbBean<?> bean) 
+    /**
+     * @deprecated uses old proxy
+     */
+    public Object createBuildInBeanProxyRemove(OwbBean<?> bean)
     {
         Object result = null;
         try
@@ -330,10 +349,10 @@ public final class ProxyFactory
             Class<?> proxyClass = buildInBeanProxyClasses.get(bean);
             if (proxyClass == null)
             {
-                proxyClass = createProxyClass(bean);
+                proxyClass = createProxyClassRemove(bean);
                 buildInBeanProxyClasses.putIfAbsent(bean, proxyClass);
             }
-            result = createProxy(proxyClass);
+            result = createProxyRemove(proxyClass);
         }
         catch (Exception e)
         {
@@ -342,8 +361,11 @@ public final class ProxyFactory
         return result;
     }
 
-    
-    public  Object createDependentScopedBeanProxy(OwbBean<?> bean, Object actualInstance,
CreationalContext<?> creastionalContext)
+
+    /**
+     * @deprecated uses old proxy. And will be obsolete anyway...
+     */
+    public  Object createDependentScopedBeanProxyRemove(OwbBean<?> bean, Object actualInstance,
CreationalContext<?> creastionalContext)
     {
 
         List<InterceptorData> interceptors =  null;
@@ -408,11 +430,11 @@ public final class ProxyFactory
             Class<?> proxyClass = dependentScopedBeanProxyClasses.get(bean);
             if (proxyClass == null)
             {
-                proxyClass = createProxyClass(bean);
+                proxyClass = createProxyClassRemove(bean);
                 dependentScopedBeanProxyClasses.putIfAbsent(bean, proxyClass);
             }
 
-            Object result = createProxy(proxyClass);
+            Object result = createProxyRemove(proxyClass);
             if (!(bean instanceof WebBeansDecorator<?>) && !(bean instanceof
WebBeansInterceptorBeanPleaseRemove<?>))
             {
                 setHandler(result, new DependentScopedBeanInterceptorHandlerRemove(bean,
actualInstance, creastionalContext));
@@ -428,18 +450,24 @@ public final class ProxyFactory
         return null;
     }
 
-    public Class<?> createProxyClass(OwbBean<?> bean)
+    /**
+     * @deprecated uses old proxy
+     */
+    private Class<?> createProxyClassRemove(OwbBean<?> bean)
     {
-        final ProxyInfo info = getProxyInfo(bean);
+        final ProxyInfoRemove info = getProxyInfo(bean);
         return factory.getProxyClass(info.getSuperClass(), info.getInterfaces());
     }
 
     public Class<?> createAbstractDecoratorProxyClass(OwbBean<?> bean)
     {
-        return createProxyClass(bean);
+        return createProxyClassRemove(bean);
     }
 
-    public boolean isProxyInstance(Object o)
+    /**
+     * @deprecated uses old proxy
+     */
+    public boolean isProxyInstanceRemove(Object o)
     {
         return factory.isProxyInstance(o);
     }
@@ -450,12 +478,15 @@ public final class ProxyFactory
         return factory.createProxy(handler, interfaces);
     }
 
-    private static class ProxyInfo
+    /**
+     * @deprecated uses old proxy
+     */
+    private static class ProxyInfoRemove
     {
         private final Class<?> superClass;
         private final Class<?>[] interfaces;
 
-        private ProxyInfo(Class<?> superClass, Class<?>[] interfaces)
+        private ProxyInfoRemove(Class<?> superClass, Class<?>[] interfaces)
         {
             this.superClass = superClass;
             this.interfaces = interfaces;
@@ -472,7 +503,10 @@ public final class ProxyFactory
         }
     }
 
-    private static ProxyInfo getProxyInfo(Bean<?> bean)
+    /**
+     * @deprecated uses old proxy
+     */
+    private static ProxyInfoRemove getProxyInfo(Bean<?> bean)
     {
         final Set<Class<?>> interfaceList = new HashSet<Class<?>>();
         Class<?> superClass = null;
@@ -499,6 +533,6 @@ public final class ProxyFactory
         Class<?>[] interfaceArray = new Class<?>[interfaceList.size()];
         interfaceArray = interfaceList.toArray(interfaceArray);
 
-        return new ProxyInfo(superClass, interfaceArray);
+        return new ProxyInfoRemove(superClass, interfaceArray);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.java?rev=1433596&r1=1433595&r2=1433596&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/resolution/InterceptorResolutionServiceTest.java
Tue Jan 15 19:30:12 2013
@@ -20,6 +20,7 @@ package org.apache.webbeans.newtests.int
 
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InterceptionType;
 import javax.enterprise.util.AnnotationLiteral;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -48,6 +49,8 @@ import org.junit.Assert;
 import org.junit.Test;
 
 import static org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
+import static org.apache.webbeans.intercept.InterceptorResolutionService.BusinessMethodInterceptorInfo;
+import static org.apache.webbeans.intercept.InterceptorResolutionService.LifecycleMethodInfo;
 
 
 /**
@@ -81,15 +84,20 @@ public class InterceptorResolutionServic
 
         Assert.assertNull(interceptorInfo.getDecorators());
 
-        Map<Method, InterceptorResolutionService.BusinessMethodInterceptorInfo> methodInterceptorInfos
= interceptorInfo.getBusinessMethodsInfo();
+        Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
         Assert.assertNotNull(methodInterceptorInfos);
         Assert.assertEquals(8, methodInterceptorInfos.size());
 
-        for (InterceptorResolutionService.BusinessMethodInterceptorInfo mi : methodInterceptorInfos.values())
+        for (BusinessMethodInterceptorInfo mi : methodInterceptorInfos.values())
         {
             Assert.assertEquals(1, mi.getCdiInterceptors().length);
         }
 
+        Assert.assertEquals(2, interceptorInfo.getLifecycleMethodInterceptorInfos().size());
+        LifecycleMethodInfo lmiPostConstruct = interceptorInfo.getLifecycleMethodInterceptorInfos().get(InterceptionType.POST_CONSTRUCT);
+        Assert.assertNotNull(lmiPostConstruct);
+        Assert.assertNull(lmiPostConstruct.getMethodInterceptorInfo().getCdiInterceptors());
+
         shutDownContainer();
     }
 
@@ -122,15 +130,20 @@ public class InterceptorResolutionServic
 
         Assert.assertNull(interceptorInfo.getDecorators());
 
-        Map<Method, InterceptorResolutionService.BusinessMethodInterceptorInfo> methodInterceptorInfos
= interceptorInfo.getBusinessMethodsInfo();
+        Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
         Assert.assertNotNull(methodInterceptorInfos);
         Assert.assertEquals(7, methodInterceptorInfos.size());
 
-        for (InterceptorResolutionService.BusinessMethodInterceptorInfo mi : methodInterceptorInfos.values())
+        for (BusinessMethodInterceptorInfo mi : methodInterceptorInfos.values())
         {
             Assert.assertEquals(3, mi.getCdiInterceptors().length);
         }
 
+        Assert.assertEquals(2, interceptorInfo.getLifecycleMethodInterceptorInfos().size());
+        LifecycleMethodInfo lmiPostConstruct = interceptorInfo.getLifecycleMethodInterceptorInfos().get(InterceptionType.POST_CONSTRUCT);
+        Assert.assertNotNull(lmiPostConstruct);
+        Assert.assertNotNull(lmiPostConstruct.getMethodInterceptorInfo().getCdiInterceptors());
+
         shutDownContainer();
     }
 
@@ -161,11 +174,11 @@ public class InterceptorResolutionServic
 
         Assert.assertNull(interceptorInfo.getDecorators());
 
-        Map<Method, InterceptorResolutionService.BusinessMethodInterceptorInfo> methodInterceptorInfos
= interceptorInfo.getBusinessMethodsInfo();
+        Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
         Assert.assertNotNull(methodInterceptorInfos);
         Assert.assertEquals(2, methodInterceptorInfos.size());
 
-        for (Map.Entry<Method, InterceptorResolutionService.BusinessMethodInterceptorInfo>
mi : methodInterceptorInfos.entrySet())
+        for (Map.Entry<Method, BusinessMethodInterceptorInfo> mi : methodInterceptorInfos.entrySet())
         {
             if (mi.getKey().getName().equals("getMeaningOfLife"))
             {
@@ -233,7 +246,7 @@ public class InterceptorResolutionServic
         Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
         Assert.assertEquals(2, interceptorInfo.getBusinessMethodsInfo().size());
 
-        for (Map.Entry<Method, InterceptorResolutionService.BusinessMethodInterceptorInfo>
mi : interceptorInfo.getBusinessMethodsInfo().entrySet())
+        for (Map.Entry<Method, BusinessMethodInterceptorInfo> mi : interceptorInfo.getBusinessMethodsInfo().entrySet())
         {
             Assert.assertNotNull(mi.getValue().getEjbInterceptors());
             Assert.assertEquals(1, mi.getValue().getEjbInterceptors().length);

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureInterceptor.java?rev=1433596&r1=1433595&r2=1433596&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureInterceptor.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/intercept/webbeans/SecureInterceptor.java
Tue Jan 15 19:30:12 2013
@@ -18,11 +18,13 @@
  */
 package org.apache.webbeans.test.component.intercept.webbeans;
 
+import javax.annotation.PostConstruct;
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.Interceptor;
 import javax.interceptor.InvocationContext;
 
 import org.apache.webbeans.test.component.intercept.webbeans.bindings.Secure;
+import org.apache.webbeans.util.ExceptionUtil;
 
 @Secure
 @Interceptor
@@ -30,6 +32,19 @@ public class SecureInterceptor
 {
     public static boolean CALL = false;
 
+    @PostConstruct
+    public void atCreationTime(InvocationContext ic)
+    {
+        try
+        {
+            ic.proceed();
+        }
+        catch (Exception e)
+        {
+            ExceptionUtil.throwAsRuntimeException(e);
+        }
+    }
+
     @AroundInvoke
     public Object manageTransaction(InvocationContext ctx) throws Exception
     {



Mime
View raw message