openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1629213 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ManagedBean.java config/BeansDeployer.java container/InjectionTargetFactoryImpl.java
Date Fri, 03 Oct 2014 14:43:27 GMT
Author: rmannibucau
Date: Fri Oct  3 14:43:26 2014
New Revision: 1629213

URL: http://svn.apache.org/r1629213
Log:
creating our interceptor info even when injection target is wrapped

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java

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=1629213&r1=1629212&r2=1629213&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
Fri Oct  3 14:43:26 2014
@@ -26,6 +26,7 @@ import javax.enterprise.inject.spi.Passi
 
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.portable.InjectionTargetImpl;
 
 /**
  * Managed bean implementation of the {@link javax.enterprise.inject.spi.Bean}.
@@ -34,6 +35,9 @@ import org.apache.webbeans.context.creat
  */
 public class ManagedBean<T> extends InjectionTargetBean<T> implements InterceptedMarker,
PassivationCapable
 {
+    // just needed in BeansDeployer
+    private InjectionTargetImpl<T> originalInjectionTarget; // don't do = null!
+
     public ManagedBean(WebBeansContext webBeansContext,
                        WebBeansType webBeansType,
                        AnnotatedType<T> annotated,
@@ -65,4 +69,14 @@ public class ManagedBean<T> extends Inje
             creationalContextImpl.putBean(oldBean);
         }
     }
+
+    public void setOriginalInjectionTarget(final InjectionTargetImpl<T> originalInjectionTarget)
+    {
+        this.originalInjectionTarget = originalInjectionTarget;
+    }
+
+    public InjectionTargetImpl<T> getOriginalInjectionTarget()
+    {
+        return originalInjectionTarget;
+    }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1629213&r1=1629212&r2=1629213&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Fri Oct  3 14:43:26 2014
@@ -699,10 +699,19 @@ public class BeansDeployer
                 
                 if (bean instanceof OwbBean && !(bean instanceof Interceptor) &&
!(bean instanceof Decorator))
                 {
+                    AbstractProducer<T> producer = null;
+
                     OwbBean<T> owbBean = (OwbBean<T>)bean;
-                    if (owbBean.getProducer() instanceof AbstractProducer)
+                    if (ManagedBean.class.isInstance(bean)) // in this case don't use producer
which can be wrapped
+                    {
+                        producer = ManagedBean.class.cast(bean).getOriginalInjectionTarget();
+                    }
+                    if (producer == null && owbBean.getProducer() instanceof AbstractProducer)
+                    {
+                        producer = (AbstractProducer<T>)owbBean.getProducer();
+                    }
+                    if (producer != null)
                     {
-                        AbstractProducer<T> producer = (AbstractProducer<T>)owbBean.getProducer();
                         AnnotatedType<T> annotatedType;
                         if (owbBean instanceof InjectionTargetBean)
                         {

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=1629213&r1=1629212&r2=1629213&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
Fri Oct  3 14:43:26 2014
@@ -19,6 +19,8 @@
 package org.apache.webbeans.container;
 
 import javax.enterprise.inject.spi.InjectionTargetFactory;
+
+import org.apache.webbeans.component.ManagedBean;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.portable.InjectionTargetImpl;
 import org.apache.webbeans.util.Asserts;
@@ -58,6 +60,10 @@ public class InjectionTargetFactoryImpl<
     {
         final InjectionTargetImpl<T> injectionTarget
             = new InjectionTargetImpl<T>(annotatedType, createInjectionPoints(bean),
webBeansContext, getPostConstructMethods(), getPreDestroyMethods());
+        if (ManagedBean.class.isInstance(bean))
+        {
+            ManagedBean.class.cast(bean).setOriginalInjectionTarget(injectionTarget);
+        }
         return webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEvent(injectionTarget,
annotatedType).getInjectionTarget();
     }
 



Mime
View raw message