Pretty much, I only take issue with the idea that annotated DS components are not POJOs. The annotations are build-time only so they do not create any runtime dependency. The components can be used anywhere outside of DS and OSGi, including in unit tests. So in what sense are they not POJO?
Regarding integration testing, this will be broadly the same with both approaches. I personally prefer DS. One advantage that you didn’t mention is improved laziness since it is purely declarative, whereas DM requires an activator class to be loaded. However I don’t have any real problem with DM… it’s at least a lot better than Blueprint ;-) Neil On 17 July 2014 at 11:19:32, Bulu (b...@romandie.com) wrote: Thanks for the answers so far. Basically I now have to choose one of two methods (declarative services vs dependency manager). Possible arguments besides ease-of-use are performance, maintenance of the library and backporting to existing code. My current understanding is that "Felix Dependency Manager" - requires the injected fields in target classes to be volatile (and not final - I like immutable data - can't we pass references on construction?) - uses reflection extensively (performance?) - the wiring has to be made in the Activator, where the DependencyManager reference is available (or pass it around) - the doc has not been updated since 2010. Does this indicate, that the project is sleeping? Declarative services: - is part of the OSGi standard (which makes it more future proof I guess) - requires you to hack XML (beuh) or use annotations (bndtools), so classes are not so pure POJOs - wiring can be made from anywhere Are theses points correct? What do you recommend? Is setting up integration testing with either lib easier? Regards Philipp On 17.07.2014 10:19, Paul Bakker wrote: > Definetly use either Felix Dependency Manager (that's what I use on all > projects) or Declarative Services. DS is slightly simpler, DM is more > powerful. The main difference is that DM can also be used from code to > register/deregister components at any given time. > Both solutions will solve the problem you are describing, which is a very > common one :-) > > Cheers, > > Paul > > > On Thu, Jul 17, 2014 at 10:04 AM, Bulu <b...@romandie.com> wrote: > >> Hi all >> >> I'm building an application on an embedded system which will contain ~20 >> bundles. >> >> There are many dependencies of services - say for example to provide its >> service, module A (several classes) needs services B,C,D. >> In order to fully account for the dynamics of OSGi, I have to monitor >> B,C,D to stop A when any of these 3 goes away. This unregisters service A, >> which in turn will disrupt all clients of A. >> If additionally you want to handle part case (A should still provide a >> reduced service, if only B and C are available but not D) it gets messy >> rapidly. >> >> In the end, I realize that I am mostly writing life cycle code instead of >> business logic and I have lots of OSGi dependencies, with the BundleContect >> passed around nearly everywhere. This smells like bad design. >> >> Could you share insights or recommend reading on how to structure OSGi >> services for cohesion and modularity, to avoid the problems above? >> Are there ways to reduce the boiler plate? >> Should I be investigating declarative services, iPojo or others (in >> general I prefer writing code than XML...). As this is an embedded system, >> should I be worried about the performance impact of DS? >> >> >> Thanks for your insights >> Philipp >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org >> For additional commands, e-mail: users-h...@felix.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org