[weld-issues] [JBoss JIRA] Created: (CDI-30) An API for conversation management

Nicklas Karlsson (JIRA) jira-events at lists.jboss.org
Tue Jan 11 08:00:49 EST 2011


An API for conversation management
----------------------------------

                 Key: CDI-30
                 URL: https://issues.jboss.org/browse/CDI-30
             Project: CDI Specification Issues
          Issue Type: Feature Request
          Components: Specification
    Affects Versions: 1.0
            Reporter: Nicklas Karlsson


  I think it would be useful to have a ConversationManager API for CDI that would allow for portable modules that use the conversation context.

  Weld has been using the following interface, which has also been approved by Mark Struberg representing OpenWebBeans and by Reza Rahman 
representing CanDI and I hope it can be used for the basis of discussions on this topic:

public interface ConversationManager
{
   /**
    * Checks the state of the conversation context
    * 
    * @return true if the conversation context is active, false otherwise
    */
   public abstract boolean isContextActive();
   
   /**
    * Sets up and activates the conversation context
    * 
    * @return The conversation manager
    * 
    * @throws IllegalStateException if the context is already active
    */   
   public abstract ConversationManager setupContext();
   
   /**
    * Destroys the conversations and deactivates the conversation context
    * 
    * @return The conversation manager
    * 
    * @throws IllegalStateException if the context is already deactive
    */   
   public abstract ConversationManager teardownContext();

   /**
    * Resumes a long running conversation. If the cid is null, nothing is done and the current
    * transient conversation is resumed
    * 
    * 
    * @param cid The conversation id to restore
    * @return The conversation manager
    * @throws NonexistentConversationException If the non-transient conversation is not known
    * @throws BusyConversationException If the conversation is locked and not released while waiting 
    * @throws IllegalStateException if the conversation context is not active
    */
   
   public abstract ConversationManager setupConversation(String cid);
   
   /**
    * Destroys the current conversation if it's transient. Stores it for conversation 
    * propagation if it's non-transient
    * 
    * @return The conversation manager
    * @throws IllegalStateException if the conversation context is not active
    */
   public abstract ConversationManager teardownConversation();
   
   /**
    * Gets the current non-transient conversations
    * 
    * @return The conversations, mapped by id
    * @throws IllegalStateException if the conversation context is not active
    */
   public abstract Map<String, Conversation> getConversations();

   /**
    * Returns a new, session-unique conversation ID
    * 
    * @return The conversation id
    * @throws IllegalStateException if the conversation context is not active
    */   
   public abstract String generateConversationId();
 
}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list