openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r937099 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/AbstractOwbBean.java container/BeanManagerImpl.java inject/OWBInjector.java
Date Thu, 22 Apr 2010 23:15:04 GMT
Author: gerdogdu
Date: Thu Apr 22 23:15:03 2010
New Revision: 937099

URL: http://svn.apache.org/viewvc?rev=937099&view=rev
Log:
update while running tck

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java

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=937099&r1=937098&r2=937099&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
Thu Apr 22 23:15:03 2010
@@ -207,6 +207,8 @@ public abstract class AbstractOwbBean<T>
     {
         try
         {  
+            logger.debug("Destroying instance : " + this.toString());
+            
             InjectionTargetWrapper<T> wrapper = getManager().getInjectionTargetWrapper(this);
             if(wrapper != null)
             {

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=937099&r1=937098&r2=937099&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
Thu Apr 22 23:15:03 2010
@@ -830,6 +830,15 @@ public class BeanManagerImpl implements 
         //Create session bean proxy
         if(bean instanceof EnterpriseBeanMarker)
         {
+            if(WebBeansUtil.isScopeTypeNormal(bean.getScope()))
+            {
+                //Maybe it is cached
+                if(this.cacheProxies.containsKey(bean))
+                {
+                    return this.cacheProxies.get(bean);
+                }
+            }
+            
             OpenWebBeansEjbPlugin ejbPlugin = PluginLoader.getInstance().getEjbPlugin();
             if(ejbPlugin == null)
             {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java?rev=937099&r1=937098&r2=937099&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
Thu Apr 22 23:15:03 2010
@@ -25,16 +25,20 @@ import java.util.Set;
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.InjectionTarget;
 import javax.inject.Inject;
 
+import org.apache.webbeans.component.InjectionPointBean;
 import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.SecurityUtil;
+import org.apache.webbeans.util.WebBeansUtil;
 
 /**
  * Injects dependencies of the given Java EE component
@@ -87,16 +91,43 @@ public final class OWBInjector implement
                 
                 for(InjectionPoint injectionPoint : injectionPoints)
                 {
-                    Object object = beanManager.getInjectableReference(injectionPoint, ownerCreationalContext);
                   
-                    if(injectionPoint.getMember() instanceof Method)
+                    boolean injectionPointBeanSet = false;
+                    try
                     {
-                        Method method = (Method)injectionPoint.getMember();
-                        ClassUtil.callInstanceMethod(method, javaEeComponentInstance, new
Object[]{object});                        
-                    }
-                    else if(injectionPoint.getMember() instanceof Field)
+                        if(injectionPoint.getMember() instanceof Field)
+                        {
+                            //Injected contextual beam
+                            Bean<?> injectedBean = (Bean<?>)InjectionResolver.getInstance().getInjectionPointBean(injectionPoint);
               
+                            
+                            if(WebBeansUtil.isDependent(injectedBean))
+                            {
+                                if(!InjectionPoint.class.isAssignableFrom(ClassUtil.getClass(injectionPoint.getType())))
+                                {
+                                    injectionPointBeanSet = true;
+                                    InjectionPointBean.local.set(injectionPoint);   
+                                }
+                            }
+                        }
+                        
+                        Object object = beanManager.getInjectableReference(injectionPoint,
ownerCreationalContext);                    
+                        
+                        if(injectionPoint.getMember() instanceof Method)
+                        {
+                            Method method = (Method)injectionPoint.getMember();
+                            ClassUtil.callInstanceMethod(method, javaEeComponentInstance,
new Object[]{object});
+                            
+                        }
+                        else if(injectionPoint.getMember() instanceof Field)
+                        {
+                            Field field = (Field)injectionPoint.getMember();
+                            ClassUtil.setField(javaEeComponentInstance, field, object);
+                        }                        
+                    }finally
                     {
-                        Field field = (Field)injectionPoint.getMember();
-                        ClassUtil.setField(javaEeComponentInstance, field, object);
+                        if(injectionPointBeanSet)
+                        {
+                            InjectionPointBean.local.remove();   
+                        }  
                     }
                 }
                 



Mime
View raw message