You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by David Blevins <da...@gmail.com> on 2012/03/29 23:44:29 UTC

Fwd: CDI annotations in OSGi

Has anyone seen this before?  Wonder if it might make sense as a DeltaSpike component.


-David

Begin forwarded message:

> From: David Bosschaert <da...@gmail.com>
> Subject: Re: CDI annotations in OSGi
> Date: March 29, 2012 2:23:58 PM PDT
> To: dev@aries.apache.org
> Reply-To: dev@aries.apache.org
> 
> FYI - something like this has also been implemented in the Weld-OSGi
> project: https://github.com/mathieuancelin/weld-osgi
> 
> Best regards,
> 
> David
> 
> On 29 March 2012 16:02, David Blevins <da...@gmail.com> wrote:
>> 
>> On Mar 25, 2012, at 9:01 AM, David Jencks wrote:
>> 
>>> Getting OWB to work in a plain osgi environment should not be too hard.  I think the CDI annotation model is a lot better in all ways than blueprint.
>>> 
>>> I think what's missing is the connection to OSGI services.  To be more than a self-contained set of components with no relationship to anything outside the bundle you need a way to consume osgi services from CDI components and expose CDI beans as services.  I haven't seen a proposal on how to do this.
>> 
>> A CDI Extension should be able to export all the services from OSGi into CDI.  The extension could easily export too, if you wanted.
>> 
>> Rick Hightower wrote a bi-directional CDI/Spring bridge using that technique.  Should be illuminating for bridging OSGi and CDI:
>> 
>>  http://rick-hightower.blogspot.com/2011/04/spring-meet-cdi-cdi-meet-spring.html
>> 
>> 
>> -David
>> 
>>> 
>>> On Mar 25, 2012, at 3:13 AM, Christian Schneider wrote:
>>> 
>>>> Found a newer thread.
>>>> http://openejb.979440.n4.nabble.com/OSGi-Work-td4223311.html
>>>> 
>>>> Seems a lot has improved since the first thread I found. I will try to get this running and report on what I have found. Perhaps Charles can also comment on this as he seems to be one of the drivers behind the efforts on the openejb side. I am not sure if he watches this list. I will also ask on the openejb list.
>>>> 
>>>> Christian
>>>> 
>>>> Am 25.03.2012 12:04, schrieb Christian Schneider:
>>>>> That would be ideal of course. Does anyone know if openejb could be used for this?
>>>>> 
>>>>> I found this page which shows how to use openejb in OSGi:
>>>>> https://cwiki.apache.org/OPENEJB/osgi-openejb.html
>>>>> 
>>>>> and I found an interesting thread:
>>>>> http://openejb.979440.n4.nabble.com/OpenEJB-and-OSGi-td981781.html#a981782
>>>>> 
>>>>> So this sounds like it would work but not that nicely. You have to require the openejb bundle and you have to use an Activator.
>>>>> Ideally I would like this to work like blueprint. Where you have an extender that finds the trigger (META-INF/beans.xml) and initializes the bundle accordingly.
>>>>> Additionally it seems that openejb seems to have some dependencies on eclipse RCP bundles which is not good for a server deployment.
>>>> 
>>>> --
>>>> 
>>>> Christian Schneider
>>>> http://www.liquid-reality.de
>>>> 
>>>> Open Source Architect
>>>> Talend Application Integration Division http://www.talend.com
>>>> 
>>> 
>> 


Re: CDI annotations in OSGi

Posted by Mark Struberg <st...@yahoo.de>.

regarding CDI container bootstrapping: there is already the cdictrl package in Apache DeltaSpike which provides such a thing. Could help to reduce duplicate effort. If you need additional features then feel free to add it over there.

We currently have the following impls: Weld-standalone, OWB-standalone, OpenEJB-standalone. 

I is really easy to add other impls.


LieGrue,
strub


