openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1429500 - in /openwebbeans/trunk: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/ webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src...
Date Sun, 06 Jan 2013 11:57:34 GMT
Author: arne
Date: Sun Jan  6 11:57:33 2013
New Revision: 1429500

URL: http://svn.apache.org/viewvc?rev=1429500&view=rev
Log:
OWB-745: moved DefinitionUtil.defineName to AbstractBeanCreator

Modified:
    openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.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-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java?rev=1429500&r1=1429499&r2=1429500&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
(original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
Sun Jan  6 11:57:33 2013
@@ -49,7 +49,6 @@ import org.apache.webbeans.portable.even
 import org.apache.webbeans.portable.events.ProcessProducerImpl;
 import org.apache.webbeans.portable.events.ProcessSessionBeanImpl;
 import org.apache.webbeans.portable.events.generics.GProcessSessionBean;
-import org.apache.webbeans.util.WebBeansUtil;
 
 @SuppressWarnings("unchecked")
 public final class EjbUtility
@@ -82,7 +81,7 @@ public final class EjbUtility
         ejbBeanCreator.defineStereoTypes();
         ejbBeanCreator.defineApiType();
         ejbBeanCreator.defineScopeType("Session Bean implementation class : " + clazz.getName()
+ " stereotypes must declare same @ScopeType annotations", false);
-        ejbBeanCreator.defineName(WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
           
+        ejbBeanCreator.defineName();            
         ejbBeanCreator.defineQualifiers();
         Set<ProducerMethodBean<?>> producerMethodBeans = ejbBeanCreator.defineProducerMethods();
       
         checkProducerMethods(producerMethodBeans, ejbBean);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java?rev=1429500&r1=1429499&r2=1429500&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
Sun Jan  6 11:57:33 2013
@@ -106,6 +106,49 @@ public class AbstractBeanCreator<T> impl
         }
     }
 
+    public void defineName(String name)
+    {
+        Annotation[] anns = AnnotationUtil.getAnnotationsFromSet(getAnnotated().getAnnotations());
+        Named nameAnnot = null;
+        boolean isDefault = false;
+        for (Annotation ann : anns)
+        {
+            if (ann.annotationType().equals(Named.class))
+            {
+                nameAnnot = (Named) ann;
+                break;
+            }
+        }
+
+        if (nameAnnot == null) // no @Named
+        {
+            // Check for stereottype
+            if (getBean().getWebBeansContext().getAnnotationManager().hasNamedOnStereoTypes(getBean()))
+            {
+                isDefault = true;
+            }
+
+        }
+        else
+        // yes @Named
+        {
+            if (nameAnnot.value().equals(""))
+            {
+                isDefault = true;
+            }
+            else
+            {
+                getBean().setName(nameAnnot.value());
+            }
+
+        }
+
+        if (isDefault)
+        {
+            getBean().setName(name);
+        }
+    }
+
     /**
      * {@inheritDoc}
      */

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java?rev=1429500&r1=1429499&r2=1429500&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java
Sun Jan  6 11:57:33 2013
@@ -88,10 +88,9 @@ public abstract class AbstractInjecionTa
     /**
      * {@inheritDoc}
      */
