openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1413568 - in /openwebbeans/trunk: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/ webbeans-impl/src/main/java/org/apache/webbeans/component/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/jav...
Date Mon, 26 Nov 2012 12:05:47 GMT
Author: struberg
Date: Mon Nov 26 12:05:46 2012
New Revision: 1413568

URL: http://svn.apache.org/viewvc?rev=1413568&view=rev
Log:
OWB-730 remove InjectionTargetWrapper

step 1 for normal beans

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/AbstractOwbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.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=1413568&r1=1413567&r2=1413568&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
Mon Nov 26 12:05:46 2012
@@ -105,7 +105,7 @@ public final class EjbUtility
         webBeansContext.getWebBeansUtil().inspectErrorStack(
             "There are errors that are added by ProcessInjectionTarget event observers. Look
at logs for further details");
         //Put final InjectionTarget instance
-        manager.putInjectionTargetWrapper(ejbBean, new InjectionTargetWrapper(processInjectionTargetEvent.getInjectionTarget()));
+        manager.putInjectionTargetWrapper(ejbBean, processInjectionTargetEvent.getInjectionTarget());
         
         Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods
= new HashMap<ProducerMethodBean<?>, AnnotatedMethod<?>>(); 
         for(ProducerMethodBean<?> producerMethod : producerMethodBeans)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java?rev=1413568&r1=1413567&r2=1413568&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
Mon Nov 26 12:05:46 2012
@@ -34,6 +34,9 @@ import javax.enterprise.context.spi.Crea
 import javax.enterprise.inject.CreationException;
 import javax.enterprise.inject.Disposes;
 import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.Producer;
+
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
@@ -173,13 +176,16 @@ public abstract class AbstractOwbBean<T>
                         creationalContext, this); 
             }
            
-            InjectionTargetWrapper<T> wrapper = getManager().getInjectionTargetWrapper(this);
+            Producer<T> wrapper = getManager().getInjectionTargetWrapper(this);
             //If wrapper not null
             if(wrapper != null)
             {
                 instance = wrapper.produce(creationalContext);
-                wrapper.inject(instance, creationalContext);
-                wrapper.postConstruct(instance);
+                if (wrapper instanceof InjectionTarget)
+                {
+                    ((InjectionTarget)wrapper).inject(instance, creationalContext);
+                    ((InjectionTarget)wrapper).postConstruct(instance);
+                }
             }
             else
             {
@@ -241,14 +247,13 @@ public abstract class AbstractOwbBean<T>
     {
         try
         {
-            InjectionTargetWrapper<T> wrapper = getManager().getInjectionTargetWrapper(this);
+            Producer<T> wrapper = getManager().getInjectionTargetWrapper(this);
             if(wrapper != null)
             {
                 // instance might be null if we only created a proxy
                 // but no actual contextual instance for this bean!
                 if (instance != null)
                 {
-                    wrapper.preDestroy(instance);
                     wrapper.dispose(instance);
                 }
             }

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=1413568&r1=1413567&r2=1413568&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
Mon Nov 26 12:05:46 2012
@@ -884,7 +884,7 @@ public class BeansDeployer
                             .fireProcessInjectionTargetEvent(processInjectionTarget).getInjectionTarget();
                     if (updatedInjectionTarget != originalInjectionTarget)
                     {
-                        webBeansContext.getBeanManagerImpl().putInjectionTargetWrapper(managedBean,
new InjectionTargetWrapper<T>(updatedInjectionTarget));
+                        webBeansContext.getBeanManagerImpl().putInjectionTargetWrapper(managedBean,
updatedInjectionTarget);
                     }
                 }
             }

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=1413568&r1=1413567&r2=1413568&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
Mon Nov 26 12:05:46 2012
@@ -133,7 +133,7 @@ public final class ManagedBeanConfigurat
         }
 
         ManagedBean<T> component = new ManagedBean<T>(clazz, type, webBeansContext);