>________________________________
> From: Mathieu ANCELIN <ma...@gmail.com>
>To: Pete Muir <pm...@redhat.com>; deltaspike-dev@incubator.apache.org 
>Cc: David Bosschaert <da...@redhat.com>; Martin Kouba <mk...@redhat.com>; Matthieu Clochard <ma...@serli.com> 
>Sent: Friday, March 30, 2012 2:00 PM
>Subject: Re: CDI annotations in OSGi
> 
>Hi all,
>
>actually the main part of Weld-OSGi is (well, it should be) a pure CDI
>portable extension. We designed the whole thing to be CDI implementation
>agnostic as much as possible. With this extension, you're able to do almost
>everything you can do with OSGi but in a CDI way.
>
>The main features are listed here :
>
>http://www.slideshare.net/TrevorReznik/weldosgi-injecting-easiness-in-osgi
>
>The code can be found here :
>
>https://github.com/mathieuancelin/core/tree/weld-osgi/environments/osgi/
>
>About CDI container bootstrapping, as Pete said, there is no SPI provided
>by CDI 1.0 but luckily it may be available in CDI 1.1 :-) So we provide a
>dedicated SPI to handle CDI container bootstrapping and not be tied to a
>CDI implementation. To do so, you just have to implements few interfaces
>and expose them as an OSGi service. The extension part will then be able to
>consume this service and launch CDI containers. Your can found a schema
>about that here :
>
>https://github.com/mathieuancelin/core/blob/weld-osgi/environments/osgi/docs/design/src/main/docbook/en-US/images/5Bundles.png
>
>and the code of the SPI can be found here :
>
>https://github.com/mathieuancelin/core/tree/weld-osgi/environments/osgi/core/spi/src/main/java/org/jboss/weld/environment/osgi/spi
>
>If you have questions about Weld-OSGi, don't hesistate.
>
>On Fri, Mar 30, 2012 at 12:15 PM, Pete Muir <pm...@redhat.com> wrote:
>
>> Exposing OSGi services to CDI should be portable, but the rest of what is
>> in OSGi Weld isn't so easy IMO, as it actually involves how the CDI
>> container is booted, which doesn't have an SPI in CDI. Mathieu can tell you
>> more.
>>
>> Note that we are also pursuing this as an OSGI spec (David and Martin in
>> cc).
>>
>> On 29 Mar 2012, at 23:21, Ales Justin wrote:
>>
>> > This will be (or, actually, already is) part of Weld Core project.
>> > We just need to bump the version, as it requires some API changes.
>> > Then it will be part of our upstream.
>> >
>> > Dunno how Weld specific it is, but guessing it shouldn't be much.
>> > Hence it could make sense to turn it into DS component.
>> >
>> > -Ales
>> >
>> >> Has anyone seen this before?  Wonder if it might make sense as a
>> DeltaSpike component.
>> >>
>> >>
>> >> -David
>> >>
>> >> Begin forwarded message:
>> >>
>> >>> From: David Bosschaert <da...@gmail.com>
>> >>> Subject: Re: CDI annotations in OSGi
>> >>> Date: March 29, 2012 2:23:58 PM PDT
>> >>> To: dev@aries.apache.org
>> >>> Reply-To: dev@aries.apache.org
>> >>>
>> >>> FYI - something like this has also been implemented in the Weld-OSGi
>> >>> project: https://github.com/mathieuancelin/weld-osgi
>> >>>
>> >>> Best regards,
>> >>>
>> >>> David
>> >>>
>> >>> On 29 March 2012 16:02, David Blevins <da...@gmail.com> wrote:
>> >>>>
>> >>>> On Mar 25, 2012, at 9:01 AM, David Jencks wrote:
>> >>>>
>> >>>>> Getting OWB to work in a plain osgi environment should not be too
>> hard.  I think the CDI annotation model is a lot better in all ways than
>> blueprint.
>> >>>>>
>> >>>>> I think what's missing is the connection to OSGI services.  To be
>> more than a self-contained set of components with no relationship to
>> anything outside the bundle you need a way to consume osgi services from
>> CDI components and expose CDI beans as services.  I haven't seen a proposal
>> on how to do this.
>> >>>>
>> >>>> A CDI Extension should be able to export all the services from OSGi
>> into CDI.  The extension could easily export too, if you wanted.
>> >>>>
>> >>>> Rick Hightower wrote a bi-directional CDI/Spring bridge using that
>> technique.  Should be illuminating for bridging OSGi and CDI:
>> >>>>
>> >>>>
>> http://rick-hightower.blogspot.com/2011/04/spring-meet-cdi-cdi-meet-spring.html
>> >>>>
>> >>>>
>> >>>> -David
>> >>>>
>> >>>>>
>> >>>>> On Mar 25, 2012, at 3:13 AM, Christian Schneider wrote:
>> >>>>>
>> >>>>>> Found a newer thread.
>> >>>>>> http://openejb.979440.n4.nabble.com/OSGi-Work-td4223311.html
>> >>>>>>
>> >>>>>> Seems a lot has improved since the first thread I found. I will try
>> to get this running and report on what I have found. Perhaps Charles can
>> also comment on this as he seems to be one of the drivers behind the
>> efforts on the openejb side. I am not sure if he watches this list. I will
>> also ask on the openejb list.
>> >>>>>>
>> >>>>>> Christian
>> >>>>>>
>> >>>>>> Am 25.03.2012 12:04, schrieb Christian Schneider:
>> >>>>>>> That would be ideal of course. Does anyone know if openejb could
>> be used for this?
>> >>>>>>>
>> >>>>>>> I found this page which shows how to use openejb in OSGi:
>> >>>>>>> https://cwiki.apache.org/OPENEJB/osgi-openejb.html
>> >>>>>>>
>> >>>>>>> and I found an interesting thread:
>> >>>>>>>
>> http://openejb.979440.n4.nabble.com/OpenEJB-and-OSGi-td981781.html#a981782
>> >>>>>>>
>> >>>>>>> So this sounds like it would work but not that nicely. You have to
>> require the openejb bundle and you have to use an Activator.
>> >>>>>>> Ideally I would like this to work like blueprint. Where you have
>> an extender that finds the trigger (META-INF/beans.xml) and initializes the
>> bundle accordingly.
>> >>>>>>> Additionally it seems that openejb seems to have some dependencies
>> on eclipse RCP bundles which is not good for a server deployment.
>> >>>>>>
>> >>>>>> --
>> >>>>>>
>> >>>>>> Christian Schneider
>> >>>>>> http://www.liquid-reality.de
>> >>>>>>
>> >>>>>> Open Source Architect
>> >>>>>> Talend Application Integration Division http://www.talend.com
>> >>>>>>
>> >>>>>
>> >>>>
>> >>
>> >
>>
>>
>
>
>-- 
>
>Cordialement.
>
>Mathieu ANCELIN
>
>
>

