Ray,
> What we have is a typical event handler scenario:
>
> processEvent(Event event) {
> Handler[] handlers = getHandlers(key);
>
> for (Handler handler : handlers) {
> handler.process(event);
> }
> }
>
> I'd like to be able to use osgi to affect the handlers result set during
runtime.
This is a classic use case for the "whiteboard" pattern; the handler
registers itself as a provider of the Handler service and the event source
uses the framework to track changes in the Handler population. This is
very easy using Declarative Services, but it can also be done with a good
ol' ServiceTracker. That does mean that your handlers have to register
with the framework, but this can be as easy as "serviceRegistration =
bundleContext.registerService(Handler.class.getName(), this, new
Hashtable())" on the way in and "serviceRegistration.unregister()" on the
way out.
HTH
Chris
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev