tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1056674 - in /openejb/trunk/openejb3/container/openejb-core/src: main/java/org/apache/openejb/cdi/ test/java/org/apache/openejb/cdi/tck/
Date Sat, 08 Jan 2011 09:22:32 GMT
Author: djencks
Date: Sat Jan  8 09:22:29 2011
New Revision: 1056674

URL: http://svn.apache.org/viewvc?rev=1056674&view=rev
Log:
OWB-503 related changes including adapting to newly non-static ContextFactory methods

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContext.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/cdi/tck/ServiceProviders.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java?rev=1056674&r1=1056673&r2=1056674&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
Sat Jan  8 09:22:29 2011
@@ -30,6 +30,7 @@ import org.apache.webbeans.config.WebBea
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.ee.event.TransactionalEventNotifier;
 import org.apache.webbeans.portable.events.discovery.BeforeShutdownImpl;
+import org.apache.webbeans.spi.ResourceInjectionService;
 import org.apache.webbeans.spi.SecurityService;
 import org.apache.webbeans.spi.TransactionService;
 import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
@@ -59,6 +60,7 @@ public class CdiPlugin extends AbstractO
     private AppContext appContext;
     private Set<Class<?>> beans;
 
+    private WebBeansContext webBeansContext;
     private CdiAppContextsService contexsServices;
 
     @Override
@@ -89,7 +91,8 @@ public class CdiPlugin extends AbstractO
     }
 
     public void startup() {
-        this.contexsServices = (CdiAppContextsService) WebBeansFinder.getSingletonInstance("org.apache.openejb.cdi.CdiAppContextsService",
appContext.getClassLoader());
+        webBeansContext = WebBeansContext.getInstance();
+        this.contexsServices = (CdiAppContextsService) webBeansContext.getContextsService();
         this.contexsServices.init(null);
     }
 
@@ -124,7 +127,7 @@ public class CdiPlugin extends AbstractO
             WebBeansContext.getInstance().getjMSManager().clear();
 
             //Clear the resource injection service
-            CdiResourceInjectionService injectionServices = (CdiResourceInjectionService)
WebBeansFinder.getSingletonInstance("org.apache.openejb.cdi.CdiResourceInjectionService",
appContext.getClassLoader());
+            CdiResourceInjectionService injectionServices = (CdiResourceInjectionService)
webBeansContext.getService(ResourceInjectionService.class);
             injectionServices.clear();
 
             //Clear singleton list

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContext.java?rev=1056674&r1=1056673&r2=1056674&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContext.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContext.java
Sat Jan  8 09:22:29 2011
@@ -40,7 +40,7 @@ public class OWBContext {
         this.webBeansContext = webBeansContext;
     }
 
