Hi Vincent,
Vincent Massol wrote:
Hi,
There's a pb with the current implementation:
When we get the Observation manager implementation and list the
registered listeners we only get the components that have been
initialized *before* we get the Observation manager component. Thus if
we want to be sure all listeners will receive events we need to ensure
they're loaded first. This is hard to do.
I'm proposing instead to modify the observation module:
* Modify EventListener to be a @ComponentRole
* Add List<Event> EventListener.getEvents() (the events that the
listener handles)
* Inject List<EventListener> in DefaultObservationManager. Thus when
the Observation Manager is looked up, all listener components are
created and injected.
* Keep add/removeListener in ObservationManager so that listeners can
be manually added/removed (for ex if a new listener component is added
dynamically in the system) but with following signatures:
- addListener(EventListener);
- removeListener(EventListener);
WDYT?
Indeed it's seems necessary for the EventListener to became a component
interface in order to make sure it is loaded and ready to be triggered
as soon as ObservationManager is loaded.
So I agree with this modification.
Thanks
-Vincent
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs