openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r906724 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: container/BeanManagerImpl.java context/ContextFactory.java context/creational/CreationalContextImpl.java
Date Thu, 04 Feb 2010 23:18:14 GMT
Author: struberg
Date: Thu Feb  4 23:18:14 2010
New Revision: 906724

URL: http://svn.apache.org/viewvc?rev=906724&view=rev
Log:
OWB-6 passivation continued

The serialization of CreationalContext needs polishing though.

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java

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=906724&r1=906723&r2=906724&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
Thu Feb  4 23:18:14 2010
@@ -591,7 +591,12 @@
      */
     @Override
     public <T> CreationalContext<T> createCreationalContext(Contextual<T>
contextual)
-    {        
+    {
+        if (contextual instanceof SerializableBean)
+        {
+            contextual = ((SerializableBean)contextual).getBean();
+        }
+
         return CreationalContextFactory.getInstance().getCreationalContext(contextual);
     }
 
@@ -708,6 +713,11 @@
     {
         Context context = null;
         Object instance = null;
+
+        if (bean instanceof SerializableBean)
+        {
+            bean = ((SerializableBean)bean).getBean();
+        }
         
         //Check type if bean type is given
         if(beanType != null)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java?rev=906724&r1=906723&r2=906724&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
Thu Feb  4 23:18:14 2010
@@ -17,12 +17,7 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.ContextNotActiveException;
-import javax.enterprise.context.ConversationScoped;
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.*;
 import javax.enterprise.context.spi.Context;
 import javax.inject.Singleton;
 import javax.servlet.ServletContext;
@@ -30,6 +25,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
+import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.context.type.ContextTypes;
 import org.apache.webbeans.conversation.ConversationManager;
 
@@ -89,7 +85,7 @@
     /**
      * Initialize requext context with the given request object.
      * 
-     * @param request http servlet request object
+     * @param event http servlet request event
      */
     public static void initRequestContext(ServletRequestEvent event)
     {
@@ -118,6 +114,10 @@
 
     public static Context getCustomContext(Context context)
     {
+        if (BeanManagerImpl.getManager().isPassivatingScope(context.getScope()))
+        {
+            return new CustomPassivatingContextImpl(context);
+        }
         return new CustomContextImpl(context);
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java?rev=906724&r1=906723&r2=906724&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
Thu Feb  4 23:18:14 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.webbeans.context.creational;
 
+import java.io.Serializable;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
@@ -27,11 +28,11 @@
 import org.apache.webbeans.util.Asserts;
 
 /** {@inheritDoc} */
-public class CreationalContextImpl<T> implements CreationalContext<T>
+public class CreationalContextImpl<T> implements CreationalContext<T>, Serializable
 {
-    private Object incompleteInstance = null;
+    private transient Object incompleteInstance = null;
     
-    private Object proxyInstance = null;
+    private transient Object proxyInstance = null;
     
     /**Contextual bean dependent instances*/
     private Map<Object, DependentCreationalContext<?>> dependentObjects = new
WeakHashMap<Object, DependentCreationalContext<?>>();
@@ -40,7 +41,7 @@
     
     private CreationalContextImpl<?> ownerCreational = null;
     
-    private static class DependentCreationalContext<S>
+    private static class DependentCreationalContext<S> implements Serializable
     {
         private CreationalContext<S> creationalContext;
         
@@ -83,8 +84,6 @@
             this.contextual = contextual;
             this.creationalContext = cc;
         }
-        
-        
     }
     
     



Mime
View raw message