tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1064376 - in /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi: CdiBuilder.java OWBContext.java OWBContextThreadListener.java ThreadSingletonServiceImpl.java
Date Fri, 28 Jan 2011 00:13:45 GMT
Author: djencks
Date: Fri Jan 28 00:13:44 2011
New Revision: 1064376

URL: http://svn.apache.org/viewvc?rev=1064376&view=rev
Log:
we dont need the OWBContext wrapper

Removed:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContext.java
Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContextThreadListener.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/ThreadSingletonServiceImpl.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBuilder.java?rev=1064376&r1=1064375&r2=1064376&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBuilder.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiBuilder.java
Fri Jan 28 00:13:44 2011
@@ -47,7 +47,7 @@ public class CdiBuilder {
     }
 
     public static ThreadSingletonService initializeOWB(ClassLoader classLoader) {
-        ThreadSingletonService singletonService = new ThreadSingletonServiceImpl(classLoader);
+        ThreadSingletonService singletonService = new ThreadSingletonServiceImpl();
         logger.info("Created new singletonService " + singletonService);
         SystemInstance.get().setComponent(ThreadSingletonService.class, singletonService);
         try {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContextThreadListener.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContextThreadListener.java?rev=1064376&r1=1064375&r2=1064376&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContextThreadListener.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/cdi/OWBContextThreadListener.java
Fri Jan 28 00:13:44 2011
@@ -26,6 +26,7 @@ import org.apache.openejb.ModuleContext;
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.core.ThreadContextListener;
 import org.apache.openejb.loader.SystemInstance;
+import org.apache.webbeans.config.WebBeansContext;
 
 /**
  * @version $Rev:$ $Date:$
@@ -42,9 +43,9 @@ public class OWBContextThreadListener im
         //TODO its not clear what the scope for one of these context should be: ejb, module,
or app
         //For now, go with the attachment of the BeanManager to AppContext
         AppContext appContext = moduleContext.getAppContext();
-        OWBContext owbContext = appContext.get(OWBContext.class);
+        WebBeansContext owbContext = appContext.get(WebBeansContext.class);
         if (owbContext == null) {
-            throw new IllegalStateException("OWBContext not initialized in appContext " +
appContext);
+            throw new IllegalStateException("WebBeansContext not initialized in appContext
" + appContext);
         }
         Object oldOWBContext = singletonService.contextEntered(owbContext);
         OWBContextHolder holder = new OWBContextHolder(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=1064376&r1=1064375&r2=1064376&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
Fri Jan 28 00:13:44 2011
@@ -34,22 +34,19 @@ public class ThreadSingletonServiceImpl 
 
     public static final Logger logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, ThreadSingletonServiceImpl.class);
     //this needs to be static because OWB won't tell us what the existing SingletonService
is and you can't set it twice.
-    private static final ThreadLocal<OWBContext> contexts = new ThreadLocal<OWBContext>();
-    private final ClassLoader classLoader;
+    private static final ThreadLocal<WebBeansContext> contexts = new ThreadLocal<WebBeansContext>();
 
-    public ThreadSingletonServiceImpl(ClassLoader classLoader) {
-        this.classLoader = classLoader;
+    public ThreadSingletonServiceImpl() {
 
     }
 
     @Override
     public void initialize(StartupObject startupObject) {
         //initialize owb context, cf geronimo's OpenWebBeansGBean
-        OWBContext owbContext = new OWBContext();
-        startupObject.getAppContext().set(OWBContext.class, owbContext);
-        Object old = contextEntered(owbContext);
+        WebBeansContext webBeansContext = new WebBeansContext();
+        startupObject.getAppContext().set(WebBeansContext.class, webBeansContext);
+        Object old = contextEntered(webBeansContext);
         try {
-            WebBeansContext webBeansContext = WebBeansContext.getInstance();
             setConfiguration(webBeansContext.getOpenWebBeansConfiguration());
             try {
                 webBeansContext.getService(ContainerLifecycle.class).startApplication(startupObject);
@@ -76,30 +73,24 @@ public class ThreadSingletonServiceImpl 
     }
 
     @Override
-    public Object contextEntered(OWBContext newOWBContext) {
-        OWBContext oldContext = contexts.get();
+    public Object contextEntered(WebBeansContext newOWBContext) {
+        WebBeansContext oldContext = contexts.get();
         contexts.set(newOWBContext);
         contextMessage(newOWBContext, "Enter:");
         return oldContext;
     }
 
-    private void contextMessage(OWBContext newOWBContext, String prefix) {
+    private void contextMessage(WebBeansContext newOWBContext, String prefix) {
     }
 
     @Override
-    public void contextExited(Object oldOWBContext) {
-        if (oldOWBContext != null && !(oldOWBContext instanceof OWBContext)) throw
new IllegalArgumentException("ThreadSingletonServiceImpl can only be used with OWBContext,
not " + oldOWBContext.getClass().getName());
-        contexts.set((OWBContext) oldOWBContext);
+    public void contextExited(Object oldContext) {
+        if (oldContext != null && !(oldContext instanceof WebBeansContext)) throw
new IllegalArgumentException("ThreadSingletonServiceImpl can only be used with WebBeansContext,
not " + oldContext.getClass().getName());
+        contexts.set((WebBeansContext) oldContext);
     }
 
-//    @Override
-//    public Object get(Object key, String singletonClassName) {
-//        OWBContext context = getContext();
-//        return context.getWebBeansContext().get(singletonClassName);
-//    }
-
-    private OWBContext getContext() {
-        OWBContext context = contexts.get();
+    private WebBeansContext getContext() {
+        WebBeansContext context = contexts.get();
         if (context == null) {
             throw new IllegalStateException("On a thread without an initialized context");
         }
@@ -108,28 +99,13 @@ public class ThreadSingletonServiceImpl 
 
     @Override
     public WebBeansContext get(Object key) {
-        OWBContext context = getContext();
-        return context.getWebBeansContext();
+        return getContext();
     }
 
     @Override
     public void clear(Object key) {
         contextMessage(getContext(), "clearing ");
-        getContext().getWebBeansContext().clear();
+        getContext().clear();
     }
 
-//    @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;
-//    }
 }



Mime
View raw message