myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r964139 - in /myfaces/extensions/cdi/trunk: core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ core/impl/src/main/jav...
Date Wed, 14 Jul 2010 19:12:36 GMT
Author: gpetracek
Date: Wed Jul 14 19:12:36 2010
New Revision: 964139

URL: http://svn.apache.org/viewvc?rev=964139&view=rev
Log:
EXTCDI-1, EXTCDI-2 and EXTCDI-3 cleanup

Removed:
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanAccessedEvent.java
Modified:
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/BeanStorage.java

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java?rev=964139&r1=964138&r2=964139&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java
(original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java
Wed Jul 14 19:12:36 2010
@@ -18,8 +18,6 @@
  */
 package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation;
 
-import org.apache.myfaces.extensions.cdi.core.api.manager.BeanManagerProvider;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.BeanAccessedEvent;
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager;
@@ -30,7 +28,6 @@ import javax.enterprise.context.spi.Cont
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
-import java.io.Serializable;
 import java.lang.annotation.Annotation;
 
 /**
@@ -92,12 +89,6 @@ public abstract class AbstractConversati
 
             T foundBeanInstance = resolveBeanInstance(windowContextManager, bean);
 
-            if (foundBeanInstance != null)
-            {
-                BeanManagerProvider.getInstance().getBeanManager()
-                        .fireEvent(new BeanAccessedEvent((Serializable) foundBeanInstance));
-            }
-
             return foundBeanInstance;
         }
         throw new IllegalStateException(component.getClass() + " is no valid conversation
scoped bean");

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java?rev=964139&r1=964138&r2=964139&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java
(original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java
Wed Jul 14 19:12:36 2010
@@ -35,9 +35,12 @@ class ConversationBeanEntry<T> implement
 
     private T currentBeanInstance;
 
+    private CreationalContext<T> creationalContext;
+
     ConversationBeanEntry(CreationalContext<T> creationalContext, Bean<T> bean)
     {
         this.bean = bean;
+        this.creationalContext = creationalContext;
         this.currentBeanInstance = createNewInstanceOfBean(bean, creationalContext);
     }
 
@@ -46,11 +49,16 @@ class ConversationBeanEntry<T> implement
         return this.bean;
     }
 
+    public CreationalContext<T> getCreationalContext()
+    {
+        return creationalContext;
+    }
+
     public T getBeanInstance()
     {
         if (this.currentBeanInstance == null)
         {
-            this.currentBeanInstance = createNewInstanceOfBean(this.bean);
+            this.currentBeanInstance = createNewInstanceOfBean(this.creationalContext, this.bean);
         }
         return this.currentBeanInstance;
     }

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java?rev=964139&r1=964138&r2=964139&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java
(original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java
Wed Jul 14 19:12:36 2010
@@ -19,6 +19,7 @@
 package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi;
 
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.context.spi.CreationalContext;
 import java.io.Serializable;
 
 /**
@@ -26,7 +27,9 @@ import java.io.Serializable;
  */
 public interface BeanEntry<T> extends Serializable
 {
-    Bean getBean();
+    Bean<T> getBean();
+
+    CreationalContext<T> getCreationalContext();
 
     T getBeanInstance();
 

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java?rev=964139&r1=964138&r2=964139&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java
(original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java
Wed Jul 14 19:12:36 2010
@@ -38,12 +38,8 @@ public class CodiUtils
 {
     public static final String CODI_PROPERTIES = "/META-INF/extcdi/extcdi.properties";
 
-    public static <T> T createNewInstanceOfBean(Bean<T> bean)
+    public static <T> T createNewInstanceOfBean(CreationalContext<T> creationalContext,
Bean<T> bean)
     {
-        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
-
-        CreationalContext<T> creationalContext = getCreationalContextFor(beanManager,
bean);
-
         return createNewInstanceOfBean(bean, creationalContext);
     }
 
@@ -66,12 +62,8 @@ public class CodiUtils
         return result;
     }
 
-    public static <T> void destroyBean(Bean<T> bean, T beanInstance)
+    public static <T> void destroyBean(CreationalContext<T> creationalContext,
Bean<T> bean, T beanInstance)
     {
-        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
-
-        CreationalContext<T> creationalContext = getCreationalContextFor(beanManager,
bean);
-
         bean.destroy(beanInstance, creationalContext);
     }
 

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/BeanStorage.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/BeanStorage.java?rev=964139&r1=964138&r2=964139&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/BeanStorage.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/BeanStorage.java
Wed Jul 14 19:12:36 2010
@@ -24,7 +24,6 @@ import org.apache.myfaces.extensions.cdi
 import static org.apache.myfaces.extensions.cdi.core.impl.utils.CodiUtils.destroyBean;
 
 import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.Bean;
 import java.io.Serializable;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -81,16 +80,15 @@ class BeanStorage implements Serializabl
         for (BeanEntry<Serializable> beanHolder : this.beanMap.values())
         {
             oldBeanInstance = beanHolder.resetBeanInstance();
-            fireUnscopeBeanEvent(oldBeanInstance, beanHolder.getBean());
+            fireUnscopeBeanEvent(oldBeanInstance, beanHolder);
         }
     }
 
-    //TODO PreDestroy
-    private <T extends Serializable> void fireUnscopeBeanEvent(T instance, Bean<T>
bean)
+    private <T extends Serializable> void fireUnscopeBeanEvent(T instance, BeanEntry<T>
beanHolder)
     {
         getOrCreateBeanManager().fireEvent(new UnscopeBeanEvent(instance));
 
-        destroyBean(bean, instance);
+        destroyBean(beanHolder.getCreationalContext(), beanHolder.getBean(), instance);
     }
 
     private BeanManager getOrCreateBeanManager()



Mime
View raw message