Re: CDI annotations in OSGi

Posted by Mathieu ANCELIN <ma...@gmail.com>.
Hi all,

actually the main part of Weld-OSGi is (well, it should be) a pure CDI
portable extension. We designed the whole thing to be CDI implementation
agnostic as much as possible. With this extension, you're able to do almost
everything you can do with OSGi but in a CDI way.

The main features are listed here :

http://www.slideshare.net/TrevorReznik/weldosgi-injecting-easiness-in-osgi

The code can be found here :

https://github.com/mathieuancelin/core/tree/weld-osgi/environments/osgi/

About CDI container bootstrapping, as Pete said, there is no SPI provided
by CDI 1.0 but luckily it may be available in CDI 1.1 :-) So we provide a
dedicated SPI to handle CDI container bootstrapping and not be tied to a
CDI implementation. To do so, you just have to implements few interfaces
and expose them as an OSGi service. The extension part will then be able to
consume this service and launch CDI containers. Your can found a schema
about that here :

https://github.com/mathieuancelin/core/blob/weld-osgi/environments/osgi/docs/design/src/main/docbook/en-US/images/5Bundles.png

and the code of the SPI can be found here :

https://github.com/mathieuancelin/core/tree/weld-osgi/environments/osgi/core/spi/src/main/java/org/jboss/weld/environment/osgi/spi

If you have questions about Weld-OSGi, don't hesistate.

On Fri, Mar 30, 2012 at 12:15 PM, Pete Muir <pm...@redhat.com> wrote:

