You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by David Leangen <os...@leangen.net> on 2017/07/11 12:06:51 UTC

Provide-Capability in manifest

Hi!

Without having to write it in manually, how can I change the pom to get the Converter projects to output the Provide-Capability manifest headers (particularly for the osgi.servic;objectClass…)?

Currently, they are not being generated by the maven-bundle-plugin (v3.2.0).


Cheers,
=David


Re: Provide-Capability in manifest

Posted by David Leangen <os...@leangen.net>.
Sorry about that.

My original question was off track due to my lack of understanding about how bnd works. I had not made the connection between DS and bnd's header processing. Since the services provided in the code are not DS components, there is no way for bnd to pick them up. I understand that now.

However, I did notice that by using the @ProvideCapability header, it would be possible generate the objectClass header instead of writing it in the pom. The only small advantage, though, is to keep the Annotation in code. It would still have to be maintained. The disadvantage is that it may not be immediately obvious where to find it. (Writing it by hand in the pom at least makes it obvious.)  It also creates an extra dependency on bndlib. So, even though it’s possible, it’s probably not really worth the effort.

In code, it would look like this:

@ProvideCapability(
        ns = "osgi.service",
        value = "objectClass:List<String>=\"" + Activator.SERVICE_CLASS + "\""
)
public class Activator implements BundleActivator {
    public static final String SERVICE_CLASS = "com.example.MyServiceClass";

    ...
}


I appreciate your follow up and desire to help. Thanks!

Cheers,
=David


