openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1057327 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ component/third/ config/ container/ lifecycle/
Date Mon, 10 Jan 2011 19:33:32 GMT
Author: djencks
Date: Mon Jan 10 19:33:32 2011
New Revision: 1057327

URL: http://svn.apache.org/viewvc?rev=1057327&view=rev
Log:
OWB-503 some minor static and for-loop cleanup

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.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/OpenWebBeansConfiguration.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java?rev=1057327&r1=1057326&r2=1057327&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
Mon Jan 10 19:33:32 2011
@@ -36,7 +36,6 @@ import javax.enterprise.inject.spi.Decor
 import javax.enterprise.inject.spi.InjectionPoint;
 import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.config.OWBLogConst;
-import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.config.inheritance.BeanInheritedMetaData;
 import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
 import org.apache.webbeans.decorator.WebBeansDecorator;
@@ -136,7 +135,7 @@ public abstract class AbstractInjectionT
         boolean isDependentProxy = false;
         if(getScope() == Dependent.class && !(this instanceof EnterpriseBeanMarker))
         {
-            T result = (T) WebBeansContext.getInstance().getJavassistProxyFactory().createDependentScopedBeanProxy(this,
instance, creationalContext);
+            T result = (T) getWebBeansContext().getJavassistProxyFactory().createDependentScopedBeanProxy(this,
instance, creationalContext);
             //Means that Dependent Bean has interceptor/decorator
             if(JavassistProxyFactory.isProxyInstance(result))
             {

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=1057327&r1=1057326&r2=1057327&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 Jan 10 19:33:32 2011
@@ -47,6 +47,7 @@ import org.apache.webbeans.util.WebBeans
  * @version $Rev$ $Date$
  * 
  * @see javax.enterprise.inject.spi.Bean
+ * 
  */
 public abstract class AbstractOwbBean<T> implements OwbBean<T>
 {
@@ -161,7 +162,7 @@ public abstract class AbstractOwbBean<T>
         {  
             if(!(creationalContext instanceof CreationalContextImpl))
             {
-                creationalContext = WebBeansContext.getInstance().getCreationalContextFactory().wrappedCreationalContext(
+                creationalContext = webBeansContext.getCreationalContextFactory().wrappedCreationalContext(
                         creationalContext, this); 
             }
            
@@ -595,7 +596,7 @@ public abstract class AbstractOwbBean<T>
      */    
     public boolean isAlternative()
     {
-        return WebBeansContext.getInstance().getAlternativesManager().isBeanHasAlternative(this);
+        return webBeansContext.getAlternativesManager().isBeanHasAlternative(this);
     }
     
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java?rev=1057327&r1=1057326&r2=1057327&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ExtensionBean.java
Mon Jan 10 19:33:32 2011
@@ -21,7 +21,6 @@ package org.apache.webbeans.component;
 import javax.enterprise.context.spi.CreationalContext;
 
 import org.apache.webbeans.annotation.ApplicationScopeLiteral;
-import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.portable.events.ExtensionLoader;
 
 /**
@@ -50,7 +49,7 @@ public class ExtensionBean<T> extends Ab
     @Override
     protected T createComponentInstance(CreationalContext<T> creationalContext)
     {
-        ExtensionLoader loader = WebBeansContext.getInstance().getExtensionLoader();
+        ExtensionLoader loader = getWebBeansContext().getExtensionLoader();
         
         return loader.getBeanInstance(this);
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java?rev=1057327&r1=1057326&r2=1057327&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
Mon Jan 10 19:33:32 2011
@@ -29,7 +29,6 @@ import javax.enterprise.inject.spi.Passi
 
 import org.apache.webbeans.component.AbstractOwbBean;
 import org.apache.webbeans.component.WebBeansType;
-import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.inject.AlternativesManager;
 
 public class ThirdpartyBeanImpl<T> extends AbstractOwbBean<T> implements Bean<T>
@@ -156,7 +155,7 @@ public class ThirdpartyBeanImpl<T> exten
         boolean alternative = this.bean.isAlternative();
         if(alternative)
         {
-            AlternativesManager manager = WebBeansContext.getInstance().getAlternativesManager();
+            AlternativesManager manager = getWebBeansContext().getAlternativesManager();
             //Class alternative
             if(manager.isClassAlternative(getBeanClass()))
             {

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=1057327&r1=1057326&r2=1057327&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 Jan 10 19:33:32 2011
@@ -105,12 +105,13 @@ public class BeansDeployer
      * Creates a new deployer with given xml configurator.
      * 
      * @param xmlConfigurator xml configurator
+     * @param webBeansContext
      */
-    public BeansDeployer(WebBeansXMLConfigurator xmlConfigurator)
+    public BeansDeployer(WebBeansXMLConfigurator xmlConfigurator, WebBeansContext webBeansContext)
     {
         this.xmlConfigurator = xmlConfigurator;
-        this.webBeansContext = WebBeansContext.getInstance();
-        String usage = webBeansContext.getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_EJB_DISCOVERY);
+        this.webBeansContext = webBeansContext;
+        String usage = this.webBeansContext.getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_EJB_DISCOVERY);
         this.discoverEjb = Boolean.parseBoolean(usage);
     }
 
@@ -421,7 +422,7 @@ public class BeansDeployer
                     
                     if(beanName.equals(other))
                     {
-                        InjectionResolver resolver = InjectionResolver.getInstance();
+                        InjectionResolver resolver = webBeansContext.getBeanManagerImpl().getInjectionResolver();
                         Set<Bean<?>> beans = resolver.implResolveByName(beanName);
                         if(beans.size() > 1)
                         {
@@ -729,7 +730,7 @@ public class BeansDeployer
 
         addDefaultStereoTypes();
 
-        final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
         
         Set<Class<?>> beanClasses = scanner.getBeanClasses();
         if (beanClasses != null && beanClasses.size() > 0)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java?rev=1057327&r1=1057326&r2=1057327&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
Mon Jan 10 19:33:32 2011
@@ -122,16 +122,6 @@ public class OpenWebBeansConfiguration
     public static final String USE_BDA_BEANSXML_SCANNER = "org.apache.webbeans.useBDABeansXMLScanner";
 
     /**
-     * Gets singleton instance.
-     * @return singleton instance
-     */
-    @Deprecated
-    public static OpenWebBeansConfiguration getInstance() 
-    {
-        return WebBeansContext.getInstance().getOpenWebBeansConfiguration();
-    }
-
-    /**
      * Parse configuration.
      */
     public OpenWebBeansConfiguration()

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=1057327&r1=1057326&r2=1057327&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 Jan 10 19:33:32 2011
@@ -244,17 +244,6 @@ public class BeanManagerImpl implements 
     }
 
     /**
-     * Gets current activity.
-     *
-     * @return the current activity
-     */
-    @Deprecated
-    public static BeanManagerImpl getManager()
-    {
-        return WebBeansContext.getInstance().getBeanManagerImpl();
-    }
-
-    /**
      * Sets the xml configurator instance.
      * 
      * @param xmlConfigurator set xml configurator instance.
@@ -691,7 +680,7 @@ public class BeanManagerImpl implements 
             throw new IllegalArgumentException("Exception in getBeans method. Bean type can
not be TypeVariable for bean type : " + beanType);
         }
 
-        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(bindings);
+        webBeansContext.getAnnotationManager().checkQualifierConditions(bindings);
 
         return this.injectionResolver.implResolveByType(beanType, bindings);
         

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=1057327&r1=1057326&r2=1057327&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Mon Jan 10 19:33:32 2011
@@ -449,8 +449,6 @@ public class InjectionResolver
         
         resolvedComponents = new HashSet<Bean<?>>();
         
-        Set<Bean<?>> deployedComponents = this.webBeansContext.getBeanManagerImpl().getBeans();
-
         boolean currentQualifier = false;
         boolean returnAll = false;
         
@@ -475,11 +473,8 @@ public class InjectionResolver
             returnAll = true;
         }
 
-        Iterator<Bean<?>> it = deployedComponents.iterator();
-
-        while (it.hasNext())
+        for (Bean<?> component : this.webBeansContext.getBeanManagerImpl().getBeans())
         {
-            Bean<?> component = it.next();
 
             if (returnAll)
             {
@@ -487,13 +482,10 @@ public class InjectionResolver
                 continue;
             }
 
-            Set<Type> componentApiTypes = component.getTypes();
-            Iterator<Type> itComponentApiTypes = componentApiTypes.iterator();
-            while (itComponentApiTypes.hasNext())
+            for (Type componentApiType : component.getTypes())
             {
-                Type componentApiType = itComponentApiTypes.next();
-                
-                if(ClassUtil.isAssignable(componentApiType, injectionPointType))
+
+                if (ClassUtil.isAssignable(componentApiType, injectionPointType))
                 {
                     resolvedComponents.add(component);
                     break;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java?rev=1057327&r1=1057326&r2=1057327&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
Mon Jan 10 19:33:32 2011
@@ -76,7 +76,7 @@ public abstract class AbstractLifeCycle 
         webBeansContext = WebBeansContext.getInstance();
         this.beanManager = webBeansContext.getBeanManagerImpl();
         this.xmlDeployer = new WebBeansXMLConfigurator();
-        this.deployer = new BeansDeployer(xmlDeployer);
+        this.deployer = new BeansDeployer(xmlDeployer, webBeansContext);
         this.jndiService = webBeansContext.getService(JNDIService.class);
         this.beanManager.setXMLConfigurator(this.xmlDeployer);
         this.scannerService = webBeansContext.getScannerService();



Mime
View raw message