[weld-dev] A ConversationManager API

Sven Linstaedt sven.linstaedt at googlemail.com
Fri Jan 29 11:35:35 EST 2010


How is programatically switching a conversation supposed to work with  
respect to the JSF lifecycle?

br, Sven

-- sent by phone

Am 29.01.2010 um 08:56 schrieb Nicklas Karlsson <nickarls at gmail.com>:

> 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


More information about the weld-dev mailing list