Author: struberg
Date: Mon Apr 18 11:47:35 2011
New Revision: 1094503
URL: http://svn.apache.org/viewvc?rev=1094503&view=rev
Log:
OWB-566 postpone sending ProcessInjectionTargetEvent for ManagedBeans
this event must only be fired after all the ManagedBean creation
has been performed.
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
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=1094503&r1=1094502&r2=1094503&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
Mon Apr 18 11:47:35 2011
@@ -67,6 +67,7 @@ import org.apache.webbeans.portable.even
import org.apache.webbeans.portable.events.discovery.AfterBeanDiscoveryImpl;
import
org.apache.webbeans.portable.events.discovery.AfterDeploymentValidationImpl;
import org.apache.webbeans.portable.events.discovery.BeforeBeanDiscoveryImpl;
+import org.apache.webbeans.portable.events.generics.GProcessInjectionTarget;
import org.apache.webbeans.spi.JNDIService;
import org.apache.webbeans.spi.ScannerService;
import org.apache.webbeans.spi.plugins.OpenWebBeansJavaEEPlugin;
@@ -791,7 +792,7 @@ public class BeansDeployer
//Temporary managed bean instance creationa
ManagedBean<T> managedBean = new
ManagedBean<T>(clazz,WebBeansType.MANAGED, webBeansContext);
ManagedBeanCreatorImpl<T> managedBeanCreator = new
ManagedBeanCreatorImpl<T>(managedBean);
-
+
boolean annotationTypeSet = false;
if(processAnnotatedEvent.isSet())
{
@@ -799,15 +800,16 @@ public class BeansDeployer
managedBean.setAnnotatedType(annotatedType);
managedBeanCreator.setAnnotatedType(annotatedType);
managedBeanCreator.setMetaDataProvider(MetaDataProvider.THIRDPARTY);
- }
-
- //If ProcessInjectionTargetEvent is not set, set it
+ }
+
+ GProcessInjectionTarget processInjectionTarget = null;
if(processInjectionTargetEvent == null)
{
- processInjectionTargetEvent =
-
webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEvent(managedBean);
- }
-
+ processInjectionTarget =
webBeansContext.getWebBeansUtil().createProcessInjectionTargetEvent(managedBean);
+ processInjectionTargetEvent = processInjectionTarget;
+ }
+
+
//Decorator
if(WebBeansUtil.isAnnotatedTypeDecorator(annotatedType))
{
@@ -857,7 +859,12 @@ public class BeansDeployer
webBeansContext.getWebBeansUtil().defineManagedBean(managedBeanCreator,
processInjectionTargetEvent, true);
}
-
+
+ if(processInjectionTarget != null)
+ {
+
webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEvent(processInjectionTarget);
+ }
+
return true;
}
else
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1094503&r1=1094502&r2=1094503&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Mon Apr 18 11:47:35 2011
@@ -2163,18 +2163,29 @@ public final class WebBeansUtil
*/
public <T> GProcessInjectionTarget
fireProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
{
- AnnotatedType<T> annotatedType =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(bean.getReturnType());
- InjectionTargetProducer<T> injectionTarget = new
InjectionTargetProducer<T>(bean);
- GProcessInjectionTarget processInjectionTargetEvent = new
GProcessInjectionTarget(injectionTarget,
-
annotatedType);
+ GProcessInjectionTarget processInjectionTargetEvent =
createProcessInjectionTargetEvent(bean);
+ return fireProcessInjectionTargetEvent(processInjectionTargetEvent);
+
+ }
+
+ public GProcessInjectionTarget
fireProcessInjectionTargetEvent(GProcessInjectionTarget
processInjectionTargetEvent)
+ {
//Fires ProcessInjectionTarget
webBeansContext.getBeanManagerImpl().fireEvent(processInjectionTargetEvent,
AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
return processInjectionTargetEvent;
+ }
+ public <T> GProcessInjectionTarget
createProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
+ {
+ AnnotatedType<T> annotatedType =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(bean.getReturnType());
+ InjectionTargetProducer<T> injectionTarget = new
InjectionTargetProducer<T>(bean);
+ return new GProcessInjectionTarget(injectionTarget,
+
annotatedType);
}
+
/**
* Returns <code>ProcessInjectionTarget</code> event.
* @param <T> bean type
@@ -2187,9 +2198,7 @@ public final class WebBeansUtil
GProcessInjectionTarget processInjectionTargetEvent = new
GProcessInjectionTarget(injectionTarget,annotatedType);
//Fires ProcessInjectionTarget
-
webBeansContext.getBeanManagerImpl().fireEvent(processInjectionTargetEvent,
AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
-
- return processInjectionTargetEvent;
+ return fireProcessInjectionTargetEvent(processInjectionTargetEvent);
}