For those interested I've sent a patch for implementing a new
notification mechanism.
It's available here:
http://jira.xwiki.org/jira/browse/XWIKI-1522
I'd love to get feedback on this. Here's what I say in there:
"
At the place where you want to register for an event:
getObservationManager().addListener(new DocumentSaveEvent
("DocumentToWatch"), listener);
At the place where you want to receive for an event:
public class MyListener implements EventListener
{
public void onEvent(Event event, Object source, Object data)
{
...
}
}
At the place where you want to fire notifications to event listeners:
getObservationManager().notify(new DocumentSaveEvent("SomeDocument"),
"some source", "some data");
It's easily extensible and you can create all sorts of events as it's
fully generic.
"
Have a look at the implementation. You'll see I have even introduced
the notion of EventFilter so that we can have regex when registering
interest for an event.
Thanks
-Vincent