openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1429265 - 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 Sat, 05 Jan 2013 11:43:18 GMT
Author: arne
Date: Sat Jan  5 11:43:18 2013
New Revision: 1429265

URL: http://svn.apache.org/viewvc?rev=1429265&view=rev
Log:
OWB-745: Removed DefinitionUtil.defineProducerMethods

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/AbstractInjecionTargetBeanCreator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.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=1429265&r1=1429264&r2=1429265&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
Sat Jan  5 11:43:18 2013
@@ -37,7 +37,6 @@ import javax.enterprise.inject.spi.Produ
 import org.apache.webbeans.component.ProducerFieldBean;
 import org.apache.webbeans.component.ProducerMethodBean;
 import org.apache.webbeans.component.creation.BeanCreator.MetaDataProvider;
-import org.apache.webbeans.config.DefinitionUtil;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.ejb.common.component.BaseEjbBean;
@@ -51,6 +50,7 @@ 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.WebBeansAnnotatedTypeUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
 @SuppressWarnings("unchecked")
@@ -184,11 +184,11 @@ public final class EjbUtility
 
         final AnnotatedType<T> annotatedType = annotatedElementFactory.newAnnotatedType(clazz);
 
-        final DefinitionUtil util = webBeansContext.getDefinitionUtil();
+        final WebBeansAnnotatedTypeUtil util = webBeansContext.getAnnotatedTypeUtil();
 
-        final Set<ProducerMethodBean<?>> producerMethodBeans = util.defineProducerMethods(ejbBean,
clazz);
+        final Set<ProducerMethodBean<?>> producerMethodBeans = util.defineProducerMethods(ejbBean,
annotatedType);
 
-        final Set<ProducerFieldBean<?>> producerFieldBeans = webBeansContext.getAnnotatedTypeUtil().defineProducerFields(ejbBean,
annotatedType);
+        final Set<ProducerFieldBean<?>> producerFieldBeans = util.defineProducerFields(ejbBean,
annotatedType);
 
         checkProducerMethods(producerMethodBeans, ejbBean);
 
@@ -233,7 +233,7 @@ public final class EjbUtility
         manager.getBeans().addAll(producerMethodBeans);
         manager.getBeans().addAll(producerFieldBeans);
 
