Hi Ray,

Using the bundle id feels more like a workaround for a missing feature of the 
extender. 

Wouldn't it make more sense for the metadata processed by the extender publish 
a property to filter on, and/or to have the service published by the extender 
respond to config admin in the same way that DS components do?

If, for example, the extendee asked for the property 
"mySuperCoolProperty=awesome" to be applied to the extender registered service 
then that could be used in the filter. Ideally the target filter would be set 
using config admin to maximise the reusability of the bundle (for example in an 
environment without the extender where another service should be used).

One of the best things about the service registry is decoupling the provider 
from the consumer. I'd try very hard to avoid breaking that.

Regards,

Tim



Sent from my iPhone

> On 8 Mar 2015, at 14:49, Raymond Auge <raymond.a...@liferay.com> wrote:
> 
> Hey all,
> 
> I have a need for a component to get a service created on behalf of the 
> bundle by an extender. There are many such services in the system so what I 
> really need is to get a bundle with a filter like so:
> 
>         Filter filter = bundleContext.createFilter(
>             "(&(objectClass=" + ExtenderCreatedService.class.getName() +
>                 ")(service.bundleid=" + bundle.getBundleId() + "))");
> 
> i.e. get the one created which has my bundleId.
> 
> Is there any trick to doing this besides a ServiceTracker which the component 
> must manually create and start?
> 
> Note the component can't know it's own bundleId at the time of generating the 
> XML.
> 
> Is there any property parsing happening in the component XML files or 
> anything?
> 
> -- 
> Raymond Augé (@rotty3000)
> Senior Software Architect Liferay, Inc. (@Liferay)
> Board Member & EEG Co-Chair, OSGi Alliance (@OSGiAlliance)
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to