Thanks. I learnt few things about how to make a proper patch too (should have done before), my patches are bit too crappy.

I was thinking, can we use this mechanism for purposes like notifying (send an email or something like that) to the original author of the document when the document is changed ? Or is some other mechanism there for this purpose ?

Best Regards,

- Asiri

On 7/21/07, Vincent Massol <vincent@massol.net> wrote:
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



--
You receive this message as a subscriber of the xwiki-dev@objectweb.org mailing list.
To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org
For general help: mailto: sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws