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