|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.orchestra.conversation.ConversationContext
public class ConversationContext
A ConversationContext is a container for a set of conversations.
Normally there is only one ConversationContext per http session. However there can be multiple instances if the user has multiple concurrent windows open into the same webapp, using the ox:separateConversationContext or other similar mechanism.
Like the conversation class, a context can also have a timeout which will cause it to be ended automatically if not accessed within the given period.
Constructor Summary | |
---|---|
protected |
ConversationContext(ConversationContext parent,
long id)
Constructor. |
protected |
ConversationContext(long id)
Constructor. |
Method Summary | |
---|---|
void |
addChild(ConversationContext context)
|
protected void |
checkConversationTimeout()
Check the timeout for every conversation in this context. |
protected void |
clear()
Deprecated. Use the "invalidate" method instead. |
java.lang.Object |
getAttribute(java.lang.String name)
Get a specific attribute. |
protected java.util.Collection |
getChildren()
|
protected Conversation |
getConversation(java.lang.String name)
Get a conversation by name. |
long |
getId()
The conversation context id, unique within the current http session. |
java.lang.Long |
getIdAsLong()
The conversation context id, unique within the current http session. |
long |
getLastAccess()
The system time in millis when this conversation has been accessed last. |
java.lang.String |
getName()
Get the name associated to this context. |
ConversationContext |
getParent()
Return the parent conversation context (if any). |
ConversationContext |
getRoot()
Get the root conversation context this conversation context is associated with. |
long |
getTimeout()
Get the timeout after which this context will be closed. |
boolean |
hasAttribute(java.lang.String name)
Check if this conversationContext holds a specific attribute. |
boolean |
hasChildren()
|
protected boolean |
hasConversation(java.lang.String name)
Check if the given conversation exists. |
protected boolean |
hasConversations()
Return true if there are one or more conversations in this context. |
protected void |
invalidate()
Invalidate all conversations within this context. |
boolean |
isLockedForCurrentThread()
Return true if this object is currently locked by the calling thread. |
java.util.Iterator |
iterateConversations()
Iterates over all the conversations in this context. |
void |
lockInterruptablyForCurrentThread()
Block until no other thread has this instance marked as reserved, then mark the object as reserved for this thread. |
java.lang.Object |
removeAttribute(java.lang.String name)
Remove an attribute from the conversationContext. |
void |
removeChild(ConversationContext context)
|
protected void |
removeConversation(Conversation conversation)
Remove the conversation from this context. |
protected void |
removeConversation(java.lang.String name)
Remove the conversation with the given name from this context. |
void |
setAttribute(java.lang.String name,
java.lang.Object attribute)
Add an attribute to the conversationContext. |
void |
setName(java.lang.String name)
Assign a name to this context. |
void |
setTimeout(long timeoutMillis)
Set the timeout after which this context will be closed. |
protected Conversation |
startConversation(java.lang.String name,
ConversationFactory factory)
Start a conversation if not already started. |
protected void |
touch()
Mark this context as having been used. |
void |
unlockForCurrentThread()
Block until no other thread has this instance marked as reserved, then mark the object as reserved for this thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ConversationContext(long id)
protected ConversationContext(ConversationContext parent, long id)
Method Detail |
---|
public java.lang.String getName()
public void setName(java.lang.String name)
public long getId()
public java.lang.Long getIdAsLong()
public ConversationContext getParent()
public void addChild(ConversationContext context)
protected java.util.Collection getChildren()
public void removeChild(ConversationContext context)
public boolean hasChildren()
protected void touch()
public long getLastAccess()
public long getTimeout()
setTimeout(long)
public void setTimeout(long timeoutMillis)
A value of -1 means no timeout checking.
protected void clear()
protected void invalidate()
protected Conversation startConversation(java.lang.String name, ConversationFactory factory)
protected void removeConversation(Conversation conversation)
Notice: It is assumed that the conversation has already been invalidated.
protected void removeConversation(java.lang.String name)
Notice: Its assumed that the conversation has already been invalidated
protected boolean hasConversations()
protected boolean hasConversation(java.lang.String name)
protected Conversation getConversation(java.lang.String name)
This looks only in the current context, not in any child contexts.
public java.util.Iterator iterateConversations()
This does not include conversations in parent contexts.
protected void checkConversationTimeout()
This method does not check the timeout for this context object itself.
public void setAttribute(java.lang.String name, java.lang.Object attribute)
A context provides a map into which any arbitrary objects can be stored. It isn't a major feature of the context, but can occasionally be useful.
public boolean hasAttribute(java.lang.String name)
public java.lang.Object getAttribute(java.lang.String name)
public java.lang.Object removeAttribute(java.lang.String name)
public void lockInterruptablyForCurrentThread() throws java.lang.InterruptedException
It is safe to call this method multiple times.
If this method is called, then an equal number of calls to unlockForCurrentThread MUST made, or this context object will remain locked until the http session times out.
Note that this method may be called very early in the request processing lifecycle, eg before a FacesContext exists for a JSF request.
java.lang.InterruptedException
public void unlockForCurrentThread()
Note that this method may be called very late in the request processing lifecycle, eg after a FacesContext has been destroyed for a JSF request.
public boolean isLockedForCurrentThread()
public ConversationContext getRoot()
This is equivalent to calling getParent repeatedly until a context with no parent is found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |