myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r962956 - 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/spi/ jee-modules/jsf-mo...
Date Sun, 11 Jul 2010 00:27:47 GMT
Author: gpetracek
Date: Sun Jul 11 00:27:47 2010
New Revision: 962956

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

Added:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/spi/
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/spi/InactiveConversationsAwareWindowContext.java
Removed:
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationContextFactory.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationFactory.java
Modified:
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/InterceptedResponseWriter.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/JsfWindowContext.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowContextIdHolderComponent.java

Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java?rev=962956&r1=962955&r2=962956&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java
(original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java
Sun Jul 11 00:27:47 2010
@@ -27,18 +27,10 @@ import java.io.Serializable;
  */
 public interface Conversation extends Serializable
 {
-    //TODO move down
-    boolean isActive();
-
-    //TODO move down
-    void deactivate();
-
     void end();
 
     void restart();
 
-    //Map<Class, Serializable> getBeans();
-
     <T> T getBean(Class<T> key);
 }
 

Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java?rev=962956&r1=962955&r2=962956&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java
(original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java
Sun Jul 11 00:27:47 2010
@@ -68,7 +68,4 @@ public interface WindowContext extends A
      * @return configuration of the current context
      */
     WindowContextConfig getConfig();
-
-    //TODO move down
-    void cleanup();
 }

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.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/EditableConversation.java?rev=962956&r1=962955&r2=962956&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.java
(original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.java
Sun Jul 11 00:27:47 2010
@@ -23,5 +23,9 @@ package org.apache.myfaces.extensions.cd
  */
 public interface EditableConversation
 {
+    boolean isActive();
+
+    void deactivate();
+
     <T> void addBean(Class<?> beanClass, BeanEntry<T> beanInstance);
 }

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.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/DefaultWindowContextManager.java?rev=962956&r1=962955&r2=962956&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java
Sun Jul 11 00:27:47 2010
@@ -23,11 +23,13 @@ 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.WindowContextConfig;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager;
+import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.EditableConversation;
 import org.apache.myfaces.extensions.cdi.javaee.jsf.api.listener.phase.AfterPhase;
 import org.apache.myfaces.extensions.cdi.javaee.jsf.api.listener.phase.PhaseId;
 import org.apache.myfaces.extensions.cdi.javaee.jsf.api.request.RequestTypeResolver;
 import org.apache.myfaces.extensions.cdi.javaee.jsf.impl.util.ConversationUtils;
 import static org.apache.myfaces.extensions.cdi.javaee.jsf.impl.util.ConversationUtils.resolveWindowContextId;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.spi.InactiveConversationsAwareWindowContext;
 
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.RequestScoped;
@@ -64,12 +66,12 @@ public class DefaultWindowContextManager
     @SuppressWarnings({"UnusedDeclaration"})
     private ConfigResolver configResolver;
 
-    private WindowContextConfig conversationContextConfig;
+    private WindowContextConfig windowContextConfig;
 
     @PostConstruct
     protected void init()
     {
-        conversationContextConfig = this.configResolver.resolve(WindowContextConfig.class);
+        windowContextConfig = this.configResolver.resolve(WindowContextConfig.class);
     }
 
     //don't change/optimize this observer!!!
@@ -101,17 +103,19 @@ public class DefaultWindowContextManager
             return;
         }
 
-        for (WindowContext conversationContext : this.windowContextMap.values())
+        for (WindowContext windowContext : this.windowContextMap.values())
         {
-            for (Conversation conversation : conversationContext.getConversations().values())
+            for (Conversation conversation : windowContext.getConversations().values())
             {
-                if (!conversation.isActive())
+                //TODO
+                if (!((EditableConversation)conversation).isActive())
                 {
                     conversation.end();
                 }
             }
 
-            conversationContext.cleanup();
+            //TODO
+            ((InactiveConversationsAwareWindowContext)windowContext).removeInactiveConversations();
         }
     }
 
