You can find an example in one of my blog posts. http://blog.vogella.com/2016/09/26/configuring-osgi-declarative-services/
At the bottom the usage of the minimum cardinality reference property is shown. Am 02.03.2017 1:07 PM schrieb "Carsten Ziegeler" <cziege...@apache.org>: > You can do this with DS, have a look at section 112.6.2.2 Minimum > Cardinality Property > > Regards > Carsten > > Thomas Driessen wrote > > Hi, > > > > I currently have the following usecase: > > > > Service A depends on Service B > > Service B depends on 4x Service C > > Service A may only become active when Service B has exactly 4x Service > > C, thus becoming active itself. > > > > I'm using declarative services which only support 0-*, 1-*, 0-1 and > > exactly 1 dependencies between services. > > > > One idea I came up with, was to count the C services in B's setC(C c) > > method and, on reaching the count of 4, setting a specific property on B > > (e.g. weirdUsecaseIsActive = true) and let A's reference to B filter > > with a corresponding target filter. > > > > I know this sound like a dirty hack, but I did not found any better > > solutions. > > > > Therefore, my questions are: > > 1) Is there a better solution for my usecase? > > 2) If not: How do I update properties of a service at runtime? > > > > Kind regards, > > Thomas > > > > > > _______________________________________________ > > OSGi Developer Mail List > > osgi-dev@mail.osgi.org > > https://mail.osgi.org/mailman/listinfo/osgi-dev > > > > > > > -- > Carsten Ziegeler > Adobe Research Switzerland > cziege...@apache.org > _______________________________________________ > 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