openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1607187 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/annotation/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/deployment/ webbeans-impl/src/main/java/o...
Date Tue, 01 Jul 2014 21:16:11 GMT
Author: rmannibucau
Date: Tue Jul  1 21:16:11 2014
New Revision: 1607187

URL: http://svn.apache.org/r1607187
Log:
supporting default naming of beans using event.addStereotype(..., NamedLitteral.INSTANCE)

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java
    openwebbeans/trunk/webbeans-tck/testng-dev.xml

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java?rev=1607187&r1=1607186&r2=1607187&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/AnnotationManager.java
Tue Jul  1 21:16:11 2014
@@ -21,6 +21,7 @@ package org.apache.webbeans.annotation;
 import org.apache.webbeans.component.AbstractOwbBean;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 
 import javax.enterprise.inject.spi.DefinitionException;
@@ -459,7 +460,7 @@ public final class AnnotationManager
 
         boolean result = false;
 
-        if (clazz.isAnnotationPresent(Stereotype.class))
+        if (clazz.isAnnotationPresent(Stereotype.class) || webBeansContext.getStereoTypeManager().getStereoTypeModel(clazz.getName())
!= null)
         {
             result = true;
         }
@@ -598,6 +599,11 @@ public final class AnnotationManager
             {
                 return true;
             }
+            final IStereoTypeModel model = webBeansContext.getStereoTypeManager().getStereoTypeModel(ann.getName());
+            if (model != null && model.isNamed())
+            {
+                return true;
+            }
         }
 
         return false;
@@ -639,6 +645,8 @@ public final class AnnotationManager
                 }
             }
         }
+
+        checkedStereotypeAnnotations.remove(clazz);
     }
 
     public void checkInterceptorResolverParams(Annotation... interceptorBindings)

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=1607187&r1=1607186&r2=1607187&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
Tue Jul  1 21:16:11 2014
@@ -41,6 +41,7 @@ import org.apache.webbeans.container.Inj
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.corespi.se.DefaultJndiService;
 import org.apache.webbeans.decorator.DecoratorsManager;
+import org.apache.webbeans.deployment.StereoTypeManager;
 import org.apache.webbeans.deployment.StereoTypeModel;
 import org.apache.webbeans.event.ObserverMethodImpl;
 import org.apache.webbeans.event.OwbObserverMethod;
@@ -1201,16 +1202,18 @@ public class BeansDeployer
         Set<Class<?>> beanClasses = scanner.getBeanClasses();
         if (beanClasses != null && beanClasses.size() > 0)
         {
+            final StereoTypeManager stereoTypeManager = webBeansContext.getStereoTypeManager();
             for(Class<?> beanClass : beanClasses)
             {                
                 if(beanClass.isAnnotation())
                 {
                     Class<? extends Annotation> stereoClass = (Class<? extends Annotation>)
beanClass;
-                    if (annotationManager.isStereoTypeAnnotation(stereoClass))
+                    if (annotationManager.isStereoTypeAnnotation(stereoClass)
+                        && stereoTypeManager.getStereoTypeModel(stereoClass.getName())
== null)
                     {
                         webBeansContext.getAnnotationManager().checkStereoTypeClass(stereoClass,
stereoClass.getDeclaredAnnotations());
                         StereoTypeModel model = new StereoTypeModel(webBeansContext, stereoClass);
-                        webBeansContext.getStereoTypeManager().addStereoTypeModel(model);
+                        stereoTypeManager.addStereoTypeModel(model);
                     }
                 }
             }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java?rev=1607187&r1=1607186&r2=1607187&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
Tue Jul  1 21:16:11 2014
@@ -65,6 +65,8 @@ public class StereoTypeModel implements 
     
     private static final Logger logger = WebBeansLoggerFacade.getLogger(StereoTypeModel.class);
 
+    private boolean named;
+
     /**
      * Creates a new instance of the stereotype model for
      * given class.
@@ -113,6 +115,10 @@ public class StereoTypeModel implements 
                         logger.log(Level.WARNING, OWBLogConst.WARN_0017, WebBeansLoggerFacade.args(clazz.getName(),qualifier.annotationType().getName()));
                     }
                 }
+                else if (!named)
+                {
+                    named = true;
+                }
             }            
         }
         
@@ -268,4 +274,9 @@ public class StereoTypeModel implements 
     {
         return name.hashCode();
     }
+
+    public boolean isNamed()
+    {
+        return named;
+    }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java?rev=1607187&r1=1607186&r2=1607187&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/stereotype/IStereoTypeModel.java
Tue Jul  1 21:16:11 2014
@@ -67,4 +67,5 @@ public interface IStereoTypeModel
      */
     public Set<Annotation> getInheritedStereoTypes();
 
+    boolean isNamed();
 }

Modified: openwebbeans/trunk/webbeans-tck/testng-dev.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tck/testng-dev.xml?rev=1607187&r1=1607186&r2=1607187&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tck/testng-dev.xml (original)
+++ openwebbeans/trunk/webbeans-tck/testng-dev.xml Tue Jul  1 21:16:11 2014
@@ -19,7 +19,7 @@
   <test name="JSR-346 TCK">
     <classes>
       <class
-          name="org.jboss.cdi.tck.tests.extensions.beanManager.el.WrapExpressionFactoryTest"
/>
+          name="org.jboss.cdi.tck.tests.extensions.stereotype.StereotypeExtensionTest" />
     </classes>
     <groups>
       <run>



Mime
View raw message