> On Jul 16, 2017, at 4:44 AM, David Jencks <da...@gmail.com> wrote:
> 
> I’m getting more and more confused :-(  Are the services you’re trying to advertise implemented with DS components?
> 
> Looking at the bnd code I don’t see how it can be replacing any provide service header parts.  Can you explain in detail the scenario that “won’t work”?
> 
> thanks
> david jencks
> 
> 
> 
>> On Jul 14, 2017, at 12:45 PM, David Leangen <os...@leangen.net> wrote:
>> 
>> 
>>>> On Jul 13, 2017, at 6:23 PM, Mark Derricutt <ma...@talios.com> wrote:
>> 
>>>> Which set of annotations are you using?
>> 
>>> On Jul 15, 2017, at 4:02 AM, David Jencks <da...@gmail.com> wrote:
>> 
>>> I would be interested to know what the gradle magic is….
>> 
>> I am not a deep expert in bnd, but I did a quick investigation. I think that bnd looks for @Component annotations, so actually is DS-based. So my earlier statement was misleading: it looks like it has nothing to do with gradle after all.
>> 
>> I tried experimenting using the @Provide-Capability header. That could potentially work.
>> 
>> Note that this won’t work if you mix with DS components. Instead of adding classes to the list of objectClass, it added a completely new “osgi.service;objectClass…” entry. 
>> 
>> 
>> Cheers,
>> =David
>> 
> 


Re: Provide-Capability in manifest

Posted by David Jencks <da...@gmail.com>.
I’m getting more and more confused :-(  Are the services you’re trying to advertise implemented with DS components?

Looking at the bnd code I don’t see how it can be replacing any provide service header parts.  Can you explain in detail the scenario that “won’t work”?

thanks
david jencks



> On Jul 14, 2017, at 12:45 PM, David Leangen <os...@leangen.net> wrote:
> 
> 
>>> On Jul 13, 2017, at 6:23 PM, Mark Derricutt <ma...@talios.com> wrote:
> 
>>> Which set of annotations are you using?
> 
>> On Jul 15, 2017, at 4:02 AM, David Jencks <da...@gmail.com> wrote:
> 
>> I would be interested to know what the gradle magic is….
> 
> I am not a deep expert in bnd, but I did a quick investigation. I think that bnd looks for @Component annotations, so actually is DS-based. So my earlier statement was misleading: it looks like it has nothing to do with gradle after all.
> 
> I tried experimenting using the @Provide-Capability header. That could potentially work.
> 
> Note that this won’t work if you mix with DS components. Instead of adding classes to the list of objectClass, it added a completely new “osgi.service;objectClass…” entry. 
> 
> 
> Cheers,
> =David
> 


Re: Provide-Capability in manifest

Posted by David Leangen <os...@leangen.net>.
>> On Jul 13, 2017, at 6:23 PM, Mark Derricutt <ma...@talios.com> wrote:

>> Which set of annotations are you using?

> On Jul 15, 2017, at 4:02 AM, David Jencks <da...@gmail.com> wrote:

> I would be interested to know what the gradle magic is….

I am not a deep expert in bnd, but I did a quick investigation. I think that bnd looks for @Component annotations, so actually is DS-based. So my earlier statement was misleading: it looks like it has nothing to do with gradle after all.

I tried experimenting using the @Provide-Capability header. That could potentially work.

Note that this won’t work if you mix with DS components. Instead of adding classes to the list of objectClass, it added a completely new “osgi.service;objectClass…” entry. 


Cheers,
=David


Re: Provide-Capability in manifest

Posted by David Jencks <da...@gmail.com>.
That would only be relevant if David has a DS component.  DS itself is not a DS component and although I haven’t looked I rather doubt the converter service is either.

I don’t know if there’s going to be a more focussed non-DS annotation for this in R7.  There might be a bnd annotation.

I would be interested to know what the gradle magic is….

thanks
david jencks

> On Jul 13, 2017, at 6:23 PM, Mark Derricutt <ma...@talios.com> wrote:
> 
> On 14 Jul 2017, at 10:53, David Leangen wrote:
> 
> Working with gradle, these headers are generated automagically, but I’m not sure what the magic is behind it.
> 
> For me, with the bundle-maven-plugin - using the newer org.osgi annotations will generate those entries, but using the felix scr annotations doesn't.
> 
> Which set of annotations are you using?
> 
> "The ease with which a change can be implemented has no relevance at all to whether it is the right change for the (Java) Platform for all time." — Mark Reinhold.
> 
> Mark Derricutt
> http://www.theoryinpractice.net <http://www.theoryinpractice.net/>
> http://www.chaliceofblood.net <http://www.chaliceofblood.net/>
> http://plus.google.com/+MarkDerricutt <http://plus.google.com/+MarkDerricutt>
> http://twitter.com/talios <http://twitter.com/talios>
> http://facebook.com/mderricutt <http://facebook.com/mderricutt>

Re: Provide-Capability in manifest

Posted by Mark Derricutt <ma...@talios.com>.
On 14 Jul 2017, at 10:53, David Leangen wrote:

> Working with gradle, these headers are generated automagically, but I’m not sure what the magic is behind it.

For me, with the bundle-maven-plugin - using the newer org.osgi annotations will generate those entries, but using the felix scr annotations doesn't.

Which set of annotations are you using?



---
"The ease with which a change can be implemented has no relevance at all to whether it is the right change for the (Java) Platform for all time." &mdash; Mark Reinhold.

Mark Derricutt
http://www.theoryinpractice.net
http://www.chaliceofblood.net
http://plus.google.com/+MarkDerricutt
http://twitter.com/talios
http://facebook.com/mderricutt

Re: Provide-Capability in manifest

Posted by David Leangen <os...@leangen.net>.
Thanks, David.

I ended up writing it manually as well.

Working with gradle, these headers are generated automagically, but I’m not sure what the magic is behind it.


Cheers,
=David


> On Jul 14, 2017, at 7:34 AM, David Jencks <da...@gmail.com> wrote:
> 
> I wrote it manually (in a bnd.bnd file) for DS.  If Peter has thought up some way of generating this since then you are more likely to find out about it asking on the bnd list.
> 
> david jencks
> 
>> On Jul 11, 2017, at 5:06 AM, David Leangen <os...@leangen.net> wrote:
>> 
>> Hi!
>> 
>> Without having to write it in manually, how can I change the pom to get the Converter projects to output the Provide-Capability manifest headers (particularly for the osgi.servic;objectClass…)?
>> 
>> Currently, they are not being generated by the maven-bundle-plugin (v3.2.0).
>> 
>> 
>> Cheers,
>> =David
>> 
> 


Re: Provide-Capability in manifest

Posted by David Jencks <da...@gmail.com>.
I wrote it manually (in a bnd.bnd file) for DS.  If Peter has thought up some way of generating this since then you are more likely to find out about it asking on the bnd list.

david jencks

> On Jul 11, 2017, at 5:06 AM, David Leangen <os...@leangen.net> wrote:
> 
> Hi!
> 
> Without having to write it in manually, how can I change the pom to get the Converter projects to output the Provide-Capability manifest headers (particularly for the osgi.servic;objectClass…)?
> 
> Currently, they are not being generated by the maven-bundle-plugin (v3.2.0).
> 
> 
> Cheers,
> =David
>