[weld-dev] A ConversationManager API

Pete Muir pmuir at redhat.com
Fri Jan 29 11:42:32 EST 2010


These are already available on CDI's Conversation interface.

On 29 Jan 2010, at 14:27, Arbi Sookazian wrote:

> How about begin() and end()?
> 
> reference: http://docs.jboss.org/seam/2.2.0.GA/api/org/jboss/seam/core/Conversation.html
> 
> On Thu, Jan 28, 2010 at 11:56 PM, Nicklas Karlsson <nickarls at gmail.com> wrote:
> Hi,
> 
>    There has been many requests for a standard ConversationManager
> API that could be used by other frameworks (SE, GraniteDS, Seam
> Remoting etc) so there was a short brainstorming session and we came
> up with the following proposal on which I now request your feedback.
> 
> public interface ConversationManager
> {
>   /**
>    * Activates the conversation context
>    *
>    * @return The conversation manager
>    * @throws IllegalStateException if the context is already active
>    */
>   public abstract ConversationManager activateContext();
> 
>   /**
>    * Deactivates the conversation context
>    *
>    * @return The conversation manager
>    * @throws IllegalStateException if the context is already deactivated
>    */
>   public abstract ConversationManager deactivateContext();
> 
>   /**
>    * Checks the state of the conversation context
>    *
>    * @return true if the conversation context is active, false otherwise
>    */
>   public abstract boolean isContextActive();
> 
>   /**
>    * Starts a new, transient conversation
>    *
>    * @return The conversation manager
>    * @throws IllegalStateException if there is already an active
> conversation or if the conversation context is not active
>    */
>   public abstract ConversationManager createTransientConversation();
> 
>   /**
>    * Ends the current transient conversation
>    *
>    * @return The conversation manager
>    * @throws IllegalStateException if the current transaction is not
> transient or if the conversation context is not active
>    */
>   public abstract ConversationManager endTransientConversation();
> 
>   /**
>    * Restores a long-running conversation.
>    *
>    * @param cid The id of the conversation to restore
>    * @return The conversation manager
>    * @throws NonexistentConversationException if the conversation id
> is null or not a known long-running conversation
>    * @throws IllegalStateException if there already an active
> conversation or if the conversation context is not active
>    */
>   public abstract ConversationManager restoreConversation(String cid);
> 
>   /**
>    * Marks a long-running conversation transient
>    *
>    * @param cid The id of the conversation to make transient
>    * @return The conversation manager
>    * @throws NonexistentConversationException if the conversation id
> is null or not a known long-running conversation
>    * @throws IllegalStateException if the conversation context is not active
>    */
>   public abstract ConversationManager endConversation(String cid);
> 
>   /**
>    * Marks all long-running conversations as transient and destroys them
>    *
>    * @return The conversation manager
>    * @throws IllegalStateException if the conversation context is not active
>    */
>   public abstract ConversationManager endAllConversations();
> 
>   /**
>    * Returns the long-running conversation IDs
>    *
>    * @return The long-running conversations IDs
>    * @throws IllegalStateException if the conversation context is not active
>    */
>   public abstract Set<String> getConversations();
> 
>   /**
>    * Returns a new, unused conversation ID
>    *
>    * @return A new, unused conversation ID
>    * @throws IllegalStateException if the conversation context is not active
>    */
>   public abstract String getNewConversationId();
> 
> 
>   /**
>    * Checks if a conversation ID is in use for any other conversation
> than the current one
>    *
>    * @return True if the conversation ID is in use, false otherwise
>    * @throws IllegalStateException if the conversation context is not active
>    */
>   public abstract boolean isConversationIdInUse(String id);
> 
> }
> 
> Does it do the job? Needs more ? Needs less? Violates the
> specification in any point (from JSF perspective)?
> 
> ---
> Nik
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev




More information about the weld-dev mailing list