-    public WebBeansContext getSingletons() {
+    public WebBeansContext getWebBeansContext() {
         return webBeansContext;
     }
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java?rev=1056674&r1=1056673&r2=1056674&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
Sat Jan  8 09:22:29 2011
@@ -44,6 +44,7 @@ import org.apache.webbeans.portable.even
 import org.apache.webbeans.spi.ContainerLifecycle;
 import org.apache.webbeans.spi.ContextsService;
 import org.apache.webbeans.spi.JNDIService;
+import org.apache.webbeans.spi.ResourceInjectionService;
 import org.apache.webbeans.spi.ScannerService;
 import org.apache.webbeans.util.WebBeansConstants;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -116,10 +117,10 @@ public class OpenEJBLifecycle implements
         beforeStartApplication(startupObject);
 
         //Load all plugins
-        WebBeansContext.getInstance().getPluginLoader().startUp();
+        webBeansContext.getPluginLoader().startUp();
 
         //Get Plugin
-        CdiPlugin cdiPlugin = (CdiPlugin) WebBeansContext.getInstance().getPluginLoader().getEjbPlugin();
+        CdiPlugin cdiPlugin = (CdiPlugin) webBeansContext.getPluginLoader().getEjbPlugin();
 
         cdiPlugin.setAppContext(stuff.getAppContext());
 
@@ -129,14 +130,14 @@ public class OpenEJBLifecycle implements
         cdiPlugin.configureDeployments(stuff.getBeanContexts());
 
         //Resournce Injection Service
-        CdiResourceInjectionService injectionService = (CdiResourceInjectionService) WebBeansFinder.getSingletonInstance(CdiResourceInjectionService.class.getName(),
stuff.getAppContext().getClassLoader());
+        CdiResourceInjectionService injectionService = (CdiResourceInjectionService) webBeansContext.getService(ResourceInjectionService.class);
         injectionService.setAppModule(stuff.getAppInfo());
         injectionService.setClassLoader(stuff.getAppContext().getClassLoader());
 
         //Deploy the beans
         try {
             //Load Extensions
-            WebBeansContext.getInstance().getExtensionLoader().loadExtensionServices();
+            webBeansContext.getExtensionLoader().loadExtensionServices();
 
             //Initialize contexts
             this.contextsService.init(startupObject);
@@ -176,7 +177,7 @@ public class OpenEJBLifecycle implements
                 final Class implClass = beanContext.getBeanClass();
 
                 //Define annotation type
-                AnnotatedType<?> annotatedType = WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedType(implClass);
+                AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(implClass);
 
                 //Fires ProcessAnnotatedType
                 ProcessAnnotatedTypeImpl<?> processAnnotatedEvent = WebBeansUtil.fireProcessAnnotatedTypeEvent(annotatedType);
@@ -245,7 +246,7 @@ public class OpenEJBLifecycle implements
         // Start from the class
         for (Class<?> implClass : managedBeans) {
             //Define annotation type
-            AnnotatedType<?> annotatedType = WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedType(implClass);
+            AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(implClass);
 
             //Fires ProcessAnnotatedType
             ProcessAnnotatedTypeImpl<?> processAnnotatedEvent = WebBeansUtil.fireProcessAnnotatedTypeEvent(annotatedType);
@@ -279,22 +280,22 @@ public class OpenEJBLifecycle implements
             jndiService.unbind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME);
 
             //Free all plugin resources
-            WebBeansContext.getInstance().getPluginLoader().shutDown();
+            webBeansContext.getPluginLoader().shutDown();
 
             //Clear extensions
-            WebBeansContext.getInstance().getExtensionLoader().clear();
+            webBeansContext.getExtensionLoader().clear();
 
             //Delete Resolutions Cache
             InjectionResolver.getInstance().clearCaches();
 
             //Delte proxies
-            WebBeansContext.getInstance().getJavassistProxyFactory().clear();
+            webBeansContext.getJavassistProxyFactory().clear();
 
             //Delete AnnotateTypeCache
-            WebBeansContext.getInstance().getAnnotatedElementFactory().clear();
+            webBeansContext.getAnnotatedElementFactory().clear();
 
             //Delete JMS Model Cache
-            WebBeansContext.getInstance().getjMSManager().clear();
+            webBeansContext.getjMSManager().clear();
 
             //After Stop
             afterStopApplication(endObject);

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java?rev=1056674&r1=1056673&r2=1056674&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonService.java
Sat Jan  8 09:22:29 2011
@@ -23,12 +23,13 @@ package org.apache.openejb.cdi;
 import java.util.Map;
 
 import org.apache.openejb.AppContext;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.spi.SingletonService;
 
 /**
  * @version $Rev:$ $Date:$
  */
-public interface ThreadSingletonService extends SingletonService {
+public interface ThreadSingletonService extends SingletonService<WebBeansContext> {
     void initialize(StartupObject startupObject);
     Object contextEntered(OWBContext newOWBContext);
     void contextExited(Object oldOWBContext);

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java?rev=1056674&r1=1056673&r2=1056674&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java
Sat Jan  8 09:22:29 2011
@@ -92,11 +92,11 @@ public class ThreadSingletonServiceImpl 
         contexts.set((OWBContext) oldOWBContext);
     }
 
-    @Override
-    public Object get(Object key, String singletonClassName) {
-        OWBContext context = getContext();
-        return context.getSingletons().get(singletonClassName);
-    }
+//    @Override
+//    public Object get(Object key, String singletonClassName) {
+//        OWBContext context = getContext();
+//        return context.getWebBeansContext().get(singletonClassName);
+//    }
 
     private OWBContext getContext() {
         OWBContext context = contexts.get();
@@ -107,23 +107,29 @@ public class ThreadSingletonServiceImpl 
     }
 
     @Override
-    public void clear(Object key) {
-        contextMessage(getContext(), "clearing ");
-        getContext().getSingletons().clear();
-    }
-
-    @Override
-    public boolean isExist(Object key, String singletonClassName) {
-        throw new UnsupportedOperationException("isExist is never called");
+    public WebBeansContext get(Object key) {
+        OWBContext context = getContext();
+        return context.getWebBeansContext();
     }
 
     @Override
-    public Object getExist(Object key, String singletonClassName) {
-        return getContext().getSingletons().get(singletonClassName);
+    public void clear(Object key) {
+        contextMessage(getContext(), "clearing ");
+        getContext().getWebBeansContext().clear();
     }
 
-    @Override
-    public Object getKey(Object singleton) {
-        return null;
-    }
+//    @Override
+//    public boolean isExist(Object key, String singletonClassName) {
+//        throw new UnsupportedOperationException("isExist is never called");
+//    }
+//
+//    @Override
+//    public Object getExist(Object key, String singletonClassName) {
+//        return getContext().getWebBeansContext().get(singletonClassName);
+//    }
+//
+//    @Override
+//    public Object getKey(Object singleton) {
+//        return null;
+//    }
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/cdi/tck/ServiceProviders.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/cdi/tck/ServiceProviders.java?rev=1056674&r1=1056673&r2=1056674&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/cdi/tck/ServiceProviders.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/cdi/tck/ServiceProviders.java
Sat Jan  8 09:22:29 2011
@@ -38,6 +38,7 @@ import org.apache.openejb.config.AppModu
 import org.apache.openejb.config.ConfigurationFactory;
 import org.apache.openejb.config.EjbModule;
 import org.apache.openejb.jee.EjbJar;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.context.AbstractContext;
 import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.RequestContext;
@@ -71,13 +72,14 @@ public class ServiceProviders {
     public static class ContextsProvider implements org.jboss.jsr299.tck.spi.Contexts<AbstractContext>
{
 
         public AbstractContext getRequestContext() {
-            RequestContext ctx = (RequestContext) ContextFactory.getStandardContext(RequestScoped.class);
+            ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+            RequestContext ctx = (RequestContext) contextFactory.getStandardContext(RequestScoped.class);
 
             if (ctx == null) {
-                ContextFactory.initRequestContext(null);
+                contextFactory.initRequestContext(null);
             }
 
-            return (AbstractContext) ContextFactory.getStandardContext(ContextTypes.REQUEST);
+            return (AbstractContext) contextFactory.getStandardContext(ContextTypes.REQUEST);
         }
 
         public void setActive(AbstractContext context) {
@@ -90,7 +92,8 @@ public class ServiceProviders {
         }
 
         public AbstractContext getDependentContext() {
-            return (AbstractContext) ContextFactory.getStandardContext(ContextTypes.DEPENDENT);
+            ContextFactory contextFactory = WebBeansContext.getInstance().getContextFactory();
+            return (AbstractContext) contextFactory.getStandardContext(ContextTypes.DEPENDENT);
         }
 
         public void destroyContext(AbstractContext context) {



Mime
View raw message