javaeclipseosgiipojo

Restrict non-iPOJO services being installed in OSGI


I am currently trying to find a way to "filter" bundles in OSGI, while installing them. I use Karaf as an OSGI implementation and iPOJO for service resolution. Is there any way I can ensure, that only services provided by iPOJO are allowed to be installed in OSGI?

I already searched the web for methods to see wether the specific service imports OSGI stuff(like BundleContext etc.), but that doesnt seem to be working easily.

Thank you :)


Solution

  • I got a solution to my problem... I kind of did it like erosb was suggesting. Every IPOJO service reference owns the property "name", so i just created a LDAP-filter for the @Bind method, which accepts all values for the name-property(filter = "(instance.name=*). Services, that were not created with iPOJO, don't have that field, so in that way i can filter any iPOJO-service.

    Thanks alot :)