org.apache.myfaces.custom.conversation
Class ConversationManager

java.lang.Object
  extended by org.apache.myfaces.custom.conversation.ConversationManager
All Implemented Interfaces:
java.io.Serializable

public class ConversationManager
extends java.lang.Object
implements java.io.Serializable

The manager will deal with the various contexts in the current session. A new context will be created if the current window has none associated.

Author:
imario@apache.org
See Also:
Serialized Form

Field Summary
static java.lang.String CONVERSATION_CONTEXT_PARAM
           
 
Constructor Summary
protected ConversationManager()
           
 
Method Summary
protected  void attachPersistence()
           
protected  void checkContextTimeout()
           
protected  void createBeanElevator()
          Create the BeanElevator used to find a bean within the different contexts and elevate it into the conversation scope.
You can configure it in your web.xml using the init parameter named org.apache.myfaces.conversation.BEAN_ELEVATOR
protected static ConversationManager createConversationManager()
           
protected  void createMessager()
          Create the Messager used to inform the user about anomalies.
The factory can be configured in your web.xml using the init parameter named org.apache.myfaces.conversation.MESSAGER
protected  PersistenceManager createPersistenceManager()
          create a persistence manager
protected  void destroyConversationContext(java.lang.Long conversationContextId)
          Destroy the given conversation context
protected  void detachPersistence()
           
 void endConversation(java.lang.String name, boolean regularEnd)
          End a conversation
 Conversation findConversation(java.lang.Object instance)
          Find the conversation which holds the given instance
 Conversation getConversation(java.lang.String name)
          Get the conversation with the given name
 ConversationBeanElevator getConversationBeanElevator()
          the bean elevator used to get beans int the conversation scope
protected  ConversationContext getConversationContext()
          Get the current conversation context.
protected  ConversationContext getConversationContext(java.lang.Long conversationContextId)
          Get the conversation context for the given id
protected  java.lang.Long getConversationContextId()
          Get the current, or create a new unique conversationContextId.
The current conversationContextId will retrieved from the request parameters, if we cant find it there a new one will be created.
static ConversationManager getInstance()
          Get the conversation manager
static ConversationManager getInstance(javax.faces.context.FacesContext context)
          Get the conversation manager
static ConversationManager getInstance(javax.servlet.http.HttpSession session)
          Get the conversation manager from the http session.
protected  ConversationMessager getMessager()
          Get the Messager used to inform the user about anomalies.
The factory can be configured in your web.xml using the init parameter named org.apache.myfaces.conversation.MESSAGER
protected  ConversationContext getOrCreateConversationContext(java.lang.Long conversationContextId)
          Get the conversation context for the given id.
 PersistenceManager getPersistenceManager()
          get the persistence manager responsible for the current conversation
protected  PersistenceManagerFactory getPersistenceManagerFactory()
          Get the persistenceManagerFactory.
The factory can be configured in your web.xml using the init parameter named org.apache.myfaces.conversation.PERSISTENCE_MANAGER_FACTORY
 boolean hasConversation(java.lang.String name)
          check if the given conversation is active
 boolean hasConversationContext()
          check if we have a conversation context
protected  void purgePersistence()
           
 void startConversation(java.lang.String name, boolean persistence)
          Start a conversation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONVERSATION_CONTEXT_PARAM

public static final java.lang.String CONVERSATION_CONTEXT_PARAM
See Also:
Constant Field Values
Constructor Detail

ConversationManager

protected ConversationManager()
Method Detail

getInstance

public static ConversationManager getInstance()
Get the conversation manager


getInstance

public static ConversationManager getInstance(javax.faces.context.FacesContext context)
Get the conversation manager


createConversationManager

protected static ConversationManager createConversationManager()

getInstance

public static ConversationManager getInstance(javax.servlet.http.HttpSession session)
Get the conversation manager from the http session. This will not create a conversation manager if none exists.


getConversationContextId

protected java.lang.Long getConversationContextId()
Get the current, or create a new unique conversationContextId.
The current conversationContextId will retrieved from the request parameters, if we cant find it there a new one will be created. In either case the result will be stored within the request for faster lookup.


getConversationContext

protected ConversationContext getConversationContext(java.lang.Long conversationContextId)
Get the conversation context for the given id


getOrCreateConversationContext

protected ConversationContext getOrCreateConversationContext(java.lang.Long conversationContextId)
Get the conversation context for the given id.
If there is no conversation context a new one will be created


destroyConversationContext

protected void destroyConversationContext(java.lang.Long conversationContextId)
Destroy the given conversation context


startConversation

public void startConversation(java.lang.String name,
                              boolean persistence)
Start a conversation

See Also:
ConversationContext.startConversation(String, boolean)

endConversation

public void endConversation(java.lang.String name,
                            boolean regularEnd)
End a conversation

See Also:
ConversationContext.endConversation(String, boolean)

getConversation

public Conversation getConversation(java.lang.String name)
Get the conversation with the given name

Returns:
null if no conversation context is active or if the conversation did not exist.

findConversation

public Conversation findConversation(java.lang.Object instance)
Find the conversation which holds the given instance

Returns:
null if no conversation context is active or if the conversation did not exist.

hasConversation

public boolean hasConversation(java.lang.String name)
check if the given conversation is active


getConversationContext

protected ConversationContext getConversationContext()
Get the current conversation context.

Returns:
null if there is no context active

hasConversationContext

public boolean hasConversationContext()
check if we have a conversation context


getPersistenceManager

public PersistenceManager getPersistenceManager()
get the persistence manager responsible for the current conversation


createPersistenceManager

protected PersistenceManager createPersistenceManager()
create a persistence manager


getMessager

protected ConversationMessager getMessager()
Get the Messager used to inform the user about anomalies.
The factory can be configured in your web.xml using the init parameter named org.apache.myfaces.conversation.MESSAGER


createMessager

protected void createMessager()
Create the Messager used to inform the user about anomalies.
The factory can be configured in your web.xml using the init parameter named org.apache.myfaces.conversation.MESSAGER


createBeanElevator

protected void createBeanElevator()
Create the BeanElevator used to find a bean within the different contexts and elevate it into the conversation scope.
You can configure it in your web.xml using the init parameter named org.apache.myfaces.conversation.BEAN_ELEVATOR


getPersistenceManagerFactory

protected PersistenceManagerFactory getPersistenceManagerFactory()
Get the persistenceManagerFactory.
The factory can be configured in your web.xml using the init parameter named org.apache.myfaces.conversation.PERSISTENCE_MANAGER_FACTORY


attachPersistence

protected void attachPersistence()

detachPersistence

protected void detachPersistence()

purgePersistence

protected void purgePersistence()

checkContextTimeout

protected void checkContextTimeout()

getConversationBeanElevator

public ConversationBeanElevator getConversationBeanElevator()
the bean elevator used to get beans int the conversation scope



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