Hi all, 

First sorry if this message was received twice, I'm not sure my first response was taken in account as I was not subscribed to the list

I just have a few remarks for now :

1. I don't understand the need for createTransientConversation and endTransientConversation if there is activateContext and deactivateContext. Why not something like setupConversation() / cleanupConversation() that always create a transient conversation that can be later promoted to long-running by restoreConversation / beginConversation.
2. It would be useful to be able to force a new conversationId defined by the client with beginConversation(cid)
3. This is not directly linked to the ConversationManager interface, but it would also be useful to be able to observe the same events than Seam 2 dispatches : BeginConversationEvent, EndConversationEvent, ConversationTimeoutEvent and ConversationDestroyedEvent (although I'm not sure the last one makes sense with CDI)


William


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