-    public void defineName(String defaultName)
+    public void defineName()
     {
-        webBeansContext.getDefinitionUtil().defineName(getBean(), AnnotationUtil.getAnnotationsFromSet(getAnnotated().getAnnotations()),
-                    WebBeansUtil.getManagedBeanDefaultName(getAnnotated().getJavaClass().getSimpleName()));
+        defineName(WebBeansUtil.getManagedBeanDefaultName(getAnnotated().getJavaClass().getSimpleName()));
     }
 
     /**
@@ -410,7 +409,7 @@ public abstract class AbstractInjecionTa
                                                                                         
    producerFieldBean.getScope());
                     WebBeansUtil.checkProducerGenericType(producerFieldBean,annotatedField.getJavaMember());
                     producerFieldBeanCreator.defineQualifiers();
-                    definitionUtil.defineName(producerFieldBean, anns, WebBeansUtil.getProducerDefaultName(annotatedField.getJavaMember().getName()));
+                    producerFieldBeanCreator.defineName(WebBeansUtil.getProducerDefaultName(annotatedField.getJavaMember().getName()));
                     
                     producerBeans.add(producerFieldBean);
                 }
@@ -480,9 +479,7 @@ public abstract class AbstractInjecionTa
                 webBeansContext.getWebBeansUtil().checkUnproxiableApiType(producerMethodBean,
                                                                                         
producerMethodBean.getScope());
                 WebBeansUtil.checkProducerGenericType(producerMethodBean,annotatedMethod.getJavaMember());
-                definitionUtil.defineName(producerMethodBean,
-                                          AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
-                                                                               WebBeansUtil.getProducerDefaultName(annotatedMethod.getJavaMember().getName()));
+                producerMethodBeanCreator.defineName(WebBeansUtil.getProducerDefaultName(annotatedMethod.getJavaMember().getName()));
                 producerMethodBeanCreator.defineQualifiers();
                 
                 producerMethodBeanCreator.addMethodInjectionPointMetaData(annotatedMethod);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java?rev=1429500&r1=1429499&r2=1429500&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
Sun Jan  6 11:57:33 2013
@@ -157,7 +157,7 @@ public class ManagedBeanCreatorImpl<T> e
         webBeansContext.getWebBeansUtil().setInjectionTargetBeanEnableFlag(managedBean);
 
         checkCreateConditions();
-        defineName(WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
+        defineName();
         defineQualifiers();
 
         if (managedBean.isFullInit())

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=1429500&r1=1429499&r2=1429500&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
Sun Jan  6 11:57:33 2013
@@ -18,13 +18,11 @@
  */
 package org.apache.webbeans.config;
 
-import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.util.ArrayList;
 import java.util.List;
 
 import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Named;
 
 import org.apache.webbeans.annotation.AnnotationManager;
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
@@ -51,55 +49,6 @@ public final class DefinitionUtil
     }
 
     /**
-     * Configure web beans component name.
-     * 
-     * @param component configuring web beans component
-     * @param defaultName default name of the web bean
-     */
-    public <T> void defineName(AbstractOwbBean<T> component, Annotation[] anns,
String defaultName)
-    {
-        Named nameAnnot = null;
-        boolean isDefault = false;
-        for (Annotation ann : anns)
-        {
-            if (ann.annotationType().equals(Named.class))
-            {
-                nameAnnot = (Named) ann;
-                break;
-            }
-        }
-
-        if (nameAnnot == null) // no @Named
-        {
-            // Check for stereottype
-            if (webBeansContext.getAnnotationManager().hasNamedOnStereoTypes(component))
-            {
-                isDefault = true;
-            }
-
-        }
-        else
-        // yes @Named
-        {
-            if (nameAnnot.value().equals(""))
-            {
-                isDefault = true;
-            }
-            else
-            {
-                component.setName(nameAnnot.value());
-            }
-
-        }
-
-        if (isDefault)
-        {
-            component.setName(defaultName);
-        }
-
-    }
-
-    /**
      * Configure bean instance interceptor stack.
      * @param bean bean instance
      */

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=1429500&r1=1429499&r2=1429500&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
Sun Jan  6 11:57:33 2013
@@ -2438,7 +2438,7 @@ public final class WebBeansUtil
         //Check for Enabled via Alternative
         setInjectionTargetBeanEnableFlag(managedBeanCreator.getBean());
         managedBeanCreator.checkCreateConditions();
-        managedBeanCreator.defineName(WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
+        managedBeanCreator.defineName();
         managedBeanCreator.defineQualifiers();
         managedBeanCreator.defineConstructor();
         managedBeanCreator.defineProducerMethods();
@@ -2583,7 +2583,7 @@ public final class WebBeansUtil
         //Check for Enabled via Alternative
         setInjectionTargetBeanEnableFlag(managedBeanCreator.getBean());
         managedBeanCreator.checkCreateConditions();
-        managedBeanCreator.defineName(getManagedBeanDefaultName(clazz.getSimpleName()));
+        managedBeanCreator.defineName();
         managedBeanCreator.defineQualifiers();
         managedBeanCreator.defineConstructor();
         managedBeanCreator.defineProducerMethods();

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=1429500&r1=1429499&r2=1429500&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
Sun Jan  6 11:57:33 2013
@@ -543,7 +543,7 @@ public abstract class TestContext implem
         component.setFullInit(true);
 
         WebBeansUtil.checkGenericType(component);
-        definitionUtil.defineName(component, clazzAnns, WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
+        managedBeanCreator.defineName();
         managedBeanCreator.defineQualifiers();
 
         Constructor<T> constructor = webBeansContext.getWebBeansUtil().defineConstructor(clazz);



Mime
View raw message