Closed ops4j-issues closed 9 years ago
Achim Nierbeck commented
doesn't look like the DS supports Bundle Tracker ....
Christoph Läubrich commented
You can make use of DS the following way:
That way you don't need an activator and it can be activated/deactivated like every other DS component as well as havin Refernces to other services.
Achim Nierbeck commented
well, how is a component without interface and activate/deactivate differently then an activator class?
I don't see much benefit of switching to that, cause it just behaves like an activator.
If it walks like a duck, quacks like a duck, it might just be a duck :wink:
Christoph Läubrich commented
Just consider the following:
From looking at the code it seems that you can drop the Activator at all and transform WebObserver into a DS Component, you might want to use AbstractExtender still as an inner class for doing the tracking job.
Beside this even though you hava a pice of code that wants to interact with the OSGi-Framework you have the following benefits using DS:
Achim Nierbeck commented
you're mostly right, still I don't see the point of removing a perfectly working Activator to another thing that is doing the same. At this point it doesn't make any sense as it doesn't give a benefit at all.
Might also be interested in the views of a DS-Evangelist ... (http://njbartlett.name/2010/08/05/when-servicetrackers-trump-ds.html)
Christoph Läubrich commented
I just wanted to show a kind of alternative to "dosen't work / is not supported" :wink:
IMO its perfectly fine to keep this open and migrate step-by step (e.g. next time when refactoring takes place).
About your link, there is no "direct-declarative-only" way but still one without ServiceTracker.
For case A you can do for example:
@Activate
method that takes BundleContext as only parameter, register all "shaddow-services" like done in the example, rember the ServiceReference in the Map@Deactivate
unregister all ShaddowServicesFor Case B it is not completely clear what should be archived, e.g. I can't belive that C does not care at all WHAT combination of services A+B it want to bind to, but since DS is like OSGi API single-threaded from the point of a component at least threading should not be an issue there.
If you can provide an example of the problem I'll try to outline it a little bit more, that often shows it better than some very abstract and vague A/B/C-FooBars :grinning:
Achim Nierbeck commented
Not worth the hazzle
Achim Nierbeck created PAXWEB-786
Votes: 0, Watches: 2