Quite often I am coming across the same problem again and again and I
was wondering what's the best way to deal with it.

The problem is that I have multiple components (say A and B) that are
providing similar piece of functionality. At any given time I want
only one of the two components to be "active". Something like:

if only A is satisfied -> activate A.
if only B is satisfied -> activate B.
if A and B are satisfied -> activate B
if A is activated and later on B gets satisfied -> deactivate A and activate B.

If those components are providing a Service I can use service ranking
to deal with it. But some times this is not enough and I also need to
deactivate the component too. In this case I can do it using the
enable()/disable() methods on the component.

I am wondering if there are better ways to implement something like
"mutually" exclusive components.

Would it make sense to introduce the concept of "component ranking"
that would allow having multiple components with the same name but
only activate the one with the highest ranking?

Thanks.

-- 
Ioannis Canellos
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to