-        manager.putInjectionTargetWrapper(component, new InjectionTargetWrapper(new InjectionTargetProducer(component)));
+        manager.putInjectionTargetWrapper(component, new InjectionTargetProducer(component));
 
         webBeansContext.getWebBeansUtil().setInjectionTargetBeanEnableFlag(component);
 
@@ -183,4 +183,4 @@ public final class ManagedBeanConfigurat
 
         return component;
     }
-}
\ No newline at end of file
+}

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=1413568&r1=1413567&r2=1413568&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Mon Nov 26 12:05:46 2012
@@ -52,6 +52,7 @@ import javax.enterprise.inject.spi.Injec
 import javax.enterprise.inject.spi.InterceptionType;
 import javax.enterprise.inject.spi.Interceptor;
 import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.Producer;
 import javax.inject.Scope;
 import javax.interceptor.InterceptorBinding;
 import javax.naming.NamingException;
@@ -182,9 +183,10 @@ public class BeanManagerImpl implements 
      * This is used as a reference for serialization.
      */
     private ConcurrentHashMap<String, Bean<?>> passivationBeans = new ConcurrentHashMap<String,
Bean<?>>(); 
-    
-    private Map<Contextual<?>, InjectionTargetWrapper<?>> injectionTargetWrappers
= 
-        Collections.synchronizedMap(new IdentityHashMap<Contextual<?>, InjectionTargetWrapper<?>>());
+
+    //X TODO rename to reflect producers
+    private Map<Contextual<?>, Producer<?>> injectionTargetWrappers =
+        Collections.synchronizedMap(new IdentityHashMap<Contextual<?>, Producer<?>>());
     
     /**InjectionTargets for Java EE component instances that supports injections*/
     private Map<Class<?>, InjectionTargetWrapper<?>> injectionTargetForJavaEeComponents
= 
@@ -215,7 +217,7 @@ public class BeanManagerImpl implements 
         annotatedElementFactory = webBeansContext.getAnnotatedElementFactory();
     }
 
-    public <T> void putInjectionTargetWrapper(Contextual<T> contextual, InjectionTargetWrapper<T>
wrapper)
+    public <T> void putInjectionTargetWrapper(Contextual<T> contextual, Producer<T>
wrapper)
     {
         Asserts.assertNotNull(contextual);
         Asserts.assertNotNull(wrapper);
@@ -223,10 +225,10 @@ public class BeanManagerImpl implements 
         injectionTargetWrappers.put(contextual, wrapper);
     }
     
-    public <T> InjectionTargetWrapper<T> getInjectionTargetWrapper(Contextual<T>
contextual)
+    public <T> Producer<T> getInjectionTargetWrapper(Contextual<T> contextual)
     {
         Asserts.assertNotNull(contextual);
-        return (InjectionTargetWrapper<T>) injectionTargetWrappers.get(contextual);
+        return (Producer<T>) injectionTargetWrappers.get(contextual);
     }
     
     public <T> void putInjectionTargetWrapperForJavaEeComponents(Class<T> javaEeComponentClass,
InjectionTargetWrapper<T> wrapper)

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=1413568&r1=1413567&r2=1413568&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
Mon Nov 26 12:05:46 2012
@@ -56,31 +56,7 @@ import javax.enterprise.inject.IllegalPr
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.Specializes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
-import javax.enterprise.inject.spi.AnnotatedField;
-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.BeanManager;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.BeforeShutdown;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.InjectionTarget;
-import javax.enterprise.inject.spi.Interceptor;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.enterprise.inject.spi.PassivationCapable;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import javax.enterprise.inject.spi.ProcessManagedBean;
-import javax.enterprise.inject.spi.ProcessObserverMethod;
-import javax.enterprise.inject.spi.ProcessProducer;
-import javax.enterprise.inject.spi.ProcessProducerField;
-import javax.enterprise.inject.spi.ProcessProducerMethod;
-import javax.enterprise.inject.spi.ProcessSessionBean;
+import javax.enterprise.inject.spi.*;
 import javax.enterprise.util.TypeLiteral;
 import javax.inject.Inject;
 import javax.inject.Named;
