org.jboss.seam.core
Class Manager

java.lang.Object
  extended by org.jboss.seam.core.Manager
Direct Known Subclasses:
FacesManager

@Scope(value=EVENT)
@Name(value="org.jboss.seam.core.manager")
@Install(precedence=0)
@BypassInterceptors
public class Manager
extends Object

The Seam conversation manager.

Author:
Gavin King, Thomas Heute

Field Summary
static String EVENT_CONVERSATION_BEGIN
           
static String EVENT_CONVERSATION_DESTROYED
           
static String EVENT_CONVERSATION_END
           
static String EVENT_CONVERSATION_TIMEOUT
           
static String REDIRECT_FROM_MANAGER
           
 
Constructor Summary
Manager()
           
 
Method Summary
 void beforeRedirect()
          Temporarily promote a temporary conversation to a long running conversation for the duration of a browser redirect.
 void beginConversation()
          Promote a temporary conversation and make it long-running
 void beginNestedConversation()
          Begin a new nested conversation.
 void conversationTimeout(Map<String,Object> session)
          Clean up timed-out conversations
 String encodeConversationId(String url)
          Deprecated. use encodeConversationId(String url, String viewId)
 String encodeConversationId(String url, String viewId)
          Add the conversation id to a URL, if necessary
 String encodeConversationId(String url, String viewId, String conversationId)
          Add the conversation id to a URL, if necessary
protected  String encodeConversationIdParameter(String url, String paramName, String paramValue)
           
 String encodeParameters(String url, Map<String,Object> parameters)
          Add the parameters to a URL
 void endConversation(boolean beforeRedirect)
          Make a long-running conversation temporary.
 void endRequest(Map<String,Object> session)
          Touch the conversation stack, destroy ended conversations, and timeout inactive conversations.
 void endRootConversation(boolean beforeRedirect)
          Make the root conversation in the current conversation stack temporary.
protected  void flushConversationMetadata()
           
protected  String generateInitialConversationId()
           
 int getConcurrentRequestTimeout()
           
 String getConversationIdParameter()
           
 int getConversationTimeout()
           
 Integer getCurrentConversationConcurrentRequestTimeout()
           
 String getCurrentConversationDescription()
           
 ConversationEntry getCurrentConversationEntry()
           
 String getCurrentConversationId()
           
 List<String> getCurrentConversationIdStack()
           
 Integer getCurrentConversationTimeout()
           
 String getCurrentConversationViewId()
           
 FlushModeType getDefaultFlushMode()
           
 String getParentConversationId()
           
 String getParentConversationIdParameter()
           
 String getParentConversationViewId()
           
 String getRootConversationId()
           
 String getUriEncoding()
           
 void handleConversationPropagation(Map parameters)
          Look for a conversation propagation style in the request parameters and begin, nested or join the conversation, as necessary.
 void initializeTemporaryConversation()
          Initialize a new temporary conversation context, and assign it a conversation id.
static Manager instance()
           
protected static boolean isDifferentConversationId(ConversationIdParameter sp, ConversationIdParameter tp)
           
 boolean isLongRunningConversation()
           
 boolean isLongRunningOrNestedConversation()
           
 boolean isNestedConversation()
           
 boolean isReallyLongRunningConversation()
           
 void killAllOtherConversations()
          Kills all conversations except the current one
 void leaveConversation()
          Leave the scope of the current conversation, leaving it completely intact.
 void redirect(String viewId)
           
 void redirect(String viewId, String id)
           
 boolean restoreConversation()
          Initialize the request conversation context, given the conversation id and optionally a parent conversation id.
 void setConcurrentRequestTimeout(int requestWait)
           
 void setConversationIdParameter(String conversationIdParameter)
           
 void setConversationTimeout(int conversationTimeout)
           
 void setCurrentConversationId(String id)
          Only public for the unit tests!
 void setCurrentConversationIdStack(List<String> stack)
           
 void setDefaultFlushMode(FlushModeType defaultFlushMode)
           
 void setLongRunningConversation(boolean isLongRunningConversation)
           
 void setParentConversationIdParameter(String nestedConversationIdParameter)
           
 void setUriEncoding(String encoding)
           
protected  void storeConversationToViewRootIfNecessary()
           
 boolean switchConversation(String id)
          Switch to another long-running conversation and mark the conversation as long-running, overriding a previous call in the same thread to demote a long-running conversation.
 boolean switchConversation(String id, boolean promote)
          Switch to another long-running conversation.
 String toString()
           
 void unlockConversation()
           
 void updateCurrentConversationId(String id)
          Change the id of the current conversation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EVENT_CONVERSATION_TIMEOUT

public static final String EVENT_CONVERSATION_TIMEOUT
See Also:
Constant Field Values

EVENT_CONVERSATION_DESTROYED

public static final String EVENT_CONVERSATION_DESTROYED
See Also:
Constant Field Values

EVENT_CONVERSATION_BEGIN

public static final String EVENT_CONVERSATION_BEGIN
See Also:
Constant Field Values

EVENT_CONVERSATION_END

public static final String EVENT_CONVERSATION_END
See Also:
Constant Field Values

REDIRECT_FROM_MANAGER

public static final String REDIRECT_FROM_MANAGER
See Also:
Constant Field Values
Constructor Detail

Manager

public Manager()
Method Detail

killAllOtherConversations

public void killAllOtherConversations()
Kills all conversations except the current one


getCurrentConversationId

public String getCurrentConversationId()

setCurrentConversationId

