openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1428954 - 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/
Date Fri, 04 Jan 2013 16:27:29 GMT
Author: arne
Date: Fri Jan  4 16:27:29 2013
New Revision: 1428954

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

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/AbstractInjectedTargetBeanCreator.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

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=1428954&r1=1428953&r2=1428954&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
Fri Jan  4 16:27:29 2013
@@ -233,7 +233,7 @@ public final class EjbUtility
         manager.getBeans().addAll(producerMethodBeans);
         manager.getBeans().addAll(producerFieldBeans);
 
-        util.defineDisposalMethods(ejbBean, clazz);
+        webBeansContext.getAnnotatedTypeUtil().defineDisposalMethods(ejbBean, ejbBean.getAnnotatedType());
 
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java?rev=1428954&r1=1428953&r2=1428954&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java
Fri Jan  4 16:27:29 2013
@@ -25,6 +25,7 @@ import javax.enterprise.inject.spi.Obser
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.component.ProducerFieldBean;
 import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
 
 /**
@@ -36,6 +37,9 @@ import org.apache.webbeans.util.WebBeans
  */
 public abstract class AbstractInjectedTargetBeanCreator<T> extends AbstractBeanCreator<T>
implements InjectedTargetBeanCreator<T>
 {    
+    
+    private WebBeansContext webBeansContext;
+
     /**
      * Creates a new instance.
      * 
@@ -44,6 +48,7 @@ public abstract class AbstractInjectedTa
     public AbstractInjectedTargetBeanCreator(AbstractInjectionTargetBean<T> bean)
     {
         super(bean, bean.getAnnotatedType());
+        webBeansContext = bean.getWebBeansContext();
     }
     
  
@@ -52,17 +57,7 @@ public abstract class AbstractInjectedTa
      */
     public void defineDisposalMethods()
     {
-        AbstractInjectionTargetBean bean = getBean();
-        if(isDefaultMetaDataProvider())
-        {
-
-            bean.getWebBeansContext().getDefinitionUtil().defineDisposalMethods(getBean());
-        }
-        else
-        {
-            bean.getWebBeansContext().getAnnotatedTypeUtil().defineDisposalMethods(getBean(),
getAnnotatedType());
-        }
-        
+        webBeansContext.getAnnotatedTypeUtil().defineDisposalMethods(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=1428954&r1=1428953&r2=1428954&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
Fri Jan  4 16:27:29 2013
@@ -18,8 +18,6 @@
  */
 package org.apache.webbeans.config;
 
-import static org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException;
-
 import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
@@ -45,7 +43,6 @@ import javax.enterprise.inject.Typed;
 import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedParameter;
 import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.ObserverMethod;
 import javax.enterprise.util.Nonbinding;
@@ -70,7 +67,6 @@ import org.apache.webbeans.component.Pro
 import org.apache.webbeans.component.ResourceBean;
 import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
 import org.apache.webbeans.container.ExternalScope;
-import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
 import org.apache.webbeans.event.EventUtil;
 import org.apache.webbeans.event.NotificationManager;
@@ -833,93 +829,6 @@ public final class DefinitionUtil
         return component;
     }
 
-    public <T> void defineDisposalMethods(AbstractOwbBean<T> component)
-    {
-        Class<?> clazz = component.getReturnType();
-
-        defineDisposalMethods(component, clazz);
-
-    }
-
-    public <T> void defineDisposalMethods(AbstractOwbBean<T> component, Class<?>
clazz)
-    {
-        Method[] methods = AnnotationUtil.getMethodsWithParameterAnnotation(clazz, Disposes.class);
-
-        // From Normal
-        createDisposalMethods(component, methods, clazz);
-    }
-
-    private <T> void createDisposalMethods(AbstractOwbBean<T> component, Method[]
methods, Class<?> clazz)
-    {
-        final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
-
-        ProducerMethodBean<?> previous = null;
-        for (Method declaredMethod : methods)
-        {
-
-            WebBeansUtil.checkProducerMethodDisposal(declaredMethod, clazz.getName());
-
-            Type type = AnnotationUtil.getMethodFirstParameterWithAnnotation(declaredMethod,
Disposes.class);
-            Annotation[] annot = annotationManager.getMethodFirstParameterQualifierWithGivenAnnotation(declaredMethod,
Disposes.class);
-
-            InjectionResolver injectionResolver = webBeansContext.getBeanManagerImpl().getInjectionResolver();
-
-            Set<Bean<?>> set = injectionResolver.implResolveByType(type, annot);
-            Bean<?> bean = injectionResolver.resolve(set);
-            if (bean == null)
-            {
-                throwUnsatisfiedResolutionException(clazz, declaredMethod, annot);
-            }
-            
-            ProducerMethodBean<?> pr = null;
-
-            if (!(bean instanceof ProducerMethodBean))
-            {
-                throwUnsatisfiedResolutionException(clazz, declaredMethod);
-            }
-
-            else
-            {
-                pr = (ProducerMethodBean<?>) bean;
-            }
-
-            if (previous == null)
-            {
-                previous = pr;
-            }
-            else
-            {
-                // multiple same producer
-                if (previous.equals(pr))
-                {
-                    throw new WebBeansConfigurationException("There are multiple disposal
method for the producer method : " + pr.getCreatorMethod().getName()
-                                                             + " in class : " + clazz.getName());
-                }
-            }
-
-            addMethodInjectionPointMetaData(component, declaredMethod);
-
-            if (component instanceof EnterpriseBeanMarker)
-            {
-                final OpenWebBeansEjbPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbPlugin();
-                declaredMethod = ejbPlugin.resolveViewMethod(component, declaredMethod);
-            }
-
-            pr.setDisposalMethod(declaredMethod);
-
-            Method producerMethod = pr.getCreatorMethod();
-
-            //Disposer methods and producer methods must be in the same class
-            if(!producerMethod.getDeclaringClass().getName().equals(declaredMethod.getDeclaringClass().getName()))
-            {
-                throw new WebBeansConfigurationException("Producer method component of the
disposal method : " + declaredMethod.getName() + " in class : "
-                                                         + clazz.getName() + " must be in
the same class!");
-            }
-
-
-        }
-    }
-
     public <T> void defineInjectedFields(AbstractInjectionTargetBean<T> component)
     {
         Class<T> clazz = component.getReturnType();

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=1428954&r1=1428953&r2=1428954&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
Fri Jan  4 16:27:29 2013
@@ -176,7 +176,7 @@ public final class ManagedBeanConfigurat
         }
 
 
-        definitionUtil.defineDisposalMethods(component);
+        webBeansContext.getAnnotatedTypeUtil().defineDisposalMethods(component, component.getAnnotatedType());
         definitionUtil.defineInjectedFields(component);
         definitionUtil.defineInjectedMethods(component);
         definitionUtil.defineObserverMethods(component, clazz);



Mime
View raw message