Note that what I proposed doesn't work since it's not possible to
register a component with 2 roles (for the same component instance) in
plexus AFAIK. Thus you'd need 2 components: one for the listener and
another one for the main business logic. Then the pb arises of how to
pass information from one to another...
Still looking for a simple solution to that (I have one but it's too
complex). If you have any idea, shoot.
-Vincent
On May 26, 2009, at 10:19 PM, 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?
Thanks
-Vincent