@@ -107,7 +83,6 @@ import org.apache.webbeans.component.Eve
 import org.apache.webbeans.component.ExtensionBean;
 import org.apache.webbeans.component.InjectionPointBean;
 import org.apache.webbeans.component.InjectionTargetBean;
-import org.apache.webbeans.component.InjectionTargetWrapper;
 import org.apache.webbeans.component.InstanceBean;
 import org.apache.webbeans.component.ManagedBean;
 import org.apache.webbeans.component.NewBean;
@@ -139,7 +114,6 @@ import org.apache.webbeans.exception.inj
 import org.apache.webbeans.inject.AlternativesManager;
 import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.intercept.InterceptorDataImpl;
-import javax.enterprise.inject.spi.InterceptionType;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.plugins.OpenWebBeansEjbLCAPlugin;
 import org.apache.webbeans.plugins.PluginLoader;
@@ -2640,23 +2614,21 @@ public final class WebBeansUtil
             }
 
             //Put final InjectionTarget instance
-            manager.putInjectionTargetWrapper(managedBean,
-                    new InjectionTargetWrapper(processInjectionTargetEvent.getInjectionTarget()));
+            manager.putInjectionTargetWrapper(managedBean, processInjectionTargetEvent.getInjectionTarget());
 
             Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods
=
                     new HashMap<ProducerMethodBean<?>, AnnotatedMethod<?>>();
 
             for(ProducerMethodBean<?> producerMethod : producerMethods)
             {
-                AnnotatedMethod<?> method = webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(producerMethod.getCreatorMethod(),
-                                                                                       annotatedType);
+                AnnotatedMethod<?> method = webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(producerMethod.getCreatorMethod(),
annotatedType);
                 ProcessProducerImpl<?, ?> producerEvent = fireProcessProducerEventForMethod(producerMethod,
                                                                                         
               method);
                 inspectErrorStack("There are errors that are added by ProcessProducer event
observers for "
                                                + "ProducerMethods. Look at logs for further
details");
 
                 annotatedMethods.put(producerMethod, method);
-                manager.putInjectionTargetWrapper(producerMethod, new InjectionTargetWrapper(producerEvent.getProducer()));
+                manager.putInjectionTargetWrapper(producerMethod, (Producer) producerEvent.getProducer());
             }
 
             Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields
=
@@ -2664,15 +2636,13 @@ public final class WebBeansUtil
 
             for(ProducerFieldBean<?> producerField : producerFields)
             {
-                AnnotatedField<?> field = webBeansContext.getAnnotatedElementFactory().newAnnotatedField(producerField.getCreatorField(),
-                                                                                    annotatedType);
-                ProcessProducerImpl<?, ?> producerEvent = fireProcessProducerEventForField(producerField,
-                                                                                        
               field);
+                AnnotatedField<?> field = webBeansContext.getAnnotatedElementFactory().newAnnotatedField(producerField.getCreatorField(),
annotatedType);
+                ProcessProducerImpl<?, ?> producerEvent = fireProcessProducerEventForField(producerField,
field);
                 inspectErrorStack("There are errors that are added by ProcessProducer event
observers for"
                                                + " ProducerFields. Look at logs for further
details");
 
                 annotatedFields.put(producerField, field);
-                manager.putInjectionTargetWrapper(producerField, new InjectionTargetWrapper(producerEvent.getProducer()));
+                manager.putInjectionTargetWrapper(producerField, (Producer) producerEvent.getProducer());
             }
 
             Map<ObserverMethod<?>,AnnotatedMethod<?>> observerMethodsMap
=
@@ -2681,8 +2651,7 @@ public final class WebBeansUtil
             for(ObserverMethod<?> observerMethod : observerMethods)
             {
                 ObserverMethodImpl<?> impl = (ObserverMethodImpl<?>)observerMethod;
-                AnnotatedMethod<?> method = webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(impl.getObserverMethod(),
-                                                                                       annotatedType);
+                AnnotatedMethod<?> method = webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(impl.getObserverMethod(),
annotatedType);
 
                 observerMethodsMap.put(observerMethod, method);
             }



Mime
View raw message