Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.myfaces.orchestra.conversation
Class ConversationContext

    java.lang.Object
      org.apache.myfaces.orchestra.conversation.ConversationContext

    public class ConversationContext

extends java.lang.Object

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

### ConversationContext

    protected ConversationContext(long id)

  Constructor.

### ConversationContext

    protected ConversationContext(ConversationContext parent,
                                  long id)

  Constructor.

  Since:
    1.2

Method Detail

### getName

    public java.lang.String getName()

  Get the name associated to this context.

  Since:
    1.2

### setName

    public void setName(java.lang.String name)

  Assign a name to this context.

  Since:
    1.2

### getId

    public long getId()

  The conversation context id, unique within the current http session.

### getIdAsLong

    public java.lang.Long getIdAsLong()

  The conversation context id, unique within the current http session.

### getParent

    public ConversationContext getParent()

  Return the parent conversation context (if any).

  Since:
    1.2

### addChild

    public void addChild(ConversationContext context)

  Since:
    1.3

### getChildren

    protected java.util.Collection getChildren()

  Since:
    1.4

### removeChild

    public void removeChild(ConversationContext context)

  Since:
    1.3

### hasChildren

    public boolean hasChildren()

  Since:
    1.3

### touch

    protected void touch()

  Mark this context as having been used.

### getLastAccess

    public long getLastAccess()

  The system time in millis when this conversation has been accessed last.

### getTimeout

    public long getTimeout()

  Get the timeout after which this context will be closed.

  See Also:
    `setTimeout(long)`

### setTimeout

    public void setTimeout(long timeoutMillis)

  Set the timeout after which this context will be closed.

  A value of -1 means no timeout checking.

### clear

    protected void clear()

  Deprecated. Use the "invalidate" method instead.

  Invalidate all conversations within this context.

### invalidate

    protected void invalidate()

  Invalidate all conversations within this context.

  Since:
    1.3

### startConversation

    protected Conversation startConversation(java.lang.String name,
                                             ConversationFactory factory)

  Start a conversation if not already started.

### removeConversation

    protected void removeConversation(Conversation conversation)

  Remove the conversation from this context.

  Notice: It is assumed that the conversation has already been invalidated.

### removeConversation

    protected void removeConversation(java.lang.String name)

  Remove the conversation with the given name from this context.

  Notice: Its assumed that the conversation has already been invalidated

### hasConversations

    protected boolean hasConversations()

  Return true if there are one or more conversations in this context.

### hasConversation

    protected boolean hasConversation(java.lang.String name)

  Check if the given conversation exists.

### getConversation

    protected Conversation getConversation(java.lang.String name)

  Get a conversation by name.

  This looks only in the current context, not in any child contexts.

### iterateConversations

    public java.util.Iterator iterateConversations()

  Iterates over all the conversations in this context.

  This does not include conversations in parent contexts.

  Returns:
    An iterator over a copy of the conversation list. It is safe to remove objects from the conversation list while iterating, as the iterator refers to a different collection.

### checkConversationTimeout

    protected void checkConversationTimeout()

  Check the timeout for every conversation in this context.

  This method does not check the timeout for this context object itself.

### setAttribute

    public void setAttribute(java.lang.String name,
                             java.lang.Object attribute)

  Add an attribute to the conversationContext.

  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.

### hasAttribute

    public boolean hasAttribute(java.lang.String name)

  Check if this conversationContext holds a specific attribute.

### getAttribute

    public java.lang.Object getAttribute(java.lang.String name)

  Get a specific attribute.

### removeAttribute

    public java.lang.Object removeAttribute(java.lang.String name)

  Remove an attribute from the conversationContext.

### lockInterruptablyForCurrentThread

    public void lockInterruptablyForCurrentThread()
                                           throws java.lang.InterruptedException

  Block until no other thread has this instance marked as reserved, then mark the object as reserved for this thread.

  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.

  Throws:
    `java.lang.InterruptedException`
  Since:
    1.1

### unlockForCurrentThread

    public void unlockForCurrentThread()

  Block until no other thread has this instance marked as reserved, then mark the object as reserved for this thread.

  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.

  Since:
    1.1

### isLockedForCurrentThread

    public boolean isLockedForCurrentThread()

  Return true if this object is currently locked by the calling thread.

  Since:
    1.1

### getRoot

    public ConversationContext getRoot()

  Get the root conversation context this conversation context is associated with.

  This is equivalent to calling getParent repeatedly until a context with no parent is found.

  Since:
    1.2

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation. All Rights Reserved.