myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1073179 - in /myfaces/extensions/cdi/trunk/jee-modules: jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/ jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ jsf20-module/im...
Date Mon, 21 Feb 2011 23:03:57 GMT
Author: gpetracek
Date: Mon Feb 21 23:03:57 2011
New Revision: 1073179

URL: http://svn.apache.org/viewvc?rev=1073179&view=rev
Log:
EXTCDI-124 cleanup

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java?rev=1073179&r1=1073178&r2=1073179&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java
Mon Feb 21 23:03:57 2011
@@ -23,20 +23,13 @@ import org.apache.myfaces.extensions.cdi
 import org.apache.myfaces.extensions.cdi.jsf.impl.listener.startup.ApplicationStartupBroadcaster;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.WindowHandler;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.LifecycleAwareWindowHandler;
-import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContextManager;
-import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.ViewAccessConversationExpirationEvaluatorRegistry;
 import org.apache.myfaces.extensions.cdi.core.impl.util.CodiUtils;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig;
-import org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider;
-import org.apache.myfaces.extensions.cdi.jsf.impl.util.RequestCache;
-import static org.apache.myfaces.extensions.cdi.jsf.impl.util.ConversationUtils.storeCurrentViewIdAsOldViewId;
-import static org.apache.myfaces.extensions.cdi.jsf.impl.util.ConversationUtils.cleanupInactiveWindowContexts;
+import org.apache.myfaces.extensions.cdi.jsf.impl.util.ConversationUtils;
 
 import javax.faces.lifecycle.Lifecycle;
 import javax.faces.event.PhaseListener;
 import javax.faces.context.FacesContext;
 import javax.faces.FacesException;
