[weld-dev] A ConversationManager API
Pete Muir
pmuir at redhat.com
Sat Jan 30 08:38:29 EST 2010
On 29 Jan 2010, at 21:02, Arbi Sookazian wrote:
> If you're referring to the Conversation interface here: http://docs.jboss.org/cdi/api/1.0/javax/enterprise/context/Conversation.html
>
> then NKarlsson's ConversationManager interface has more methods than the CDI version above, no? So what do you mean by "These are already available on CDI's Conversation interface."? I think that ConversationManager is a better name for a manager component than simply Conversation.
These API are for different purposes, Conversation is for user control of the conversation, ConversationManager is an SPI that frameworks which integrate with Weld can use to control the built in conversation context.
> What if I wanted to getTimeout() of a non-current conversation in the case there are multiple concurrent conversations in the current session?
In that case, we need to know the use case.
This can easily be solved by changing getConversations to return a Map.
>
> When comparing org.jboss.seam.core.Conversation class from Seam 2.x API, why are there so many *less* methods in the Conversation interface in CDI?
Because we took the chance to clean up the API, removing cruft.
> Are nested conversations removed in Weld/Seam3?
>From CDI yes, from Seam3, not necessarily, but I suspect they may be redesigned.
>
> On Fri, Jan 29, 2010 at 8:42 AM, Pete Muir <pmuir at redhat.com> wrote:
> 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
>
>
> _______________________________________________
> 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