-        webBeansContext.getAnnotatedTypeUtil().defineDisposalMethods(ejbBean, ejbBean.getAnnotatedType());
+        util.defineDisposalMethods(ejbBean, ejbBean.getAnnotatedType());
 
     }
 

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=1429265&r1=1429264&r2=1429265&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
Sat Jan  5 11:43:18 2013
@@ -96,15 +96,7 @@ public abstract class AbstractInjecionTa
      */
     public Set<ProducerMethodBean<?>> defineProducerMethods()
     {
-        AbstractInjectionTargetBean bean = getBean();
-        if(isDefaultMetaDataProvider())
-        {
-            return bean.getWebBeansContext().getDefinitionUtil().defineProducerMethods(bean);
-        }
-        else
-        {
-            return bean.getWebBeansContext().getAnnotatedTypeUtil().defineProducerMethods(bean,
getAnnotatedType());
-        }
+        return webBeansContext.getAnnotatedTypeUtil().defineProducerMethods(getBean(), getAnnotatedType());
     }
     
     /**

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=1429265&r1=1429264&r2=1429265&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
Sat Jan  5 11:43:18 2013
@@ -610,113 +610,6 @@ public final class DefinitionUtil
     }
 
     /**
-     * Defines the {@link Bean} producer methods. Moreover, it configures the
-     * producer methods with using the {@link Produces} annotations.
-     * 
-     * @param component
-     * @return the set of producer components
-     * @throws WebBeansConfigurationException if any exception occurs
-     */
-    public Set<ProducerMethodBean<?>> defineProducerMethods(AbstractInjectionTargetBean<?>
component)
-    {
-        Asserts.assertNotNull(component, "component parameter can not be null");
-
-        Class<?> clazz = component.getReturnType();
-
-        return defineProducerMethods(component, clazz);
-    }
-
-    public Set<ProducerMethodBean<?>> defineProducerMethods(AbstractInjectionTargetBean<?>
component, Class<?> clazz)
-    {
-        Method[] declaredMethods = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(clazz);
-
-        Set<ProducerMethodBean<?>> producerComponents = new HashSet<ProducerMethodBean<?>>();
-
-        // This methods defined in the class
-        for (Method declaredMethod : declaredMethods)
-        {
-            createProducerComponents(component, producerComponents, declaredMethod, clazz);
-        }
-
-        return producerComponents;
-    }
-
-    private <T> void createProducerComponents(InjectionTargetBean<T> component,
Set<ProducerMethodBean<?>> producerComponents,
-                                                     Method declaredMethod, Class<?>
clazz)
-    {
-        boolean isSpecializes = false;
-        
-        // Producer Method
-        if (AnnotationUtil.hasMethodAnnotation(declaredMethod, Produces.class))
-        {
-            WebBeansUtil.checkProducerMethodForDeployment(declaredMethod, clazz.getName());
-
-            if (AnnotationUtil.hasMethodAnnotation(declaredMethod, Specializes.class))
-            {
-                if (Modifier.isStatic(declaredMethod.getModifiers()))
-                {
-                    throw new WebBeansConfigurationException("Specializing producer method
: " + declaredMethod.getName()
-                                                             + " in class : " + clazz.getName()
-                                                             + " can not be static");
-                }
-
-                isSpecializes = true;
-            }
-
-            ProducerMethodBean<?> newComponent = createProducerComponent(declaredMethod.getReturnType(),
declaredMethod, component, isSpecializes);
-
-            if (component instanceof EnterpriseBeanMarker)
-            {
-                final OpenWebBeansEjbPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbPlugin();
-
-                Method method = ejbPlugin.resolveViewMethod(component, declaredMethod);
-                newComponent.setCreatorMethod(method);
-            }
-
-            if (newComponent != null)
-            {
-                producerComponents.add(newComponent);
-                addMethodInjectionPointMetaData(newComponent, declaredMethod);
-            }
-        }
-
-    }
-
-    public <T> ProducerMethodBean<T> createProducerComponent(Class<T> returnType,
Method method, InjectionTargetBean<?> parent,
-                                                                    boolean isSpecializes)
-    {
-        ProducerMethodBean<T> component = new ProducerMethodBean<T>(parent, returnType);
-        component.setCreatorMethod(method);
-
-        if (isSpecializes)
-        {
-            WebBeansUtil.configureProducerSpecialization(component, method, parent.getReturnType().getSuperclass());
-        }
-
-        if (returnType.isPrimitive())
-        {
-            component.setNullable(false);
-        }
-
-        defineSerializable(component);
-        defineStereoTypes(component, method.getDeclaredAnnotations());
-
-        Annotation[] methodAnns = method.getDeclaredAnnotations();
-
-        webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(parent, component,
methodAnns);
-
-        defineProducerMethodApiTypes(component, method.getGenericReturnType(), methodAnns);
-        defineScopeType(component, methodAnns, "WebBeans producer method : " + method.getName()
+ " in class " + parent.getReturnType().getName()
-                                                              + " must declare default @Scope
annotation", false);
-        webBeansContext.getWebBeansUtil().checkUnproxiableApiType(component, component.getScope());
-        WebBeansUtil.checkProducerGenericType(component,method);
-        defineName(component, methodAnns, WebBeansUtil.getProducerDefaultName(method.getName()));
-        defineQualifiers(component, methodAnns);
-
-        return component;
-    }
-
-    /**
      * Configure bean instance interceptor stack.
      * @param bean bean instance
      */

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=1429265&r1=1429264&r2=1429265&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
Sat Jan  5 11:43:18 2013
@@ -36,6 +36,7 @@ import org.apache.webbeans.exception.Web
 import org.apache.webbeans.portable.creation.InjectionTargetProducer;
 import org.apache.webbeans.portable.creation.ProducerBeansProducer;
 import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
@@ -112,7 +113,7 @@ public final class ManagedBeanConfigurat
     {
         BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
         DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
-
+        WebBeansAnnotatedTypeUtil annotatedTypeUtil = webBeansContext.getAnnotatedTypeUtil();
 
         int modifier = clazz.getModifiers();
 
@@ -159,7 +160,7 @@ public final class ManagedBeanConfigurat
         //Dropped from the speicification
         //WebBeansUtil.checkSteroTypeRequirements(component, clazz.getDeclaredAnnotations(),
"Simple WebBean Component implementation class : " + clazz.getName());
 
-        Set<ProducerMethodBean<?>> producerMethods = definitionUtil.defineProducerMethods(component);
+        Set<ProducerMethodBean<?>> producerMethods = annotatedTypeUtil.defineProducerMethods(component,
component.getAnnotatedType());
         for (ProducerMethodBean<?> producerMethod : producerMethods)
         {
             // add them one after the other to enable serialization handling et al
@@ -167,7 +168,7 @@ public final class ManagedBeanConfigurat
             manager.putProducer(producerMethod, new ProducerBeansProducer(producerMethod));
         }
 
-        Set<ProducerFieldBean<?>> producerFields = webBeansContext.getAnnotatedTypeUtil().defineProducerFields(component,
component.getAnnotatedType());
+        Set<ProducerFieldBean<?>> producerFields = annotatedTypeUtil.defineProducerFields(component,
component.getAnnotatedType());
         for (ProducerFieldBean<?> producerField : producerFields)
         {
             // add them one after the other to enable serialization handling et al
@@ -176,10 +177,10 @@ public final class ManagedBeanConfigurat
         }
 
 
-        webBeansContext.getAnnotatedTypeUtil().defineDisposalMethods(component, component.getAnnotatedType());
-        webBeansContext.getAnnotatedTypeUtil().defineInjectedFields(component, component.getAnnotatedType());
-        webBeansContext.getAnnotatedTypeUtil().defineInjectedMethods(component, component.getAnnotatedType());
-        webBeansContext.getAnnotatedTypeUtil().defineObserverMethods(component, component.getAnnotatedType());
+        annotatedTypeUtil.defineDisposalMethods(component, component.getAnnotatedType());
+        annotatedTypeUtil.defineInjectedFields(component, component.getAnnotatedType());
+        annotatedTypeUtil.defineInjectedMethods(component, component.getAnnotatedType());
+        annotatedTypeUtil.defineObserverMethods(component, component.getAnnotatedType());
 
         return component;
     }

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=1429265&r1=1429264&r2=1429265&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
Sat Jan  5 11:43:18 2013
@@ -465,6 +465,7 @@ public final class WebBeansAnnotatedType
                     webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(bean,
producerFieldBean, anns);
                     if (producerFieldBean.getReturnType().isArray())
                     {
+                        // TODO this special handling should not be necessary, seems to be
a bug in the tck
                         producerFieldBean.getTypes().add(Object.class);
                         producerFieldBean.getTypes().add(producerFieldBean.getReturnType());
                     }
@@ -530,8 +531,16 @@ public final class WebBeansAnnotatedType
                                                                                    producerMethodBean,
                                                                                    AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
 
-                Set<Type> types = annotatedMethod.getTypeClosure();
-                producerMethodBean.getTypes().addAll(types);
+                if (producerMethodBean.getReturnType().isArray())
+                {
+                    // TODO this special handling should not be necessary, seems to be a
bug in the tck
+                    producerMethodBean.getTypes().add(Object.class);
+                    producerMethodBean.getTypes().add(producerMethodBean.getReturnType());
+                }
+                else
+                {
+                    producerMethodBean.getTypes().addAll(annotatedMethod.getTypeClosure());
+                }
                 definitionUtil.defineScopeType(producerMethodBean,
                                                AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
                                                                                     "Annotated
producer method : " + annotatedMethod +  "must declare default @Scope annotation",



Mime
View raw message