public void setCurrentConversationId(String id)
Only public for the unit tests!

Parameters:
id -

updateCurrentConversationId

public void updateCurrentConversationId(String id)
Change the id of the current conversation.

Parameters:
id - the new conversation id

getCurrentConversationIdStack

public List<String> getCurrentConversationIdStack()

setCurrentConversationIdStack

public void setCurrentConversationIdStack(List<String> stack)

getCurrentConversationDescription

public String getCurrentConversationDescription()

getCurrentConversationTimeout

public Integer getCurrentConversationTimeout()

getCurrentConversationConcurrentRequestTimeout

public Integer getCurrentConversationConcurrentRequestTimeout()

getCurrentConversationViewId

public String getCurrentConversationViewId()

getParentConversationViewId

public String getParentConversationViewId()

getParentConversationId

public String getParentConversationId()

getRootConversationId

public String getRootConversationId()

isLongRunningConversation

public boolean isLongRunningConversation()

isLongRunningOrNestedConversation

public boolean isLongRunningOrNestedConversation()

isReallyLongRunningConversation

public boolean isReallyLongRunningConversation()

isNestedConversation

public boolean isNestedConversation()

setLongRunningConversation

public void setLongRunningConversation(boolean isLongRunningConversation)

instance

public static Manager instance()

conversationTimeout

public void conversationTimeout(Map<String,Object> session)
Clean up timed-out conversations


endRequest

public void endRequest(Map<String,Object> session)
Touch the conversation stack, destroy ended conversations, and timeout inactive conversations.


unlockConversation

public void unlockConversation()

handleConversationPropagation

public void handleConversationPropagation(Map parameters)
Look for a conversation propagation style in the request parameters and begin, nested or join the conversation, as necessary.

Parameters:
parameters - the request parameters

restoreConversation

public boolean restoreConversation()
Initialize the request conversation context, given the conversation id and optionally a parent conversation id. If no conversation entry is found for the first id, try the parent, and if that also fails, initialize a new temporary conversation context.

Returns:
false if the conversation entry was not found and it was required

initializeTemporaryConversation

public void initializeTemporaryConversation()
Initialize a new temporary conversation context, and assign it a conversation id.


generateInitialConversationId

protected String generateInitialConversationId()

beginConversation

public void beginConversation()
Promote a temporary conversation and make it long-running


beginNestedConversation

public void beginNestedConversation()
Begin a new nested conversation.


endConversation

public void endConversation(boolean beforeRedirect)
Make a long-running conversation temporary.


endRootConversation

public void endRootConversation(boolean beforeRedirect)
Make the root conversation in the current conversation stack temporary.


storeConversationToViewRootIfNecessary

protected void storeConversationToViewRootIfNecessary()

getCurrentConversationEntry

public ConversationEntry getCurrentConversationEntry()

leaveConversation

public void leaveConversation()
Leave the scope of the current conversation, leaving it completely intact.


switchConversation

public boolean switchConversation(String id)
Switch to another long-running conversation and mark the conversation as long-running, overriding a previous call in the same thread to demote a long-running conversation.

Parameters:
id - the id of the conversation to switch to
Returns:
true if the conversation exists

switchConversation

public boolean switchConversation(String id,
                                  boolean promote)
Switch to another long-running conversation.

Parameters:
id - the id of the conversation to switch to
promote - promote the current conversation to long-running, overriding any previous demotion
Returns:
true if the conversation exists

getConversationTimeout

public int getConversationTimeout()

setConversationTimeout

public void setConversationTimeout(int conversationTimeout)

beforeRedirect

public void beforeRedirect()
Temporarily promote a temporary conversation to a long running conversation for the duration of a browser redirect. After the redirect, the conversation will be demoted back to a temporary conversation.


isDifferentConversationId

protected static boolean isDifferentConversationId(ConversationIdParameter sp,
                                                   ConversationIdParameter tp)

encodeConversationId

public String encodeConversationId(String url)
Deprecated. use encodeConversationId(String url, String viewId)

Add the conversation id to a URL, if necessary


encodeConversationId

public String encodeConversationId(String url,
                                   String viewId)
Add the conversation id to a URL, if necessary


encodeConversationId

public String encodeConversationId(String url,
                                   String viewId,
                                   String conversationId)
Add the conversation id to a URL, if necessary


encodeConversationIdParameter

protected String encodeConversationIdParameter(String url,
                                               String paramName,
                                               String paramValue)

encodeParameters

public String encodeParameters(String url,
                               Map<String,Object> parameters)
Add the parameters to a URL


getConversationIdParameter

public String getConversationIdParameter()

setConversationIdParameter

public void setConversationIdParameter(String conversationIdParameter)

getParentConversationIdParameter

public String getParentConversationIdParameter()

setParentConversationIdParameter

public void setParentConversationIdParameter(String nestedConversationIdParameter)

getConcurrentRequestTimeout

public int getConcurrentRequestTimeout()

setConcurrentRequestTimeout

public void setConcurrentRequestTimeout(int requestWait)

getDefaultFlushMode

public FlushModeType getDefaultFlushMode()

setDefaultFlushMode

public void setDefaultFlushMode(FlushModeType defaultFlushMode)

toString

public String toString()
Overrides:
toString in class Object

redirect

public void redirect(String viewId,
                     String id)

redirect

public void redirect(String viewId)

flushConversationMetadata

protected void flushConversationMetadata()

getUriEncoding

public String getUriEncoding()

setUriEncoding

public void setUriEncoding(String encoding)