org.jboss.seam.core
Class Manager

java.lang.Object
  extended by org.jboss.seam.core.Manager

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

The Seam conversation manager.

Version:
$Revision: 1.150 $
Author:
Gavin King, Thomas Heute

Constructor Summary
Manager()
           
 
Method Summary
 String appendConversationIdFromRedirectFilter(String url)
          Called by the Seam Redirect Filter when a redirect is called.
 void beforeRedirect()
          Temporarily promote a temporary conversation to a long running conversation for the duration of a browser redirect.
 void beginConversation(String initiator)
          Promote a temporary conversation and make it long-running
 void beginNestedConversation(String ownerName)
          Begin a new nested conversation.
 void conversationTimeout(ContextAdaptor session)
          Clean up timed-out conversations
 String encodeConversationId(String url)
          Add the conversation id to a URL, if necessary
 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(ContextAdaptor session)
          Touch the conversation stack, destroy ended conversations, and timeout inactive conversations.
 int getConcurrentRequestTimeout()
           
 String getConversationIdParameter()
           
 String getConversationIsLongRunningParameter()
           
 int getConversationTimeout()
           
 String getCurrentConversationDescription()
           
 ConversationEntry getCurrentConversationEntry()
           
 String getCurrentConversationId()
           
 List<String> getCurrentConversationIdStack()
           
 Object getCurrentConversationInitiator()
          Deprecated.  
 Integer getCurrentConversationTimeout()
           
 String getCurrentConversationViewId()
           
 String getParentConversationId()
           
protected  String getParentConversationIdParameter()
           
 String getParentConversationViewId()
           
 String getRootConversationId()
           
 void handleConversationPropagation(Map parameters)
          Look for a conversation propagation style in the request parameters and begin, nest or join the conversation, as necessary.
 void initializeTemporaryConversation()
          Initialize a new temporary conversation context, and assign it a conversation id.
static Manager instance()
           
 void interpolateAndRedirect(String url)
           
 boolean isLongRunningConversation()
           
 boolean isLongRunningOrNestedConversation()
           
 boolean isNestedConversation()
           
 boolean isReallyLongRunningConversation()
           
 boolean isUpdateModelValuesCalled()
           
 void leaveConversation()
          Leave the scope of the current conversation, leaving it completely intact.
 void prepareBackswitch(javax.faces.context.FacesContext facesContext)
          If a page description is defined, remember the description and view id for the current page, to support conversation switching.
 void redirect(String viewId)
          Redirect to the given view id, encoding the conversation id into the request URL.
 void redirect(String viewId, Map<String,Object> parameters, boolean includeConversationId)
          Redirect to the given view id, after encoding parameters and conversation id into the request URL.
 boolean restoreConversation(Map parameters)
          Initialize the request conversation context, taking into account conversation propagation style, and any conversation id passed as a request parameter or in the PAGE context.
 boolean restoreConversation(String conversationId)
          Initialize the request conversation context, given the conversation id.
 void setConcurrentRequestTimeout(int requestWait)
           
 void setConversationIdParameter(String conversationIdParameter)
           
 void setConversationIsLongRunningParameter(String conversationIdLongRunning)
           
 void setConversationTimeout(int conversationTimeout)
           
 void setCurrentConversationId(String id)
          Only public for the unit tests!
 void setCurrentConversationIdStack(List<String> stack)
           
 void setLongRunningConversation(boolean isLongRunningConversation)
           
protected  void setParentConversationIdParameter(String nestedConversationIdParameter)
           
 void setUpdateModelValuesCalled(boolean updateModelValuesCalled)
           
 boolean switchConversation(String id)
          Switch to another long-running conversation.
 String toString()
           
 void unlockConversation()
           
 void updateCurrentConversationId(String id)
          Must not be called from a long-running conversation!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Manager

public Manager()
Method Detail

getCurrentConversationId

public String getCurrentConversationId()

setCurrentConversationId

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

Parameters:
id -

updateCurrentConversationId

public void updateCurrentConversationId(String id)
Must not be called from a long-running conversation!

Parameters:
id - the new conversation id

getCurrentConversationInitiator

public Object getCurrentConversationInitiator()
Deprecated. 

Get the name of the component that started the current conversation.


getCurrentConversationIdStack

public List<String> getCurrentConversationIdStack()

setCurrentConversationIdStack

public void setCurrentConversationIdStack(List<String> stack)

getCurrentConversationDescription

public String getCurrentConversationDescription()

getCurrentConversationTimeout

public Integer getCurrentConversationTimeout()

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(ContextAdaptor session)
Clean up timed-out conversations


endRequest

public void endRequest(ContextAdaptor session)
Touch the conversation stack, destroy ended conversations, and timeout inactive conversations.


unlockConversation

public void unlockConversation()

restoreConversation

public boolean restoreConversation(Map parameters)
Initialize the request conversation context, taking into account conversation propagation style, and any conversation id passed as a request parameter or in the PAGE context.

Parameters:
parameters - the request parameters
Returns:
false if the conversation id referred to a long-running conversation that was not found

handleConversationPropagation

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

Parameters:
parameters - the request parameters

restoreConversation

public boolean restoreConversation(String conversationId)
Initialize the request conversation context, given the conversation id. If no conversation entry is found, or conversationId is null, initialize a new temporary conversation context.

Returns:
true if the conversation with the given id was found

initializeTemporaryConversation

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


beginConversation

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

Parameters:
initiator - the name of the component starting the conversation.

beginNestedConversation

public void beginNestedConversation(String ownerName)
Begin a new nested conversation.

Parameters:
ownerName - the name of the component starting the conversation

endConversation

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


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.

Parameters:
id - the id of the conversation to switch to
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.


encodeConversationId

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


interpolateAndRedirect

public void interpolateAndRedirect(String url)

encodeParameters

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


redirect

public void redirect(String viewId)
Redirect to the given view id, encoding the conversation id into the request URL.

Parameters:
viewId - the JSF view id

redirect

public void redirect(String viewId,
                     Map<String,Object> parameters,
                     boolean includeConversationId)
Redirect to the given view id, after encoding parameters and conversation id into the request URL.

Parameters:
viewId - the JSF view id
parameters - request parameters to be encoded (possibly null)
includeConversationId - determines if the conversation id is to be encoded

appendConversationIdFromRedirectFilter

public String appendConversationIdFromRedirectFilter(String url)
Called by the Seam Redirect Filter when a redirect is called. Appends the conversationId parameter if necessary.

Parameters:
url - the requested URL
Returns:
the resulting URL with the conversationId appended

prepareBackswitch

public void prepareBackswitch(javax.faces.context.FacesContext facesContext)
If a page description is defined, remember the description and view id for the current page, to support conversation switching. Called just before the render phase.


getConversationIdParameter

public String getConversationIdParameter()

setConversationIdParameter

public void setConversationIdParameter(String conversationIdParameter)

getConversationIsLongRunningParameter

public String getConversationIsLongRunningParameter()

setConversationIsLongRunningParameter

public void setConversationIsLongRunningParameter(String conversationIdLongRunning)

isUpdateModelValuesCalled

public boolean isUpdateModelValuesCalled()

setUpdateModelValuesCalled

public void setUpdateModelValuesCalled(boolean updateModelValuesCalled)

getConcurrentRequestTimeout

public int getConcurrentRequestTimeout()

setConcurrentRequestTimeout

public void setConcurrentRequestTimeout(int requestWait)

toString

public String toString()
Overrides:
toString in class Object

getParentConversationIdParameter

protected String getParentConversationIdParameter()

setParentConversationIdParameter

protected void setParentConversationIdParameter(String nestedConversationIdParameter)