[Proposal] New notification implementation

Vincent Massol vincent at massol.net
Fri Jul 20 20:40:42 CEST 2007


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/devs/attachments/20070720/762cdcb2/attachment.html 


More information about the devs mailing list