-import javax.enterprise.inject.spi.BeanManager;
 import java.util.List;
 
 /**
@@ -106,32 +99,7 @@ class CodiLifecycleWrapper extends Lifec
     {
         wrapped.render(facesContext);
 
-        //don't move it to an observer
-        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
-
-        EditableWindowContextManager windowContextManager =
-                CodiUtils.getContextualReferenceByClass(beanManager, EditableWindowContextManager.class);
-
-        WindowContextConfig windowContextConfig =
-                CodiUtils.getContextualReferenceByClass(beanManager, WindowContextConfig.class);
-
-        ViewAccessConversationExpirationEvaluatorRegistry registry =
-                CodiUtils.getContextualReferenceByClass(
-                        beanManager, ViewAccessConversationExpirationEvaluatorRegistry.class);
-
-        registry.broadcastRenderedViewId(facesContext.getViewRoot().getViewId());
-
-        storeCurrentViewIdAsOldViewId(facesContext);
-
-        if(windowContextConfig.isCloseEmptyWindowContextsEnabled())
-        {
-            cleanupInactiveWindowContexts(windowContextManager);
-        }
-
-        //if the cache would get resetted by an observer or a phase-listener
-        //it might be the case that a 2nd observer accesses the cache again and afterwards
there won't be a cleanup
-        //-> don't remove:
-        RequestCache.resetCache();
+        ConversationUtils.postRenderCleanup(facesContext);
     }
 
     private void broadcastApplicationStartupBroadcaster()

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java?rev=1073179&r1=1073178&r2=1073179&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/util/ConversationUtils.java
Mon Feb 21 23:03:57 2011
@@ -22,12 +22,15 @@ import org.apache.myfaces.extensions.cdi
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowScoped;
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig;
+import org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager;
 
 import org.apache.myfaces.extensions.cdi.core.impl.util.CodiUtils;
 import org.apache.myfaces.extensions.cdi.jsf.api.config.JsfModuleConfig;
 import org.apache.myfaces.extensions.cdi.jsf.impl.listener.request.FacesMessageEntry;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.WindowContextIdHolderComponent;
+import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.ViewAccessConversationExpirationEvaluatorRegistry;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.WindowHandler;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContextManager;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContext;
@@ -485,4 +488,34 @@ public class ConversationUtils
 
         return false;
     }
+
+    //don't move it to an observer due to an unpredictable invocation order
+    public static void postRenderCleanup(FacesContext facesContext)
+    {
+        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
+
+        EditableWindowContextManager windowContextManager =
+                CodiUtils.getContextualReferenceByClass(beanManager, EditableWindowContextManager.class);
+
+        WindowContextConfig windowContextConfig =
+                CodiUtils.getContextualReferenceByClass(beanManager, WindowContextConfig.class);
+
+        ViewAccessConversationExpirationEvaluatorRegistry registry =
+                CodiUtils.getContextualReferenceByClass(
+                        beanManager, ViewAccessConversationExpirationEvaluatorRegistry.class);
+
+        registry.broadcastRenderedViewId(facesContext.getViewRoot().getViewId());
+
+        storeCurrentViewIdAsOldViewId(facesContext);
+
+        if(windowContextConfig.isCloseEmptyWindowContextsEnabled())
+        {
+            cleanupInactiveWindowContexts(windowContextManager);
+        }
+
+        //if the cache would get resetted by an observer or a phase-listener
+        //it might be the case that a 2nd observer accesses the cache again and afterwards
there won't be a cleanup
+        //-> don't remove:
+        RequestCache.resetCache();
+    }
 }

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java?rev=1073179&r1=1073178&r2=1073179&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java
Mon Feb 21 23:03:57 2011
@@ -20,24 +20,17 @@ package org.apache.myfaces.extensions.cd
 
 import org.apache.myfaces.extensions.cdi.core.impl.util.ClassDeactivation;
 import org.apache.myfaces.extensions.cdi.core.impl.util.CodiUtils;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig;
-import org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider;
 import org.apache.myfaces.extensions.cdi.jsf.impl.listener.request.BeforeAfterFacesRequestBroadcaster;
 import org.apache.myfaces.extensions.cdi.jsf.impl.listener.startup.ApplicationStartupBroadcaster;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.WindowHandler;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.LifecycleAwareWindowHandler;
-import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContextManager;
-import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.ViewAccessConversationExpirationEvaluatorRegistry;
-import org.apache.myfaces.extensions.cdi.jsf.impl.util.RequestCache;
-import static org.apache.myfaces.extensions.cdi.jsf.impl.util.ConversationUtils.storeCurrentViewIdAsOldViewId;
-import static org.apache.myfaces.extensions.cdi.jsf.impl.util.ConversationUtils.cleanupInactiveWindowContexts;
+import org.apache.myfaces.extensions.cdi.jsf.impl.util.ConversationUtils;
 
 
 import javax.faces.FacesException;
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseListener;
 import javax.faces.lifecycle.Lifecycle;
-import javax.enterprise.inject.spi.BeanManager;
 import java.util.List;
 
 /**
@@ -107,32 +100,7 @@ class CodiLifecycleWrapper extends Lifec
     {
         wrapped.render(facesContext);
 
-        //don't move it to an observer
-        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
-
-        EditableWindowContextManager windowContextManager =
-                CodiUtils.getContextualReferenceByClass(beanManager, EditableWindowContextManager.class);
-
-        WindowContextConfig windowContextConfig =
-                CodiUtils.getContextualReferenceByClass(beanManager, WindowContextConfig.class);
-
-        ViewAccessConversationExpirationEvaluatorRegistry registry =
-                CodiUtils.getContextualReferenceByClass(
-                        beanManager, ViewAccessConversationExpirationEvaluatorRegistry.class);
-
-        registry.broadcastRenderedViewId(facesContext.getViewRoot().getViewId());
-
-        storeCurrentViewIdAsOldViewId(facesContext);
-
-        if(windowContextConfig.isCloseEmptyWindowContextsEnabled())
-        {
-            cleanupInactiveWindowContexts(windowContextManager);
-        }
-
-        //if the cache would get resetted by an observer or a phase-listener
-        //it might be the case that a 2nd observer accesses the cache again and afterwards
there won't be a cleanup
-        //-> don't remove:
-        RequestCache.resetCache();
+        ConversationUtils.postRenderCleanup(facesContext);
     }
 
     private void broadcastApplicationStartupBroadcaster()



Mime
View raw message