openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1646933 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/BeansDeployer.java portable/events/discovery/AfterTypeDiscoveryImpl.java
Date Sat, 20 Dec 2014 09:18:36 GMT
Author: rmannibucau
Date: Sat Dec 20 09:18:36 2014
New Revision: 1646933

URL: http://svn.apache.org/r1646933
Log:
ensuring we add new AnnotatedType added through fterTypeDiscovery

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.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=1646933&r1=1646932&r2=1646933&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
Sat Dec 20 09:18:36 2014
@@ -110,6 +110,7 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -228,11 +229,11 @@ public class BeansDeployer
                 List<AnnotatedType<?>> annotatedTypes = annotatedTypesFromClassPath(scanner);
 
                 //Deploy additional Annotated Types
-                addAdditionalAnnotatedTypes(annotatedTypes);
+                addAdditionalAnnotatedTypes(webBeansContext.getBeanManagerImpl().getAdditionalAnnotatedTypes(),
annotatedTypes);
 
                 registerAlternativesDecoratorsAndInterceptorsWithPriority(annotatedTypes);
 
-                fireAfterTypeDiscoveryEvent();
+                addAdditionalAnnotatedTypes(fireAfterTypeDiscoveryEvent(), annotatedTypes);
 
                 // Handle Specialization
                 removeSpecializedTypes(annotatedTypes);
@@ -586,11 +587,13 @@ public class BeansDeployer
     /**
      * Fires event after bean discovery.
      */
-    private void fireAfterTypeDiscoveryEvent()
+    private final List<AnnotatedType<?>> fireAfterTypeDiscoveryEvent()
     {
         final BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+        final List<AnnotatedType<?>> newAt = new LinkedList<AnnotatedType<?>>();
         manager.fireLifecycleEvent(new AfterTypeDiscoveryImpl(
                 webBeansContext,
+                newAt,
                 webBeansContext.getInterceptorsManager().getPrioritizedInterceptors(),
                 webBeansContext.getDecoratorsManager().getPrioritizedDecorators(),
                 webBeansContext.getAlternativesManager().getPrioritizedAlternatives()));
@@ -599,6 +602,7 @@ public class BeansDeployer
 
         webBeansContext.getWebBeansUtil().inspectErrorStack(
             "There are errors that are added by AfterTypeDiscovery event observers. Look
at logs for further details");
+        return newAt;
     }
 
     /**
@@ -943,14 +947,11 @@ public class BeansDeployer
      * Process any AnnotatedTypes which got added by BeforeBeanDiscovery#addAnnotatedType
      * @param annotatedTypes
      */
-    private void addAdditionalAnnotatedTypes(List<AnnotatedType<?>> annotatedTypes)
+    private void addAdditionalAnnotatedTypes(Collection<AnnotatedType<?>> toDeploy,
List<AnnotatedType<?>> annotatedTypes)
     {
         BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
 
-
-        Collection<AnnotatedType<?>> additionalAnnotatedTypes = beanManager.getAdditionalAnnotatedTypes();
-
-        for (AnnotatedType<?> annotatedType : additionalAnnotatedTypes)
+        for (AnnotatedType<?> annotatedType : toDeploy)
         {
             // Fires ProcessAnnotatedType
             ProcessSyntheticAnnotatedTypeImpl<?> processAnnotatedEvent = !annotatedType.getJavaClass().isAnnotation()
?

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java?rev=1646933&r1=1646932&r2=1646933&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
Sat Dec 20 09:18:36 2014
@@ -34,14 +34,17 @@ public class AfterTypeDiscoveryImpl impl
     private final List<Class<?>> sortedAlternatives;
     private final List<Class<?>> sortedInterceptors;
     private final List<Class<?>> sortedDecorators;
+    private final List<AnnotatedType<?>> newAt;
     private Object extension;
 
     public AfterTypeDiscoveryImpl(WebBeansContext webBeansContext,
+                                  List<AnnotatedType<?>> newAt,
                                   List<Class<?>> sortedInterceptors,
                                   List<Class<?>> sortedDecorators,
                                   List<Class<?>> sortedAlternatives)
     {
         this.webBeansContext = webBeansContext;
+        this.newAt = newAt;
         this.sortedAlternatives = sortedAlternatives;
         this.sortedInterceptors = sortedInterceptors;
         this.sortedDecorators = sortedDecorators;
@@ -68,8 +71,8 @@ public class AfterTypeDiscoveryImpl impl
     @Override
     public void addAnnotatedType(AnnotatedType<?> type, String id)
     {
-        //X TODO evaluate and file Extension
         webBeansContext.getBeanManagerImpl().addAdditionalAnnotatedType(extension, type,
id);
+        newAt.add(type);
     }
 
     @Override



Mime
View raw message