You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by to...@apache.org on 2008/01/08 17:20:38 UTC
svn commit: r610046 - in
/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra:
conversation/ conversation/servlet/ frameworkAdapter/
frameworkAdapter/basic/ frameworkAdapter/local/
Author: tomsp
Date: Tue Jan 8 08:20:36 2008
New Revision: 610046
URL: http://svn.apache.org/viewvc?rev=610046&view=rev
Log:
Resolved ORCHESTRA-14
Modified:
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/servlet/ConversationManagerSessionListener.java
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java
myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java?rev=610046&r1=610045&r2=610046&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/ConversationManager.java Tue Jan 8 08:20:36 2008
@@ -63,9 +63,13 @@
// a HashMap is not thread-safe and this class must be thread-safe.
private final Map conversationContexts = new HashMap();
- protected ConversationManager()
+ // holds the id of the actual session used to for unique identification of this conversationManager instance
+ private String conversationManagerId;
+
+ protected ConversationManager(String conversationManagerId)
{
- // conversationMessager = createMessager();
+ this.conversationManagerId = conversationManagerId;
+ // conversationMessager = createMessager();
}
/**
@@ -107,7 +111,7 @@
{
// TODO: do not call new directly here, as it makes it impossible to configure
// an alternative ConversationManager instance. This is IOC and test unfriendly.
- conversationManager = new ConversationManager();
+ conversationManager = new ConversationManager(frameworkAdapter.getSessionId());
// initialize environmental systems
RequestParameterProviderManager.getInstance().register(new ConversationRequestParameterProvider());
@@ -155,7 +159,15 @@
return conversationContextId;
}
- /**
+ /**
+ *
+ * @return a unique id for this conversationManger instance
+ */
+ public String getConversationManagerId() {
+ return conversationManagerId;
+ }
+
+ /**
* Get the conversation context for the given id
*/
protected ConversationContext getConversationContext(Long conversationContextId)
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/servlet/ConversationManagerSessionListener.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/servlet/ConversationManagerSessionListener.java?rev=610046&r1=610045&r2=610046&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/servlet/ConversationManagerSessionListener.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/servlet/ConversationManagerSessionListener.java Tue Jan 8 08:20:36 2008
@@ -56,7 +56,7 @@
* for more details.
*/
public class ConversationManagerSessionListener
- implements HttpSessionAttributeListener, ServletContextListener, HttpSessionListener
+ implements HttpSessionAttributeListener, ServletContextListener
{
private final static long DEFAULT_CHECK_TIME = 5 * 60 * 1000; // every 5 min
@@ -88,7 +88,7 @@
if (event.getValue() instanceof ConversationManager)
{
conversationWiperThread.addConversationManager(
- event.getSession().getId(),
+ ((ConversationManager) event.getValue()).getConversationManagerId(),
(ConversationManager) event.getValue());
}
}
@@ -97,7 +97,7 @@
{
if (event.getValue() instanceof ConversationManager)
{
- conversationWiperThread.removeConversationManager(event.getSession().getId());
+ conversationWiperThread.removeConversationManager(((ConversationManager) event.getValue()).getConversationManagerId());
}
}
@@ -105,19 +105,11 @@
{
if (event.getValue() instanceof ConversationManager)
{
- conversationWiperThread.addConversationManager(
- event.getSession().getId(),
- (ConversationManager) event.getValue());
+ String id = ((ConversationManager) event.getValue()).getConversationManagerId();
+ ConversationManager newConversationManager = (ConversationManager) event.getSession().getAttribute(event.getName());
+ conversationWiperThread.addConversationManager(
+ id, newConversationManager);
}
}
- public void sessionCreated(HttpSessionEvent event)
- {
- }
-
- public void sessionDestroyed(HttpSessionEvent event)
- {
- // just in case we didn't get a attributeRemoved, remove any attached conversatoinManager for this session
- conversationWiperThread.removeConversationManager(event.getSession().getId());
- }
}
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java?rev=610046&r1=610045&r2=610046&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/FrameworkAdapter.java Tue Jan 8 08:20:36 2008
@@ -181,11 +181,15 @@
*/
public abstract Object getSessionAttribute(String key);
- public abstract void setSessionAttribute(String key, Object value);
+ public abstract void setSessionAttribute(String key, Object value);
public abstract boolean containsSessionAttribute(String key);
- /**
+ /**
+ * @return id of the actual session
+ */
+ public abstract String getSessionId();
+ /**
* Instruct the remote browser to fetch the specified URL.
*/
public abstract void redirect(String url) throws IOException;
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java?rev=610046&r1=610045&r2=610046&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/basic/BasicFrameworkAdapter.java Tue Jan 8 08:20:36 2008
@@ -225,7 +225,19 @@
throw new IllegalStateException(ISE_MESSAGE);
}
- protected String getRequestContextPath()
+ /**
+ * @see org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter#getSessionId()
+ */
+ public String getSessionId() {
+ HttpServletRequest request = getRequest();
+ if (request != null && request.getSession(true) != null)
+ {
+ return request.getSession(true).getId();
+ }
+ throw new IllegalStateException(ISE_MESSAGE);
+ }
+
+ protected String getRequestContextPath()
{
HttpServletRequest request = getRequest();
if (request != null)
Modified: myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java?rev=610046&r1=610045&r2=610046&view=diff
==============================================================================
--- myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java (original)
+++ myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/frameworkAdapter/local/LocalFrameworkAdapter.java Tue Jan 8 08:20:36 2008
@@ -126,7 +126,11 @@
return sessionMap.containsKey(key);
}
- protected ConfigurableApplicationContext getApplicationContext()
+ public String getSessionId() {
+ return String.valueOf(sessionMap.hashCode());
+ }
+
+ protected ConfigurableApplicationContext getApplicationContext()
{
return configurableApplicationContext;
}