> Exposing OSGi services to CDI should be portable, but the rest of what is
> in OSGi Weld isn't so easy IMO, as it actually involves how the CDI
> container is booted, which doesn't have an SPI in CDI. Mathieu can tell you
> more.
>
> Note that we are also pursuing this as an OSGI spec (David and Martin in
> cc).
>
> On 29 Mar 2012, at 23:21, Ales Justin wrote:
>
> > This will be (or, actually, already is) part of Weld Core project.
> > We just need to bump the version, as it requires some API changes.
> > Then it will be part of our upstream.
> >
> > Dunno how Weld specific it is, but guessing it shouldn't be much.
> > Hence it could make sense to turn it into DS component.
> >
> > -Ales
> >
> >> Has anyone seen this before?  Wonder if it might make sense as a
> DeltaSpike component.
> >>
> >>
> >> -David
> >>
> >> Begin forwarded message:
> >>
> >>> From: David Bosschaert <da...@gmail.com>
> >>> Subject: Re: CDI annotations in OSGi
> >>> Date: March 29, 2012 2:23:58 PM PDT
> >>> To: dev@aries.apache.org
> >>> Reply-To: dev@aries.apache.org
> >>>
> >>> FYI - something like this has also been implemented in the Weld-OSGi
> >>> project: https://github.com/mathieuancelin/weld-osgi
> >>>
> >>> Best regards,
> >>>
> >>> David
> >>>
> >>> On 29 March 2012 16:02, David Blevins <da...@gmail.com> wrote:
> >>>>
> >>>> On Mar 25, 2012, at 9:01 AM, David Jencks wrote:
> >>>>
> >>>>> Getting OWB to work in a plain osgi environment should not be too
> hard.  I think the CDI annotation model is a lot better in all ways than
> blueprint.
> >>>>>
> >>>>> I think what's missing is the connection to OSGI services.  To be
> more than a self-contained set of components with no relationship to
> anything outside the bundle you need a way to consume osgi services from
> CDI components and expose CDI beans as services.  I haven't seen a proposal
> on how to do this.
> >>>>
> >>>> A CDI Extension should be able to export all the services from OSGi
> into CDI.  The extension could easily export too, if you wanted.
> >>>>
> >>>> Rick Hightower wrote a bi-directional CDI/Spring bridge using that
> technique.  Should be illuminating for bridging OSGi and CDI:
> >>>>
> >>>>
> http://rick-hightower.blogspot.com/2011/04/spring-meet-cdi-cdi-meet-spring.html
> >>>>
> >>>>
> >>>> -David
> >>>>
> >>>>>
> >>>>> On Mar 25, 2012, at 3:13 AM, Christian Schneider wrote:
> >>>>>
> >>>>>> Found a newer thread.
> >>>>>> http://openejb.979440.n4.nabble.com/OSGi-Work-td4223311.html
> >>>>>>
> >>>>>> Seems a lot has improved since the first thread I found. I will try
> to get this running and report on what I have found. Perhaps Charles can
> also comment on this as he seems to be one of the drivers behind the
> efforts on the openejb side. I am not sure if he watches this list. I will
> also ask on the openejb list.
> >>>>>>
> >>>>>> Christian
> >>>>>>
> >>>>>> Am 25.03.2012 12:04, schrieb Christian Schneider:
> >>>>>>> That would be ideal of course. Does anyone know if openejb could
> be used for this?
> >>>>>>>
> >>>>>>> I found this page which shows how to use openejb in OSGi:
> >>>>>>> https://cwiki.apache.org/OPENEJB/osgi-openejb.html
> >>>>>>>
> >>>>>>> and I found an interesting thread:
> >>>>>>>
> http://openejb.979440.n4.nabble.com/OpenEJB-and-OSGi-td981781.html#a981782
> >>>>>>>
> >>>>>>> So this sounds like it would work but not that nicely. You have to
> require the openejb bundle and you have to use an Activator.
> >>>>>>> Ideally I would like this to work like blueprint. Where you have
> an extender that finds the trigger (META-INF/beans.xml) and initializes the
> bundle accordingly.
> >>>>>>> Additionally it seems that openejb seems to have some dependencies
> on eclipse RCP bundles which is not good for a server deployment.
> >>>>>>
> >>>>>> --
> >>>>>>
> >>>>>> Christian Schneider
> >>>>>> http://www.liquid-reality.de
> >>>>>>
> >>>>>> Open Source Architect
> >>>>>> Talend Application Integration Division http://www.talend.com
> >>>>>>
> >>>>>
> >>>>
> >>
> >
>
>


