I think I'm on the right track using OSGi services + DS together, however, I really feel like abusing it. Either that, or it's just pure awesome. (Both is still possible).
So let's imagine the following application: it's a house database. I have two interfaces, House and Window. Let's say I have at least one implementation for each available, configured as a ...well, as a component which requires a configuration to instantiate, and in order to create new instances I just supply this configuration to the right pid. (It's not a factory component, nor a service factory either - what's the official name? Here's an excellent post about it by Neil).
So far so good, this works like a charm.
Houses are just that, houses. Have their own address, each one is different, easy to identify by their street property. However, windows instances are sharable between houses; their configuration is basically width and height.
Now, these component can also bind to each other in a 0..n cardinality configuration (even if you wouldn't want to live in a house with no windows). So each house has a list of windows, and for each window type, we know which house has it (a Many-to-Many relationship).
My problem is, let's say two houses share the same three windows. How can I describe this? I feel like property based filtering is not expressive enough. I also feel like maybe this is not the right way to get the framework to instantiate my objects, but it's just so handy.
Thoughts? Am I abusing, or using it as intended?
(I could also use DS to just get the half of the job done: bind either a list of Houses to a Window instance references by it, or vica versa, and then the component instance could call a registerWhatever() function on the target instances - but then I still need to describe at least this half somehow.)