openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1057448 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: boot/ component/ config/ container/ event/ event/xml/
Date Tue, 11 Jan 2011 02:10:20 GMT
Author: djencks
Date: Tue Jan 11 02:10:20 2011
New Revision: 1057448

URL: http://svn.apache.org/viewvc?rev=1057448&view=rev
Log:
OWB-508 fix compilation errors OWB-503 a little more cleanup

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/boot/Bootstrap.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanManagerBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerObjectFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/boot/Bootstrap.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/boot/Bootstrap.java?rev=1057448&r1=1057447&r2=1057448&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/boot/Bootstrap.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/boot/Bootstrap.java
Tue Jan 11 02:10:20 2011
@@ -35,10 +35,12 @@ public class Bootstrap
     private ContainerLifecycle containerLifecycle = null;
     
     private Properties properties = null;
-    
+
+    @SuppressWarnings("deprecated")
     public void init(Properties properties)
     {
         log.info(OWBLogConst.INFO_0006);
+        //this relies on DefaultSingletonService to instantiate the WebBeansContext
         this.containerLifecycle = WebBeansContext.getInstance().getService(ContainerLifecycle.class);
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanManagerBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanManagerBean.java?rev=1057448&r1=1057447&r2=1057448&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanManagerBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BeanManagerBean.java
Tue Jan 11 02:10:20 2011
@@ -39,7 +39,7 @@ public class BeanManagerBean extends Abs
     {
         if (this.manager == null)
         {
-            manager = new InjectableBeanManager();
+            manager = new InjectableBeanManager(getWebBeansContext().getBeanManagerImpl());
         }
 
         return manager;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java?rev=1057448&r1=1057447&r2=1057448&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BuildInOwbBean.java
Tue Jan 11 02:10:20 2011
@@ -33,8 +33,7 @@ import javassist.util.proxy.MethodHandle
 import javassist.util.proxy.ProxyObject;
 
 import org.apache.webbeans.config.BeansDeployer;
-import org.apache.webbeans.config.OpenWebBeansConfiguration;
-import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
 
@@ -63,7 +62,7 @@ public abstract class BuildInOwbBean<T> 
     private final WebBeansLogger logger = WebBeansLogger.getLogger(BeansDeployer.class);
 
     
-    private static HashMap<WebBeansType, String> proxyHandlerMap = new HashMap<WebBeansType,
String>();
+    private final HashMap<WebBeansType, String> proxyHandlerMap = new HashMap<WebBeansType,
String>();
 
     
     public static final String BUILD_IN_BEAN_PROPERTY = "org.apache.webbeans.component.BuildInOwbBean.property";
@@ -84,7 +83,7 @@ public abstract class BuildInOwbBean<T> 
     /**
      * Initialize build-in config.
      */
-    private static boolean initialized = initBuildInBeanConfig();
+    private boolean initialized;
 
     /**
      * The handler class name.
@@ -104,9 +103,9 @@ public abstract class BuildInOwbBean<T> 
      * 
      * @return true
      */
-    protected static boolean initBuildInBeanConfig() 
+    protected  boolean initBuildInBeanConfig(WebBeansContext webBeansContext)
     {
-        String s = OpenWebBeansConfiguration.getInstance().getProperty(BUILD_IN_BEAN_PROPERTY);
+        String s = webBeansContext.getOpenWebBeansConfiguration().getProperty(BUILD_IN_BEAN_PROPERTY);
         proxyHandlerMap.put(WebBeansType.USERTRANSACTION, PROXY_HANDLER_VALUE_DEFAULT);
         proxyHandlerMap.put(WebBeansType.PRINCIPAL, PROXY_HANDLER_VALUE_DEFAULT);
         proxyHandlerMap.put(WebBeansType.VALIDATION, PROXY_HANDLER_VALUE_DEFAULT);
@@ -155,12 +154,14 @@ public abstract class BuildInOwbBean<T> 
     protected BuildInOwbBean(WebBeansType webBeanType)
     {
         this(webBeanType, null);
+        initBuildInBeanConfig(getWebBeansContext());
     }
 
     @SuppressWarnings("unchecked")
     protected BuildInOwbBean(WebBeansType webBeansType, Class<T> returnType)
     {
         super(webBeansType, returnType);
+        initBuildInBeanConfig(getWebBeansContext());
         this.handlerClassName = proxyHandlerMap.get(this.getWebBeansType());
         if (handlerClassName.equalsIgnoreCase(PROXY_HANDLER_VALUE_NONE) ||
                 handlerClassName.equalsIgnoreCase(PROXY_HANDLER_VALUE_DEFAULT)) 
@@ -301,7 +302,8 @@ public abstract class BuildInOwbBean<T> 
             if(s.readLong() == serialVersionUID) 
             {
                 String id = (String)s.readObject();
-                bean = (BuildInOwbBean<T>)BeanManagerImpl.getManager().getPassivationCapableBean(id);
+                WebBeansContext webBeansContext = WebBeansContext.getInstance();
+                bean = (BuildInOwbBean<T>)webBeansContext.getBeanManagerImpl().getPassivationCapableBean(id);
                 // create new real instance after deserialized.
                 actualObject = bean.createActualInstance(null);
             } 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java?rev=1057448&r1=1057447&r2=1057448&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
Tue Jan 11 02:10:20 2011
@@ -25,6 +25,7 @@ import java.util.Set;
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.*;
+import org.apache.webbeans.config.WebBeansContext;
 
 /**
  * OWB specific extension of the {@link Bean} interface.
@@ -205,4 +206,6 @@ public interface OwbBean<T> extends Bean
      * @throws org.apache.webbeans.exception.WebBeansConfigurationException if not satisfy
passivation dependencies
      */
     public void validatePassivationDependencies();
+
+    public WebBeansContext getWebBeansContext();
 }
\ No newline at end of file

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=1057448&r1=1057447&r2=1057448&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
Tue Jan 11 02:10:20 2011
@@ -139,7 +139,7 @@ public class BeansDeployer
                 //Default jndi is just a map
                 if(service instanceof DefaultJndiService)
                 {
-                    service.bind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME, new InjectableBeanManager());
+                    service.bind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME, new InjectableBeanManager(webBeansContext.getBeanManagerImpl()));
                 }
                 //Assume, actual JNDI implementation
                 else

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java?rev=1057448&r1=1057447&r2=1057448&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectableBeanManager.java
Tue Jan 11 02:10:20 2011
@@ -61,7 +61,13 @@ public class InjectableBeanManager imple
     private static final long serialVersionUID = 1L;
     
     private transient BeanManager bm;
-    
+
+    public InjectableBeanManager(BeanManager bm)
+    {
+        this.bm = bm;
+    }
+
+
     public InjectableBeanManager()
     {
         this.bm = WebBeansContext.getInstance().getBeanManagerImpl();
@@ -223,9 +229,11 @@ public class InjectableBeanManager imple
     }
 
     @Override
+    @SuppressWarnings("deprecated")
     public void readExternal(ObjectInput in) throws IOException,
             ClassNotFoundException 
     {
+        //static lookup required for bean manager
         this.bm = WebBeansContext.getInstance().getBeanManagerImpl();
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerObjectFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerObjectFactory.java?rev=1057448&r1=1057447&r2=1057448&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerObjectFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerObjectFactory.java
Tue Jan 11 02:10:20 2011
@@ -23,13 +23,14 @@ import java.util.Hashtable;
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.spi.ObjectFactory;
+import org.apache.webbeans.config.WebBeansContext;
 
 public class ManagerObjectFactory implements ObjectFactory
 {
 
     public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,
?> environment) throws Exception
     {
-        return new InjectableBeanManager();
+        return new InjectableBeanManager(WebBeansContext.getInstance().getBeanManagerImpl());
     }
 
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java?rev=1057448&r1=1057447&r2=1057448&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverMethodImpl.java
Tue Jan 11 02:10:20 2011
@@ -50,7 +50,6 @@ import org.apache.webbeans.component.Inj
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
-import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.inject.impl.InjectionPointFactory;
 import org.apache.webbeans.logger.WebBeansLogger;
@@ -133,9 +132,9 @@ public class ObserverMethodImpl<T> imple
         this.ifExist = ifExist;
 
         Annotation[] qualifiers =
-            WebBeansContext.getInstance().getAnnotationManager().getMethodFirstParameterQualifierWithGivenAnnotation(
+            getWebBeansContext().getAnnotationManager().getMethodFirstParameterQualifierWithGivenAnnotation(
                 observerMethod, Observes.class);
-        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifiers);
+        getWebBeansContext().getAnnotationManager().checkQualifierConditions(qualifiers);
         this.observedQualifiers = new HashSet<Annotation>(qualifiers.length);
         
         for (Annotation qualifier : qualifiers)
@@ -372,7 +371,7 @@ public class ObserverMethodImpl<T> imple
                     InjectionPoint point = InjectionPointFactory.getPartialInjectionPoint(this.bean,
type, this.observerMethod, annotatedParameter, bindingTypes);
                     
                     //Injected Bean
-                    Bean<Object> injectedBean = (Bean<Object>)InjectionResolver.getInstance().getInjectionPointBean(point);
+                    Bean<Object> injectedBean = (Bean<Object>)getWebBeansContext().getBeanManagerImpl().getInjectionResolver().getInjectionPointBean(point);
                     
                     //Set for @Inject InjectionPoint
                     if(WebBeansUtil.isDependent(injectedBean))
@@ -434,7 +433,7 @@ public class ObserverMethodImpl<T> imple
 
                 //Get observer parameter instance
                 @SuppressWarnings("unchecked")
-                Bean<Object> injectedBean = (Bean<Object>)InjectionResolver.getInstance().getInjectionPointBean(point);
+                Bean<Object> injectedBean = (Bean<Object>)getWebBeansContext().getBeanManagerImpl().getInjectionResolver().getInjectionPointBean(point);
 
                 //Set for @Inject InjectionPoint
                 if(WebBeansUtil.isDependent(injectedBean))
@@ -506,4 +505,8 @@ public class ObserverMethodImpl<T> imple
         return this.observerMethod;
     }
 
+    protected WebBeansContext getWebBeansContext()
+    {
+        return bean.getWebBeansContext();
+    }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java?rev=1057448&r1=1057447&r2=1057448&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
Tue Jan 11 02:10:20 2011
@@ -26,9 +26,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.webbeans.component.InjectionTargetBean;
-import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
-import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.event.ObserverMethodImpl;
 import org.apache.webbeans.inject.xml.XMLInjectionPointModel;
 
@@ -53,13 +51,16 @@ public class BeanObserverXMLImpl<T> exte
     protected List getMethodArguments(Object event)
     {
         List<Object> params = new ArrayList<Object>();
-        BeanManagerImpl manager = WebBeansContext.getInstance().getBeanManagerImpl();
+        BeanManagerImpl manager = getWebBeansContext().getBeanManagerImpl();
         for (XMLInjectionPointModel model : observersParameters)
         {
             Set<Annotation> setBindingTypes = model.getBindingTypes();
             Annotation[] anns = new Annotation[setBindingTypes.size()];
             anns = setBindingTypes.toArray(anns);
-            params.add(manager.getInstance(InjectionResolver.getInstance().implResolveByType(model.getInjectionGenericType(),
anns).iterator().next(),null));
+            params.add(manager.getInstance(
+                    getWebBeansContext().getBeanManagerImpl().getInjectionResolver()
+                            .implResolveByType(model.getInjectionGenericType(), anns)
+                            .iterator().next(),null));
         }
 
         return params;



Mime
View raw message