-- 

Cordialement.

Mathieu ANCELIN

Re: CDI annotations in OSGi

Posted by Pete Muir <pm...@redhat.com>.
Exposing OSGi services to CDI should be portable, but the rest of what is in OSGi Weld isn't so easy IMO, as it actually involves how the CDI container is booted, which doesn't have an SPI in CDI. Mathieu can tell you more.

Note that we are also pursuing this as an OSGI spec (David and Martin in cc).

On 29 Mar 2012, at 23:21, Ales Justin wrote:

> This will be (or, actually, already is) part of Weld Core project.
> We just need to bump the version, as it requires some API changes.
> Then it will be part of our upstream.
> 
> Dunno how Weld specific it is, but guessing it shouldn't be much.
> Hence it could make sense to turn it into DS component.
> 
> -Ales
> 
>> Has anyone seen this before?  Wonder if it might make sense as a DeltaSpike component.
>> 
>> 
>> -David
>> 
>> Begin forwarded message:
>> 
>>> From: David Bosschaert <da...@gmail.com>
>>> Subject: Re: CDI annotations in OSGi
>>> Date: March 29, 2012 2:23:58 PM PDT
>>> To: dev@aries.apache.org
>>> Reply-To: dev@aries.apache.org
>>> 
>>> FYI - something like this has also been implemented in the Weld-OSGi
>>> project: https://github.com/mathieuancelin/weld-osgi
>>> 
>>> Best regards,
>>> 
>>> David
>>> 
>>> On 29 March 2012 16:02, David Blevins <da...@gmail.com> wrote:
>>>> 
>>>> On Mar 25, 2012, at 9:01 AM, David Jencks wrote:
>>>> 
>>>>> Getting OWB to work in a plain osgi environment should not be too hard.  I think the CDI annotation model is a lot better in all ways than blueprint.
>>>>> 
>>>>> I think what's missing is the connection to OSGI services.  To be more than a self-contained set of components with no relationship to anything outside the bundle you need a way to consume osgi services from CDI components and expose CDI beans as services.  I haven't seen a proposal on how to do this.
>>>> 
>>>> A CDI Extension should be able to export all the services from OSGi into CDI.  The extension could easily export too, if you wanted.
>>>> 
>>>> Rick Hightower wrote a bi-directional CDI/Spring bridge using that technique.  Should be illuminating for bridging OSGi and CDI:
>>>> 
>>>> http://rick-hightower.blogspot.com/2011/04/spring-meet-cdi-cdi-meet-spring.html
>>>> 
>>>> 
>>>> -David
>>>> 
>>>>> 
>>>>> On Mar 25, 2012, at 3:13 AM, Christian Schneider wrote:
>>>>> 
>>>>>> Found a newer thread.
>>>>>> http://openejb.979440.n4.nabble.com/OSGi-Work-td4223311.html
>>>>>> 
>>>>>> Seems a lot has improved since the first thread I found. I will try to get this running and report on what I have found. Perhaps Charles can also comment on this as he seems to be one of the drivers behind the efforts on the openejb side. I am not sure if he watches this list. I will also ask on the openejb list.
>>>>>> 
>>>>>> Christian
>>>>>> 
>>>>>> Am 25.03.2012 12:04, schrieb Christian Schneider:
>>>>>>> That would be ideal of course. Does anyone know if openejb could be used for this?
>>>>>>> 
>>>>>>> I found this page which shows how to use openejb in OSGi:
>>>>>>> https://cwiki.apache.org/OPENEJB/osgi-openejb.html
>>>>>>> 
>>>>>>> and I found an interesting thread:
>>>>>>> http://openejb.979440.n4.nabble.com/OpenEJB-and-OSGi-td981781.html#a981782
>>>>>>> 
>>>>>>> So this sounds like it would work but not that nicely. You have to require the openejb bundle and you have to use an Activator.
>>>>>>> Ideally I would like this to work like blueprint. Where you have an extender that finds the trigger (META-INF/beans.xml) and initializes the bundle accordingly.
>>>>>>> Additionally it seems that openejb seems to have some dependencies on eclipse RCP bundles which is not good for a server deployment.
>>>>>> 
>>>>>> --
>>>>>> 
>>>>>> Christian Schneider
>>>>>> http://www.liquid-reality.de
>>>>>> 
>>>>>> Open Source Architect
>>>>>> Talend Application Integration Division http://www.talend.com
>>>>>> 
>>>>> 
>>>> 
>> 
> 


