openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r915912 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/decorator/ main/java/org/apache/webbeans/util/ test/java/org/apache/webbeans/newtests/specalization/ test/java/org/apache/webbeans/test/
Date Wed, 24 Feb 2010 18:28:20 GMT
Author: gerdogdu
Date: Wed Feb 24 18:28:19 2010
New Revision: 915912

URL: http://svn.apache.org/viewvc?rev=915912&view=rev
Log:
Update while testing TCK standalon

Removed:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/specalization/AlternativeSpecializesProducer.xml
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java?rev=915912&r1=915911&r2=915912&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
Wed Feb 24 18:28:19 2010
@@ -25,6 +25,7 @@
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.Decorator;
 
+import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.component.ManagedBean;
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.container.BeanManagerImpl;
@@ -84,21 +85,24 @@
         
     }
    
-    public static void checkManagedBeanDecoratorConditions(ManagedBean<?> component)
+    public static void checkManagedBeanDecoratorConditions(AbstractInjectionTargetBean<?>
bean, List<Decorator<?>> decoratorList)
     {
-        Asserts.assertNotNull("component", "component parameter can not be null");
+        Asserts.assertNotNull("bean", "bean parameter can not be null");
 
-        Set<Annotation> annSet = component.getQualifiers();
+        Set<Annotation> annSet = bean.getQualifiers();
         Annotation[] anns = new Annotation[annSet.size()];
         anns = annSet.toArray(anns);
 
-        List<Decorator<?>> decoratorList = BeanManagerImpl.getManager().resolveDecorators(component.getTypes(),
anns);
+        if(decoratorList == null)
+        {
+            decoratorList = BeanManagerImpl.getManager().resolveDecorators(bean.getTypes(),
anns);   
+        }
         if (!decoratorList.isEmpty())
         {
-            Class<?> clazz = component.getReturnType();
+            Class<?> clazz = bean.getReturnType();
             if (ClassUtil.isFinal(clazz.getModifiers()))
             {
-                throw new WebBeansConfigurationException("Managed Bean : " + component.getReturnType().getName()
+ " can not be declared final, because it has one or more decorators");
+                throw new WebBeansConfigurationException("Bean : " + bean.getReturnType().getName()
+ " can not be declared final, because it has one or more decorators");
             }
 
             Method[] methods = clazz.getDeclaredMethods();
@@ -118,7 +122,7 @@
                         {
                             if (decClazz.getMethod(method.getName(), method.getParameterTypes())
!= null)
                             {
-                                throw new WebBeansConfigurationException("Managed Bean :
" + component.getReturnType().getName() + " can not define non-private, non-static, final
method : " + method.getName() + ", because one of its decorators implements this method");
+                                throw new WebBeansConfigurationException("Bean : " + bean.getReturnType().getName()
+ " can not define non-private, non-static, final method : " + method.getName() + ", because
one of its decorators implements this method");
 
                             }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java?rev=915912&r1=915911&r2=915912&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
Wed Feb 24 18:28:19 2010
@@ -65,12 +65,17 @@
         anns = qualifiers.toArray(anns);
 
         List<Decorator<?>> decoratorList = BeanManagerImpl.getManager().resolveDecorators(component.getTypes(),
anns);
-        Iterator<Decorator<?>> itList = decoratorList.iterator();
-
-        while (itList.hasNext())
+        
+        if(decoratorList != null && !decoratorList.isEmpty())
         {
-            WebBeansDecorator<?> decorator = (WebBeansDecorator<?>) itList.next();
           
-            component.getDecoratorStack().add(decorator);            
+            DecoratorUtil.checkManagedBeanDecoratorConditions(component, decoratorList);
+            Iterator<Decorator<?>> itList = decoratorList.iterator();
+
+            while (itList.hasNext())
+            {
+                WebBeansDecorator<?> decorator = (WebBeansDecorator<?>) itList.next();
           
+                component.getDecoratorStack().add(decorator);            
+            }            
         }
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java?rev=915912&r1=915911&r2=915912&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
Wed Feb 24 18:28:19 2010
@@ -770,9 +770,7 @@
         managedBeanCreator.defineObserverMethods();
         DefinitionUtil.defineDecoratorStack(managedBean);
         DefinitionUtil.defineBeanInterceptorStack(managedBean);
-                                
-        
-        DecoratorUtil.checkManagedBeanDecoratorConditions(managedBean);
+                                        
         managedBeanCreator.defineDisposalMethods();//Define disposal method after adding
producers
         
         return managedBean;

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=915912&r1=915911&r2=915912&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
Wed Feb 24 18:28:19 2010
@@ -2899,7 +2899,6 @@
         beanManager.addBean(WebBeansUtil.createNewBean(managedBean));                
         if(!WebBeansAnnotatedTypeUtil.isAnnotatedTypeDecoratorOrInterceptor(annotatedType))
         {
-            DecoratorUtil.checkManagedBeanDecoratorConditions(managedBean);
             beanManager.addBean(managedBean);
             for (ProducerMethodBean<?> producerMethod : producerMethods)
             {

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java?rev=915912&r1=915911&r2=915912&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
Wed Feb 24 18:28:19 2010
@@ -315,7 +315,7 @@
         if (bean != null)
         {
             manager.addBean(WebBeansUtil.createNewBean(bean));
-            DecoratorUtil.checkManagedBeanDecoratorConditions(bean);
+            DecoratorUtil.checkManagedBeanDecoratorConditions(bean,null);
             WebBeansDecoratorConfig.configureDecarotors(bean);
             DefinitionUtil.defineBeanInterceptorStack(bean);
 



Mime
View raw message