[weld-issues] [JBoss JIRA] Issue Comment Edited: (CDI-30) An API for managing built in contexts

Pete Muir (JIRA) jira-events at lists.jboss.org
Tue Jan 25 10:34:49 EST 2011


    [ https://issues.jboss.org/browse/CDI-30?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577762#comment-12577762 ] 

Pete Muir edited comment on CDI-30 at 1/25/11 10:34 AM:
--------------------------------------------------------

Weld used 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();
 
}

Subsequently we replaced this with a set of general purpose APIs for managing all built in contexts including conversations.

      was (Author: petemuir):
    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();
 
}
  
> An API for managing built in contexts
> -------------------------------------
>
>                 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
>
> Add management API for built in contexts allowing them to be reused as needed.

-- 
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