Hello Philipp, I think that currently, it is not possible to specify a third party callback object to be notified when the adaptee services properties are changed, and only your adapter will be notified.
One possible alternative could consist in letting the adapter impl provide an adapted interface and you could then track the adapted interface itself, because when the adaptee (Device) service properties are changed, the Device changed properties are then also propagated to the service properties provided by the adapter (if the adapter provides an adapted service). For example, when you create your adapter, you can manage to let it provide a service (like 'DeviceAdapter' service): mgr.add(createAdapterService(Device.class,null) .setImplementation(DeviceAdapter.class) .setInterface(DeviceAdapter.class, null) .setCallbacks("init", "start", "stop", "destroy")); Then you could manage to define your "DeviceManager" as a DM component, and that component could listen to all DeviceAdapter services, including propagated service properties change events: mgr.add(createComponent() .setImplementation(DeviceManager.class) .add(createServiceDependency(DeviceAdapter.class).setRequired(true) .setCallbacks("added", "changed", "removed))); then your DeviceManager could be called back it its changed method when a DeviceAdapter propagates its adapted Device service properties change events. This should work, but I don't know if this would be compatible with your current application design ? (maybe you could describe a but what is doing your DeviceManager ?) Now unfortunately, regarding your last question, I think that the work around won't work, because when the adaptee services comes up, the first dependency (the one that your work around has modified) is removed and replaced by another dependency (see the AdapterServiceImpl. AdapterImpl.createService() method()). Now, if you really need to be able to specify a callback instance to be called when the adaptee service properties are changed (Device), then can you please create a Jira issue for it, and I will add a createAdapterService signature allowing to specify a callbackObject, similar to what is currently done int the createResourceAdapterService methods. (Marcel, would you be OK for this new feature ?) kind regards; /Pierre On Wed, Oct 15, 2014 at 2:52 PM, Bulu <b...@romandie.com> wrote: > Addition to my own question: > I came up with the following, but the callbacks seem not to get called on > the deviceManager... > > Component adapter = createAdapterService(Device.class,null) > .setImplementation(DeviceAdapter.class) > .setCallbacks(deviceManager, INIT_METHOD, START_METHOD, STOP_METHOD, > DESTROY_METHOD); > > // Ugly: supposing the adapter has always the adaptee as first service > dependency > ServiceDependency dep = (ServiceDependency) adapter.getDependencies().get( > 0); > logger.debug("Dependency is {}", dep); // OK, in my tests it's the right > dependency > dep.setCallbacks(deviceManager, BIND_METHOD, CHANGED_METHOD, > UNBIND_METHOD); > mgr.add(adapter); > > Is this the right way? > > Regards Philipp > > > On 15.10.2014 14:12, Bulu wrote: > >> Hello All >> >> Using Dependency Manager, I declare adapters like this: >> mgr.add(createAdapterService(Device.class,null) >> .setImplementation(DeviceAdapter.class) >> .setCallbacks(deviceManager, "init", "start", "stop", "destroy")); >> >> So deviceManager gets notified when the adapters appear. Now I also want >> deviceManager to be notified when the properties of any of the adaptees >> (Device.class) change (need to update the UI). >> >> For normal ServiceDependency I can specify callbacks to be called on a >> third party object with >> ServiceDependency.setCallbacks(Object instance, String added, String >> changed, String removed); >> >> For adapters and I can specify the callbacks, but only calling the >> adapter itself: >> createAdapterService(Device.class.name, null, "add", "change", >> "remove") >> >> How can I tell the adapter to use callbacks on a third party object >> (deviceManager) when the adaptee's properties change? >> >> Thanks & regards >> Philipp >> >> >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org > For additional commands, e-mail: users-h...@felix.apache.org > >