I've developed a service that you can use to block the activation of a DS 
component until a set of other services are ready. This is related to the 
whiteboard pattern when the sender wants to be sure a certain set of whiteboard 
services are present. Normally you can only assert the properties of 1 service 
but this allows you to use a filter to select the aggregated properties of a 
group of services. An example is when you need a set of at least 3 remote 
services where there are at least 2 unique regions. 

For example, you want to block until the average of the `foo` properties on the 
registered Foo services is higher than 2:

        @Reference( target="([avg]foo>=2)" )
        ConditionalTarget<Foo>          foos;

The Conditional Target object provides a direct reference to the services and 
service references being tracked as well as the aggregated properties. 

It is described in 

        
https://github.com/aQute-os/biz.aQute.osgi.util/tree/master/biz.aQute.osgi.conditionaltarget
 
<https://github.com/aQute-os/biz.aQute.osgi.util/tree/master/biz.aQute.osgi.conditionaltarget>

And you can find the binary artifact in:

        
https://oss.sonatype.org/content/repositories/snapshots/biz/aQute/biz.aQute.osgi.conditionaltarget/
 
<https://oss.sonatype.org/content/repositories/snapshots/biz/aQute/biz.aQute.osgi.conditionaltarget/>

Feedback appreciated on the idea and execution. If people like this, I can 
submit it to Apache Felix if they're interested.

Kind regards,

        Peter Kriens
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to