[weld-dev] A ConversationManager API

Nicklas Karlsson nickarls at gmail.com
Mon Feb 1 02:35:51 EST 2010


Let's try it the other way around. I toss you the minimal JSF-centric API
and the *framework reps of ZK, GraniteDS, SE and Remoting can speak up on
what they need more control of along with their usecase* then Pete can
comment and I just act as a secretary ;-) That way we don't end up with too
many "nice to haves" in the API that could be worked around more or less
easy.

public interface ConversationManager
{
  /**
   * Checks the state of the conversation context
   *
   * @return true if the conversation context is active, false otherwise
   */
  public abstract boolean isContextActive();
// usecase: the conversation checks for active context before running
methods

  /**
   * Activates the conversation context
   *
   * @return The conversation manager
   *
   * @throws IllegalStateException if the context is already active
   */
  public abstract ConversationManager activateContext();
// usecase: any non-JSF framework will want to run this themselves

  /**
   * Deactivates the conversation context
   *
   * @return The conversation manager
   *
   * @throws IllegalStateException if the context is already deactive
   */
  public abstract ConversationManager deactivateContext();
// usecase: any non-JSF framework will want to run this themselves

  /**
   * 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 beginOrRestoreConversation(String
cid);
// usecase: start of the conversation lifecycle.

  /**
   * Destroys the current conversation if it's transient. Stores it for
conversation
   * propagation if it's non-transient
   *
   * @return
   * @throws IllegalStateException if the conversation context is not active
   */
  public abstract ConversationManager cleanupConversation();
// usecase: end of the conversation lifecycle.

  /**
   * 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();
// usecase: Conversation checks if begin(String) was called with a known cid
(no need for a isCidInUse, actually)

  /**
   * Returns a new, session-unique conversation ID
   *
   * @return The conversation id
   * @throws IllegalStateException if the conversation context is not active
   */
  public abstract String generateConversationId();
// usecase: Conversation gets a cid for begin()

Notice that the begin and end of lifecycle are big chunks. Speak up where
you need more granularity. Also speak up if you want fancy switching stuff
etc ;-) *Re-submit any wishes/suggestions you've done in the past* in this
thread (method signature + usecase) so we can keep stuff together.

---
Nik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20100201/fd44e1e9/attachment.html 


More information about the weld-dev mailing list