@@ -126,7 +130,7 @@ public class DefaultWindowContextManager
     //TODO improve performance
     public WindowContext getCurrentWindowContext()
     {
-        Long windowContextId = resolveWindowContextId(this.conversationContextConfig.isGetRequestParameterSupported());
+        Long windowContextId = resolveWindowContextId(this.windowContextConfig.isGetRequestParameterSupported());
 
         if (windowContextId == null)
         {
@@ -144,7 +148,7 @@ public class DefaultWindowContextManager
 
             if (result == null)
             {
-                result = new JsfWindowContext(windowContextId, this.conversationContextConfig);
+                result = new JsfWindowContext(windowContextId, this.windowContextConfig);
 
                 this.windowContextMap.put(windowContextId, result);
             }
@@ -157,18 +161,18 @@ public class DefaultWindowContextManager
         activateWindowContext(getWindowContext(id));
     }
 
-    public void activateWindowContext(WindowContext conversationContext)
+    public void activateWindowContext(WindowContext windowContext)
     {
         FacesContext facesContext = FacesContext.getCurrentInstance();
-        WindowContextIdHolderComponent conversationContextIdHolder =
+        WindowContextIdHolderComponent windowContextIdHolder =
                 ConversationUtils.getWindowContextIdHolderComponent(facesContext);
 
-        if (conversationContextIdHolder != null)
+        if (windowContextIdHolder != null)
         {
-            conversationContextIdHolder.changeWindowContextId(conversationContext.getId());
+            windowContextIdHolder.changeWindowContextId(windowContext.getId());
         }
 
-        setWindowContextIdOfRequest(facesContext, conversationContext.getId());
+        setWindowContextIdOfRequest(facesContext, windowContext.getId());
     }
 
     //TODO
@@ -205,8 +209,10 @@ public class DefaultWindowContextManager
     {
         for (Conversation conversation : windowContext.getConversations().values())
         {
-            conversation.deactivate();
-            if (!conversation.isActive()) //it isn't possible to deactivate window scoped
conversations
+            //TODO
+            ((EditableConversation)conversation).deactivate();
+             //it isn't possible to deactivate window scoped conversations
+            if (!((EditableConversation)conversation).isActive())
             {
                 conversation.restart();
             }
@@ -223,15 +229,15 @@ public class DefaultWindowContextManager
         removeWindowContext(getWindowContext(id));
     }
 
-    public void removeWindowContext(WindowContext conversationContext)
+    public void removeWindowContext(WindowContext windowContext)
     {
-        this.windowContextMap.remove(conversationContext.getId());
+        this.windowContextMap.remove(windowContext.getId());
 
         FacesContext facesContext = FacesContext.getCurrentInstance();
-        removeConversationContextIdHolderComponent(facesContext);
+        removeWindowContextIdHolderComponent(facesContext);
         setWindowContextIdOfRequest(facesContext, null);
 
-        conversationContext.endConversations();
+        windowContext.endConversations();
     }
 
 
@@ -247,7 +253,7 @@ public class DefaultWindowContextManager
         requestMap.remove(WindowContextManager.WINDOW_CONTEXT_ID_PARAMETER_KEY);
     }
 
-    private void removeConversationContextIdHolderComponent(FacesContext facesContext)
+    private void removeWindowContextIdHolderComponent(FacesContext facesContext)
     {
         Iterator<UIComponent> uiComponents = facesContext.getViewRoot().getChildren().iterator();
 

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/InterceptedResponseWriter.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/InterceptedResponseWriter.java?rev=962956&r1=962955&r2=962956&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/InterceptedResponseWriter.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/InterceptedResponseWriter.java
Sun Jul 11 00:27:47 2010
@@ -63,10 +63,10 @@ class InterceptedResponseWriter extends 
     private void addWindowContextIdHolderComponent()
     {
         FacesContext.getCurrentInstance().getViewRoot().getChildren()
-                .add(createComponentWithCurrentConversationContextId());
+                .add(createComponentWithCurrentWindowContextId());
     }
 
-    private WindowContextIdHolderComponent createComponentWithCurrentConversationContextId()
+    private WindowContextIdHolderComponent createComponentWithCurrentWindowContextId()
     {
         Bean<WindowContextManager> conversationManagerBean = ConversationUtils.resolveConversationManagerBean();
 

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/JsfWindowContext.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/JsfWindowContext.java?rev=962956&r1=962955&r2=962956&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/JsfWindowContext.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/JsfWindowContext.java
Sun Jul 11 00:27:47 2010
@@ -21,6 +21,8 @@ package org.apache.myfaces.extensions.cd
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Conversation;
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContextConfig;
+import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.EditableConversation;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.spi.InactiveConversationsAwareWindowContext;
 
 import java.util.Collections;
 import java.util.Iterator;
@@ -32,7 +34,7 @@ import java.util.concurrent.ConcurrentHa
  *
  * @author Gerhard Petracek
  */
-public class JsfWindowContext implements WindowContext
+public class JsfWindowContext implements WindowContext, InactiveConversationsAwareWindowContext
 {
     private static final long serialVersionUID = 5272798129165017829L;
 
@@ -42,9 +44,9 @@ public class JsfWindowContext implements
 
     private final Map<Class, Conversation> groupedConversations = new ConcurrentHashMap<Class,
Conversation>();
 
-    public JsfWindowContext(Long conversationContextId, WindowContextConfig config)
+    public JsfWindowContext(Long windowContextId, WindowContextConfig config)
     {
-        this.id = conversationContextId;
+        this.id = windowContextId;
         this.config = config;
     }
 
@@ -65,7 +67,8 @@ public class JsfWindowContext implements
     {
         Conversation conversation = this.groupedConversations.get(conversationGroupKey);
 
-        if (conversation != null && !conversation.isActive())
+        //TODO
+        if (conversation != null && !((EditableConversation)conversation).isActive())
         {
             endAndRemoveConversation(conversationGroupKey, conversation);
             conversation = null;
@@ -87,7 +90,8 @@ public class JsfWindowContext implements
 
     public Conversation endAndRemoveConversation(Class conversationGroupKey, Conversation
conversation)
     {
-        if (conversation.isActive())
+        //TODO
+        if (((EditableConversation)conversation).isActive())
         {
             conversation.end();
         }
@@ -110,7 +114,7 @@ public class JsfWindowContext implements
         return this.config;
     }
 
-    public void cleanup()
+    public void removeInactiveConversations()
     {
         Iterator<Conversation> conversations = this.groupedConversations.values().iterator();
 
@@ -119,7 +123,8 @@ public class JsfWindowContext implements
         {
             conversation = conversations.next();
 
-            if (!conversation.isActive())
+            //TODO
+            if (!((EditableConversation)conversation).isActive())
             {
                 conversations.remove();
             }

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowContextIdHolderComponent.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/WindowContextIdHolderComponent.java?rev=962956&r1=962955&r2=962956&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowContextIdHolderComponent.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowContextIdHolderComponent.java
Sun Jul 11 00:27:47 2010
@@ -69,8 +69,8 @@ public class WindowContextIdHolderCompon
         return windowContextId;
     }
 
-    void changeWindowContextId(long conversationContextId)
+    void changeWindowContextId(long windowContextId)
     {
-        this.windowContextId = conversationContextId;
+        this.windowContextId = windowContextId;
     }
 }

Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/spi/InactiveConversationsAwareWindowContext.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/spi/InactiveConversationsAwareWindowContext.java?rev=962956&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/spi/InactiveConversationsAwareWindowContext.java
(added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/spi/InactiveConversationsAwareWindowContext.java
Sun Jul 11 00:27:47 2010
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.spi;
+
+/**
+ * @author Gerhard Petracek
+ */
+public interface InactiveConversationsAwareWindowContext
+{
+    void removeInactiveConversations();
+}



Mime
View raw message