Hi Pete
On 1 May 2009, at 07:34, Peter Royle wrote:
[apologies if this is a double post - I sent one 8 hours ago but
haven't
heard anything from the list]
lists.jboss.org was having some problems, now all fixed.
Hi,
As mentioned previously, I've been doing some experimenting with using
the above contexts in Web Beans within the Java SE environment. Here
are
some patches, diffed from the root webbeans directory, which will add
support for these contexts to the Web Beans SE Module project, plus
modify the Swing SE Numberguess example to use these scopes.
The key points are:
NUMBERGUESS
- A Session is pretty much the whole lifespan of the application,
since
it's single-user.
- A Conversation is a single instance of the game, until it is either
won or lost.
- A Request is a single button click, and is mostly present to support
Conversations using the existing paradigms.
- The Game class is now Conversation scoped. No restart() necessary,
the
NumberGuessFrame simply ends the current conversation when the game is
over and starts a new one.
- This allows the @Random number to be injected directly into Game for
each fresh conversation (rather than injecting the generator and
hanging
on to it)
- NumberGuessFrame injects the current conversation and conversation
manager, as well as the JavaSELifecycle, all of which it uses to
manage
the various contexts (Request, Session and Conversation)
- You can see these contexts being started and stopped during the
start(), guessButtonActionPerformed() and
replayButtonActionPerformed()
methods.
Looks good, though I think we shouldn't have session or request in
here (just conversation and application)
WEB BEANS SE MODULE
- JavaSELifecycle added to help client apps and frameworks manage
lifecycle in SE. This would eventually end up in the SPI perhaps, or
as
a better abstraction of an existing SPI interface.
Yes, I need to finish the lifeycle SPI stuff, I got the idea straight
now :-)
- JavaSEConversationManager is copied from ServletConversationManager
and much of the common code should probably be pushed into an abstract
class.
- WebBeansBootstrap now registers everything except
ServletConversationManager and HttpSessionManager when in SE mode. It
also registers the new JavaSEConversationManager.
My idea is that lifecycle just has methods to do the relevant things
here, and you don't need to worry about things like conversation
manager...
Let me do this work (will be the week after next I think), and then we
can review?
I would like to clean up the syntax for starting requests because it's
obviously pretty ugly and verbose right now. Maybe some kind of
annotation and interceptor pair perhaps? And possibly some
Swing-specific helpers to make it easy to attach the Request context
to
a button click? Making this sort of stuff more transparent is my next
goal.
Let me know what you think, anyone. Cheers.
Pete.
>>
>>
>> Finally, I'm /experimenting/ with enabling and using Request,
>> Session
>> and Conversation scopes/contexts in SE. If you're interested in
>> seeing
>> the working code I've got the changes to core, SE and the number
>> guess
>> example ready to check in to separate branches. Happy to discuss
>> this
>> further if anyone is interested/curious.
>
> Perhaps send a patch out for review (or attach to a JIRA issue?)
>
>>
>>
>> Cheers,
>>
>> Pete.
>>
>>
>>
>>
>> _______________________________________________
>> webbeans-dev mailing list
>> webbeans-dev(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/webbeans-dev
>
> --
> Pete Muir
>
http://www.seamframework.org
>
http://in.relation.to/Bloggers/Pete
>
<se-contexts.diff>
--
Pete Muir
http://www.seamframework.org
http://in.relation.to/Bloggers/Pete