geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1064377 - in /geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb: EjbModuleImpl.java ThreadSingletonServiceAdapter.java
Date Fri, 28 Jan 2011 00:14:55 GMT
Author: djencks
Date: Fri Jan 28 00:14:55 2011
New Revision: 1064377

URL: http://svn.apache.org/viewvc?rev=1064377&view=rev
Log:
adapt to openejb rev 1064376 removing the OWBContext wrapper

Modified:
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
    geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/ThreadSingletonServiceAdapter.java

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java?rev=1064377&r1=1064376&r2=1064377&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/EjbModuleImpl.java
Fri Jan 28 00:14:55 2011
@@ -48,7 +48,6 @@ import org.apache.openejb.BeanContext;
 import org.apache.openejb.NoSuchApplicationException;
 import org.apache.openejb.UndeployException;
 import org.apache.openejb.assembler.classic.AppInfo;
-import org.apache.openejb.cdi.OWBContext;
 import org.apache.webbeans.config.WebBeansContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -176,7 +175,7 @@ public class EjbModuleImpl implements EJ
         if (appContext == null) {
             throw new IllegalStateException("Not started");
         }
-        return appContext.get(OWBContext.class).getWebBeansContext();
+        return appContext.get(WebBeansContext.class);
     }
 
     public void doStart() throws Exception {

Modified: geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/ThreadSingletonServiceAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/ThreadSingletonServiceAdapter.java?rev=1064377&r1=1064376&r2=1064377&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/ThreadSingletonServiceAdapter.java
(original)
+++ geronimo/server/trunk/plugins/openejb/geronimo-openejb/src/main/java/org/apache/geronimo/openejb/ThreadSingletonServiceAdapter.java
Fri Jan 28 00:14:55 2011
@@ -25,7 +25,6 @@ import org.apache.geronimo.openwebbeans.
 import org.apache.geronimo.openwebbeans.OsgiMetaDataScannerService;
 import org.apache.openejb.cdi.CdiAppContextsService;
 import org.apache.openejb.cdi.CdiResourceInjectionService;
-import org.apache.openejb.cdi.OWBContext;
 import org.apache.openejb.cdi.OpenEJBLifecycle;
 import org.apache.openejb.cdi.StartupObject;
 import org.apache.openejb.cdi.ThreadSingletonService;
@@ -37,7 +36,10 @@ import org.apache.webbeans.spi.ResourceI
 /**
  * @version $Rev$ $Date$
  */
-public class ThreadSingletonServiceAdapter extends GeronimoSingletonService implements ThreadSingletonService
{
+public class ThreadSingletonServiceAdapter implements ThreadSingletonService {
+
+    private final GeronimoSingletonService geronimoSingletonService = new GeronimoSingletonService();
+
     public ThreadSingletonServiceAdapter() {
         super();
     }
@@ -45,28 +47,29 @@ public class ThreadSingletonServiceAdapt
     @Override
     public void initialize(StartupObject startupObject) {
         //share owb singletons
-        OWBContext owbContext = new OWBContext();
-        Object old = contextEntered(owbContext);
-        try {
-            if (old == null) {
-                //not embedded. Are we the first ejb module to try this?
-                if (startupObject.getAppContext().get(OWBContext.class) == null) {
-                    startupObject.getAppContext().set(OWBContext.class, owbContext);
-                    WebBeansContext webBeansContext = owbContext.getWebBeansContext();
+        WebBeansContext webBeansContext = startupObject.getAppContext().get(WebBeansContext.class);
+        if (webBeansContext == null) {
+            webBeansContext = new WebBeansContext();
+            Object old = contextEntered(webBeansContext);
+            try {
+                if (old == null) {
+                    //not embedded. Are we the first ejb module to try this?
+                    startupObject.getAppContext().set(WebBeansContext.class, webBeansContext);
                     setConfiguration(webBeansContext.getOpenWebBeansConfiguration());
                     try {
                         webBeansContext.getService(ContainerLifecycle.class).startApplication(startupObject);
                     } catch (Exception e) {
                         throw new RuntimeException("couldn't start owb context", e);
                     }
+                    // an existing OWBConfiguration will have already been initialized
+                } else {
+                    startupObject.getAppContext().set(WebBeansContext.class, (WebBeansContext)
old);
                 }
-                // an existing OWBConfiguration will have already been initialized
-            } else {
-                startupObject.getAppContext().set(OWBContext.class, new OWBContext((WebBeansContext)
old));
+            } finally {
+                contextExited(old);
             }
-        } finally {
-            contextExited(old);
         }
+
     }
 
     private void setConfiguration(OpenWebBeansConfiguration configuration) {
@@ -83,8 +86,8 @@ public class ThreadSingletonServiceAdapt
     }
 
     @Override
-    public Object contextEntered(org.apache.openejb.cdi.OWBContext owbContext) {
-        return GeronimoSingletonService.contextEntered(owbContext.getWebBeansContext());
+    public Object contextEntered(WebBeansContext owbContext) {
+        return GeronimoSingletonService.contextEntered(owbContext);
     }
 
     @Override
@@ -92,4 +95,14 @@ public class ThreadSingletonServiceAdapt
         if (oldContext != null && !(oldContext instanceof WebBeansContext)) throw
new IllegalArgumentException("Expecting a WebBeansContext not " + oldContext.getClass().getName());
         GeronimoSingletonService.contextExited((WebBeansContext) oldContext);
     }
+
+    @Override
+    public WebBeansContext get(Object key) {
+        return geronimoSingletonService.get(key);
+    }
+
+    @Override
+    public void clear(Object key) {
+        geronimoSingletonService.clear(key);
+    }
 }



Mime
View raw message