Sergiu Dumitriu wrote:
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
+1
* Add List<Event> EventListener.getEvents()
(the events that the
listener handles)
Hm, I'm not sure about this. A document watcher will dynamically add and
remove events to the list of monitored resources. We could have this
method to be called for the initial registration, as otherwise it's hard
to do the initialization.
+0
Also, this requires that the ComponentManager is Initializable,
otherwise it won't actually register anything.
* Inject
List<EventListener> in DefaultObservationManager. Thus when
the Observation Manager is looked up, all listener components are
created and injected.
+1
* 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);
-1. See above, a component with a dynamic list of events will need to
register/unregister just one in a long list. So we do need the existing
signatures. Maybe add these signatures, but also keep the existing ones.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/