lburgazzoli / gradle-karaf-plugin

Apache License 2.0
21 stars 13 forks source link

Auto generate feature capabilitiy #31

Open dixiesraj opened 7 years ago

dixiesraj commented 7 years ago

Hello,

I have a bundle with Require-Capability: headers requiring multiple "osgi.service;" services with effective:=active.

When I tried the capability option as below

            capability('osgi.service') {
                effective = 'active'
                extra = 'objectClass=io.dartle.apis.service1'
            }
            capability('osgi.service') {
                effective = 'active'
                extra = 'objectClass=io.dartle.apis.service2'
            }

Note: both are of osgi.service kinds

I expected the generated feature xml to have all the capabilities, but I see only the last entry viz. io.dartle.apis.service2. I think It is overwritten.

Need advice on the following:

  1. How to add multiple service capability requirements?
  2. Or is there a way to auto generate capabilities when a JAR is being validated to be a Bundle?

~Dixie.

lburgazzoli commented 7 years ago
  1. I think it is not possible now, I'll have a look soon
  2. It is not possible at the moment but if you have any suggestion I'd be more than happy to implemnt it, or merge your PR ;)
yrashk commented 7 years ago

You can define a List-typed capability on a bundle instead, using an instruction, either in the bundle being built or by overriding it through pax wrap On Fri, Oct 14, 2016 at 10:55 PM Luca Burgazzoli notifications@github.com wrote:

  1. I think it is not possible now, I'll have a look soon
  2. It is not possible at the moment but if you have any suggestion I'd be more than happy to implemnt it, or merge your PR ;)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lburgazzoli/gradle-karaf-plugin/issues/31#issuecomment-253842108, or mute the thread https://github.com/notifications/unsubscribe-auth/AAABxHkCoXaBNmzs8OkvMfWEtsuDs4T-ks5qz6X_gaJpZM4KXKHX .

dixiesraj commented 7 years ago

@lburgazzoli Sure, let me go through the code by end of this month. @yrashk you think the following would work?

capability('osgi.service') {
                effective = 'active'
                filter = "(&(objectClass=io.apis.service1)(objectClass=io.apis.service2))"
}
dixiesraj commented 7 years ago

Hello,

Here is what I have done,

  1. Changed the xsdVersion to 1.2
  2. Removed the capabilities
  3. Then updated the org.apache.karaf.features.cfg xml to disable resolution (temporarily)

It works now, but looks like we have to invest more time for an elegant solution.

~Dixie