Re: CDI annotations in OSGi

Posted by Ales Justin <al...@gmail.com>.
This will be (or, actually, already is) part of Weld Core project.
We just need to bump the version, as it requires some API changes.
Then it will be part of our upstream.

Dunno how Weld specific it is, but guessing it shouldn't be much.
Hence it could make sense to turn it into DS component.

-Ales

> Has anyone seen this before?  Wonder if it might make sense as a DeltaSpike component.
> 
> 
> -David
> 
> Begin forwarded message:
> 
>> From: David Bosschaert <da...@gmail.com>
>> Subject: Re: CDI annotations in OSGi
>> Date: March 29, 2012 2:23:58 PM PDT
>> To: dev@aries.apache.org
>> Reply-To: dev@aries.apache.org
>> 
>> FYI - something like this has also been implemented in the Weld-OSGi
>> project: https://github.com/mathieuancelin/weld-osgi
>> 
>> Best regards,
>> 
>> David
>> 
>> On 29 March 2012 16:02, David Blevins <da...@gmail.com> wrote:
>>> 
>>> On Mar 25, 2012, at 9:01 AM, David Jencks wrote:
>>> 
>>>> Getting OWB to work in a plain osgi environment should not be too hard.  I think the CDI annotation model is a lot better in all ways than blueprint.
>>>> 
>>>> I think what's missing is the connection to OSGI services.  To be more than a self-contained set of components with no relationship to anything outside the bundle you need a way to consume osgi services from CDI components and expose CDI beans as services.  I haven't seen a proposal on how to do this.
>>> 
>>> A CDI Extension should be able to export all the services from OSGi into CDI.  The extension could easily export too, if you wanted.
>>> 
>>> Rick Hightower wrote a bi-directional CDI/Spring bridge using that technique.  Should be illuminating for bridging OSGi and CDI:
>>> 
>>> http://rick-hightower.blogspot.com/2011/04/spring-meet-cdi-cdi-meet-spring.html
>>> 
>>> 
>>> -David
>>> 
>>>> 
>>>> On Mar 25, 2012, at 3:13 AM, Christian Schneider wrote:
>>>> 
>>>>> Found a newer thread.
>>>>> http://openejb.979440.n4.nabble.com/OSGi-Work-td4223311.html
>>>>> 
>>>>> Seems a lot has improved since the first thread I found. I will try to get this running and report on what I have found. Perhaps Charles can also comment on this as he seems to be one of the drivers behind the efforts on the openejb side. I am not sure if he watches this list. I will also ask on the openejb list.
>>>>> 
>>>>> Christian
>>>>> 
>>>>> Am 25.03.2012 12:04, schrieb Christian Schneider:
>>>>>> That would be ideal of course. Does anyone know if openejb could be used for this?
>>>>>> 
>>>>>> I found this page which shows how to use openejb in OSGi:
>>>>>> https://cwiki.apache.org/OPENEJB/osgi-openejb.html
>>>>>> 
>>>>>> and I found an interesting thread:
>>>>>> http://openejb.979440.n4.nabble.com/OpenEJB-and-OSGi-td981781.html#a981782
>>>>>> 
>>>>>> So this sounds like it would work but not that nicely. You have to require the openejb bundle and you have to use an Activator.
>>>>>> Ideally I would like this to work like blueprint. Where you have an extender that finds the trigger (META-INF/beans.xml) and initializes the bundle accordingly.
>>>>>> Additionally it seems that openejb seems to have some dependencies on eclipse RCP bundles which is not good for a server deployment.
>>>>> 
>>>>> --
>>>>> 
>>>>> Christian Schneider
>>>>> http://www.liquid-reality.de
>>>>> 
>>>>> Open Source Architect
>>>>> Talend Application Integration Division http://www.talend.com
>>>>> 
>>>> 
>>> 
>