openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1566018 - in /openwebbeans/trunk: webbeans-el10/src/main/java/org/apache/webbeans/el10/ webbeans-el22/src/main/java/org/apache/webbeans/el22/ webbeans-impl/src/main/java/org/apache/webbeans/el/ webbeans-porting/src/main/java/org/apache/web...
Date Sat, 08 Feb 2014 14:14:41 GMT
Author: gpetracek
Date: Sat Feb  8 14:14:41 2014
New Revision: 1566018

URL: http://svn.apache.org/r1566018
Log:
OWB-820 cleanup of el-resolvers

Modified:
    openwebbeans/trunk/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Resolver.java
    openwebbeans/trunk/webbeans-el22/src/main/java/org/apache/webbeans/el22/WebBeansELResolver.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/ELContextStore.java
    openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/OwbTckElResolver.java

Modified: openwebbeans/trunk/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Resolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Resolver.java?rev=1566018&r1=1566017&r2=1566018&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Resolver.java
(original)
+++ openwebbeans/trunk/webbeans-el10/src/main/java/org/apache/webbeans/el10/EL10Resolver.java
Sat Feb  8 14:14:41 2014
@@ -67,57 +67,49 @@ public class EL10Resolver extends ELReso
 
     @Override
     @SuppressWarnings({"unchecked","deprecation"})
