You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jarek Gawor <jg...@gmail.com> on 2010/10/21 23:06:10 UTC
Injection of Bundle/BundleContext into Java EE components
Hi all,
I was thinking about adding support for injection of
Bundle/BundleContext objects into Java EE components via @Resource
annotation. Example:
class MyServlet extends HttpServlet {
@Resource
Bundle bundle;
@Resource
BundleContext bundleContext;
....
}
That should make it easier to interact with OSGi within Java EE apps.
I was also thinking of something similar with @Inject for web beans
(cdi stuff) but I'm not really sure it's all that useful since it
should be possible to inject Bundle/BundleContext via @Resource or
combine it with @Produces.
What do you think?
Jarek
Re: Injection of Bundle/BundleContext into Java EE components
Posted by Lin Sun <li...@gmail.com>.
Hi
Sounds useful! I wonder if we want to support injecting both or just
bundleContext, since it is pretty straightforward to get bundle from
bundleContext (or the other way around).
Lin
On Thu, Oct 21, 2010 at 5:06 PM, Jarek Gawor <jg...@gmail.com> wrote:
> Hi all,
>
> I was thinking about adding support for injection of
> Bundle/BundleContext objects into Java EE components via @Resource
> annotation. Example:
>
> class MyServlet extends HttpServlet {
> @Resource
> Bundle bundle;
> @Resource
> BundleContext bundleContext;
> ....
> }
>
> That should make it easier to interact with OSGi within Java EE apps.
>
> I was also thinking of something similar with @Inject for web beans
> (cdi stuff) but I'm not really sure it's all that useful since it
> should be possible to inject Bundle/BundleContext via @Resource or
> combine it with @Produces.
>
> What do you think?
>
> Jarek
>
Re: Injection of Bundle/BundleContext into Java EE components
Posted by Joe Bohn <jo...@earthlink.net>.
Yay!
Joe
On 10/21/10 5:06 PM, Jarek Gawor wrote:
> Hi all,
>
> I was thinking about adding support for injection of
> Bundle/BundleContext objects into Java EE components via @Resource
> annotation. Example:
>
> class MyServlet extends HttpServlet {
> @Resource
> Bundle bundle;
> @Resource
> BundleContext bundleContext;
> ....
> }
>
> That should make it easier to interact with OSGi within Java EE apps.
>
> I was also thinking of something similar with @Inject for web beans
> (cdi stuff) but I'm not really sure it's all that useful since it
> should be possible to inject Bundle/BundleContext via @Resource or
> combine it with @Produces.
>
> What do you think?
>
> Jarek
>
Re: Injection of Bundle/BundleContext into Java EE components
Posted by David Jencks <da...@yahoo.com>.
dunno about the @Inject (seems like a good idea but I don't know enough about jcdi) but the @Resource is a great idea!
david jencks
On Oct 21, 2010, at 2:06 PM, Jarek Gawor wrote:
> Hi all,
>
> I was thinking about adding support for injection of
> Bundle/BundleContext objects into Java EE components via @Resource
> annotation. Example:
>
> class MyServlet extends HttpServlet {
> @Resource
> Bundle bundle;
> @Resource
> BundleContext bundleContext;
> ....
> }
>
> That should make it easier to interact with OSGi within Java EE apps.
>
> I was also thinking of something similar with @Inject for web beans
> (cdi stuff) but I'm not really sure it's all that useful since it
> should be possible to inject Bundle/BundleContext via @Resource or
> combine it with @Produces.
>
> What do you think?
>
> Jarek