Hello;
That is great news, creating a maven module with webbeans-se.
In the mean time, could you look at org.apache.webbeans.boot.Bootstrap
class. Also there is a Java Swing sample, maybe you could want to look at
it, it is located in the samples/standalone-sample.
Thanks;
--Gurkan
2010/4/12 Mario Ivankovits ma...@ops.co.at
Hi!
I am developing a standalone Swing Application and trying to make use of
CDI (using openwebbeans). Also for being more fit when discussing Orchestra
related things :-)
Naturally a Swing Application consists of multiple threads. At least the
main thread and the so called Event Dispatcher Thread (EDT) for UI handling.
Beside this you will find a lot of other short-time threads handling
actions triggered by the user through the UI.
The problem I have is the org.apache.webbeans.spi.se.DefaultContextsService
class which uses ThreadLocals to store all the contexts.
I think this is not right, at least not for all the contexts provided.
For example the ApplicationContext, SessionContext, SingletonContext and
DependentContext should be a simple member of the class. Not sure about (CDI
like) ConversationContext.
The RequestContext might be arguable to life with the Thread - however, the
developer need to take care to destroy the RequestContext manually somehow -
or something we can implment into the Swing Application Framework.
For now I solved that by providing my own ContextsService impl through
openwebbeans.properties.
Also, like in Weld, I'd love to see some utility class to startup CDI in an
standalone app. Once you figured out it is easy already, but it can be even
more easy, and we can provide some predefined events like
ContainerInitialized [1].
Said that (and given my observations are correct), what do you think about
starting up a webbeans-se module where we put these things together?
It won't grow to a huge project, though.
Ciao,
Mario
[1]
http://www.jarvana.com/jarvana/view/org/jboss/weld/weld-se/1.0.0-CR2/weld-se-1.0.0-CR2-javadoc.jar!/org/jboss/weld/environment/se/events/ContainerInitialized.htmlhttp://www.jarvana.com/jarvana/view/org/jboss/weld/weld-se/1.0.0-CR2/weld-se-1.0.0-CR2-javadoc.jar%21/org/jboss/weld/environment/se/events/ContainerInitialized.html
--
Gurkan Erdogdu
http://gurkanerdogdu.blogspot.com