-    public Object getValue(ELContext context, Object obj, Object property) throws NullPointerException,
PropertyNotFoundException, ELException
+    public Object getValue(ELContext context, Object base, Object property) throws NullPointerException,
PropertyNotFoundException, ELException
     {
+        BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+        //we only check root beans
         // Check if the OWB actually got used in this application
-        if (!webBeansContext.getBeanManagerImpl().isInUse())
+        if (base != null || !beanManager.isInUse())
         {
             return null;
         }
         
-        //Bean instance
-        Object contextualInstance = null;
+        //Name of the bean
+        String beanName = (String) property;
+        //Local store, create if not exist
+        ELContextStore elContextStore = ELContextStore.getInstance(true);
 
-        if (obj == null)
-        {
-            //Name of the bean
-            String name = (String) property;
-            //Local store, create if not exist
-            ELContextStore elContextStore = ELContextStore.getInstance(true);
-
-            contextualInstance = elContextStore.findBeanByName(name);
+        Object contextualInstance = elContextStore.findBeanByName(beanName);
 
-            if(contextualInstance != null)
-            {
-                context.setPropertyResolved(true);
+        if(contextualInstance != null)
+        {
+            context.setPropertyResolved(true);
 
-                return contextualInstance;
-            }
+            return contextualInstance;
+        }
 
-            //Manager instance
-            BeanManagerImpl manager = elContextStore.getBeanManager();
+        //Get beans
+        Set<Bean<?>> beans = beanManager.getBeans(beanName);
 
-            //Get beans
-            Set<Bean<?>> beans = manager.getBeans(name);
+        //Found?
+        if(beans != null && !beans.isEmpty())
+        {
+            //Managed bean
+            Bean<Object> bean = (Bean<Object>)beans.iterator().next();
 
-            //Found?
-            if(beans != null && !beans.isEmpty())
+            if(bean.getScope().equals(Dependent.class))
             {
-                //Managed bean
-                Bean<Object> bean = (Bean<Object>)beans.iterator().next();
-
-                if(bean.getScope().equals(Dependent.class))
-                {
-                    contextualInstance = getDependentContextualInstance(manager, elContextStore,
context, bean);
-                }
-                else
-                {
-                    // now we check for NormalScoped beans
-                    contextualInstance = getNormalScopedContextualInstance(manager, elContextStore,
context, bean, name);
-                }
+                contextualInstance = getDependentContextualInstance(beanManager, elContextStore,
context, bean);
+            }
+            else
+            {
+                // now we check for NormalScoped beans
+                contextualInstance = getNormalScopedContextualInstance(beanManager, elContextStore,
context, bean, beanName);
             }
         }
-
         return contextualInstance;
     }
 

Modified: openwebbeans/trunk/webbeans-el22/src/main/java/org/apache/webbeans/el22/WebBeansELResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-el22/src/main/java/org/apache/webbeans/el22/WebBeansELResolver.java?rev=1566018&r1=1566017&r2=1566018&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-el22/src/main/java/org/apache/webbeans/el22/WebBeansELResolver.java
(original)
+++ openwebbeans/trunk/webbeans-el22/src/main/java/org/apache/webbeans/el22/WebBeansELResolver.java
Sat Feb  8 14:14:41 2014
@@ -91,57 +91,50 @@ public class WebBeansELResolver extends 
      */    
     @Override
     @SuppressWarnings({"unchecked","deprecation"})
-    public Object getValue(ELContext context, Object obj, Object property) throws ELException
+    public Object getValue(ELContext context, Object base, Object property) throws ELException
     {
+        BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
+        //we only check root beans
         // Check if the OWB actually got used in this application
-        if (!webBeansContext.getBeanManagerImpl().isInUse())
+        if (base != null || !beanManager.isInUse())
         {
             return null;
         }
 
-        //Bean instance
-        Object contextualInstance = null;
-        ELContextStore elContextStore = null;
-        if (obj == null)
-        {
-            //Name of the bean
-            String name = (String) property;
-            //Local store, create if not exist
-            elContextStore = ELContextStore.getInstance(true);
+        //Name of the bean
+        String beanName = (String) property;
 
-            contextualInstance = elContextStore.findBeanByName(name);
+        //Local store, create if not exist
+        ELContextStore elContextStore = ELContextStore.getInstance(true);
 
-            if(contextualInstance != null)
-            {
-                context.setPropertyResolved(true);
-                
-                return contextualInstance;
-            }
+        Object contextualInstance = elContextStore.findBeanByName(beanName);
 
-            //Manager instance
-            BeanManagerImpl manager = elContextStore.getBeanManager();
+        if(contextualInstance != null)
+        {
+            context.setPropertyResolved(true);
 
-            //Get beans
-            Set<Bean<?>> beans = manager.getBeans(name);
+            return contextualInstance;
+        }
 
-            //Found?
-            if(beans != null && !beans.isEmpty())
-            {
-                //Managed bean
-                Bean<Object> bean = (Bean<Object>)beans.iterator().next();
+        //Get beans
+        Set<Bean<?>> beans = beanManager.getBeans(beanName);
+
+        //Found?
+        if(beans != null && !beans.isEmpty())
+        {
+            //Managed bean
+            Bean<Object> bean = (Bean<Object>)beans.iterator().next();
 
-                if(bean.getScope().equals(Dependent.class))
-                {
-                    contextualInstance = getDependentContextualInstance(manager, elContextStore,
context, bean);
-                }
-                else
-                {
-                    // now we check for NormalScoped beans
-                    contextualInstance = getNormalScopedContextualInstance(manager, elContextStore,
context, bean, name);
-                }
+            if(bean.getScope().equals(Dependent.class))
+            {
+                contextualInstance = getDependentContextualInstance(beanManager, elContextStore,
context, bean);
+            }
+            else
+            {
+                // now we check for NormalScoped beans
+                contextualInstance = getNormalScopedContextualInstance(beanManager, elContextStore,
context, bean, beanName);
             }
         }
-        
         return contextualInstance;
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/ELContextStore.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/ELContextStore.java?rev=1566018&r1=1566017&r2=1566018&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/ELContextStore.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/ELContextStore.java
Sat Feb  8 14:14:41 2014
@@ -18,9 +18,6 @@
  */
 package org.apache.webbeans.el;
 
-import org.apache.webbeans.config.WebBeansContext;
-import org.apache.webbeans.container.BeanManagerImpl;
-
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -81,8 +78,6 @@ public class ELContextStore
      */
     private Map<String, Object> normalScopedObjects = new HashMap<String, Object>();
 
-    private BeanManagerImpl beanManager;
-
     public Object findBeanByName(String name)
     {
         Object cachedBean = normalScopedObjects.get(name);
@@ -180,18 +175,6 @@ public class ELContextStore
     }
 
     /**
-     * @return BeanManager for this thread
-     */
-    public BeanManagerImpl getBeanManager()
-    {
-        if (beanManager == null)
-        {
-            beanManager = WebBeansContext.getInstance().getBeanManagerImpl();
-        }
-        return beanManager;
-    }
-
-    /**
      * This method have to be called after the EL parsing to cleanup the cache
      * for &#064;Dependent scoped beans.
      */
@@ -219,7 +202,6 @@ public class ELContextStore
      */
     public void destroyELContextStore()
     {
-        beanManager = null;
         normalScopedObjects.clear();
         contextStores.set(null);
         contextStores.remove();

Modified: openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/OwbTckElResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/OwbTckElResolver.java?rev=1566018&r1=1566017&r2=1566018&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/OwbTckElResolver.java
(original)
+++ openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/OwbTckElResolver.java
Sat Feb  8 14:14:41 2014
@@ -26,6 +26,7 @@ import javax.el.PropertyNotFoundExceptio
 import javax.enterprise.context.Dependent;
 import javax.enterprise.inject.spi.Bean;
 
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.el.ELContextStore;
 import org.apache.webbeans.el22.WebBeansELResolver;
@@ -67,7 +68,7 @@ public class OwbTckElResolver extends We
             }
 
             //Manager instance
-            BeanManagerImpl manager = elContextStore.getBeanManager();
+            BeanManagerImpl manager = WebBeansContext.getInstance().getBeanManagerImpl();
 
             //Get beans
             Set<Bean<?>> beans = manager.getBeans(name);



Mime
View raw message