Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
I just recopied the CommentEventListener which listens to changed comments, and that worked. So I suspected by use of AttachmentDeletedEvent and AttachmentUpdatedEvent was wrong and I added DocumentUpdatedEvent as one of the types I was interested in. I am nicely receiving them. You did not listen to AttachmentAddedEvent ? AttachmentUpdatedEvent only refers to already existing attachment updated with a new version. However, how can I know if the difference is in an attachment? RCS? Thanks Thomas, now I did listen to the AttachmentAddedEvent and it is indeed fired. However… I do not see a way, from this event, to actually know which attachment was changed. Is this not recorded? In my only experience about notifications, I had to diff quite many things and it does not seem like it's a good or necessary idea. thanks in advance. Paul ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
On Tue, Jun 17, 2014 at 10:25 AM, Paul Libbrecht p...@hoplahup.net wrote: I just recopied the CommentEventListener which listens to changed comments, and that worked. So I suspected by use of AttachmentDeletedEvent and AttachmentUpdatedEvent was wrong and I added DocumentUpdatedEvent as one of the types I was interested in. I am nicely receiving them. You did not listen to AttachmentAddedEvent ? AttachmentUpdatedEvent only refers to already existing attachment updated with a new version. However, how can I know if the difference is in an attachment? RCS? Thanks Thomas, now I did listen to the AttachmentAddedEvent and it is indeed fired. However… I do not see a way, from this event, to actually know which attachment was changed. Is this not recorded? Should be AttachmentAddedEvent#getName() (actually AbstractDocumentEvent#getName()) In my only experience about notifications, I had to diff quite many things and it does not seem like it's a good or necessary idea. thanks in advance. Paul ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
On Tue, Jun 17, 2014 at 11:05 AM, Thomas Mortagne thomas.morta...@xwiki.com wrote: On Tue, Jun 17, 2014 at 10:25 AM, Paul Libbrecht p...@hoplahup.net wrote: I just recopied the CommentEventListener which listens to changed comments, and that worked. So I suspected by use of AttachmentDeletedEvent and AttachmentUpdatedEvent was wrong and I added DocumentUpdatedEvent as one of the types I was interested in. I am nicely receiving them. You did not listen to AttachmentAddedEvent ? AttachmentUpdatedEvent only refers to already existing attachment updated with a new version. However, how can I know if the difference is in an attachment? RCS? Thanks Thomas, now I did listen to the AttachmentAddedEvent and it is indeed fired. However… I do not see a way, from this event, to actually know which attachment was changed. Is this not recorded? Should be AttachmentAddedEvent#getName() (actually AbstractDocumentEvent#getName()) The first parameter passed with the event (source) is the new XWikiDocument instance. In my only experience about notifications, I had to diff quite many things and it does not seem like it's a good or necessary idea. thanks in advance. Paul ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
On 06/13/2014 01:18 AM, Paul Libbrecht wrote: Hello Vincent and all, I've been successfully making my first (java-based) component (I can call it from other places) using hints from there and the components' tutorial. However, I have failed to get that component to listen to events. While another, groovy-based, listener is notified, my onEvent is not called. getEvents is returning objects that I would desire public ListEvent getEvents() { return Arrays.EventasList( new AttachmentUpdatedEvent(), new AttachmentDeletedEvent()); } (I would prefer an abstract type used here, but I need concrete objects) What else can wrong in my listener? Shouldn't there be listener registration at components? (e.g. in the initialize method) yes, for registration you need to add the class to the META-INF/components.txt like explained somewhere: http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HComponentRegistration (and in the Notifications Tutorial, too, I now see after careful reading ...) some things to try if it still does not work: - check if there are no error messages in the log file on startup - maybe try extend AbstractEventListener instead of implement EventListener (that should *not* fix any problems, but maybe it gives an explicit error message instead of failing) clemens ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
Hello XWiki experts, What else can wrong in my listener? Shouldn't there be listener registration at components? (e.g. in the initialize method) yes, for registration you need to add the class to the META-INF/components.txt Sure, that's done, couldn't get Utils.getComponent to work otherwise. like explained somewhere: http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HComponentRegistration (and in the Notifications Tutorial, too, I now see after careful reading ...) some things to try if it still does not work: - check if there are no error messages in the log file on startup - maybe try extend AbstractEventListener instead of implement EventListener (that should *not* fix any problems, but maybe it gives an explicit error message instead of failing) I just recopied the CommentEventListener which listens to changed comments, and that worked. So I suspected by use of AttachmentDeletedEvent and AttachmentUpdatedEvent was wrong and I added DocumentUpdatedEvent as one of the types I was interested in. I am nicely receiving them. However, how can I know if the difference is in an attachment? RCS? thanks in advance. Paul ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
On Sat, Jun 14, 2014 at 12:01 AM, Paul Libbrecht p...@hoplahup.net wrote: Hello XWiki experts, What else can wrong in my listener? Shouldn't there be listener registration at components? (e.g. in the initialize method) yes, for registration you need to add the class to the META-INF/components.txt Sure, that's done, couldn't get Utils.getComponent to work otherwise. like explained somewhere: http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HComponentRegistration (and in the Notifications Tutorial, too, I now see after careful reading ...) some things to try if it still does not work: - check if there are no error messages in the log file on startup - maybe try extend AbstractEventListener instead of implement EventListener (that should *not* fix any problems, but maybe it gives an explicit error message instead of failing) I just recopied the CommentEventListener which listens to changed comments, and that worked. So I suspected by use of AttachmentDeletedEvent and AttachmentUpdatedEvent was wrong and I added DocumentUpdatedEvent as one of the types I was interested in. I am nicely receiving them. You did not listen to AttachmentAddedEvent ? AttachmentUpdatedEvent only refers to already existing attachment updated with a new version. However, how can I know if the difference is in an attachment? RCS? thanks in advance. Paul ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users -- Thomas Mortagne ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
Hello Vincent and all, I've been successfully making my first (java-based) component (I can call it from other places) using hints from there and the components' tutorial. However, I have failed to get that component to listen to events. While another, groovy-based, listener is notified, my onEvent is not called. getEvents is returning objects that I would desire public ListEvent getEvents() { return Arrays.EventasList( new AttachmentUpdatedEvent(), new AttachmentDeletedEvent()); } (I would prefer an abstract type used here, but I need concrete objects) What else can wrong in my listener? Shouldn't there be listener registration at components? (e.g. in the initialize method) thanks paul On 29 mai 2014, at 18:39, vinc...@massol.net wrote: Dear XWiki users, Since I’ve seen several questions recently on the list related to XWiki events, I’ve spent several hours rewriting the XWiki Notifications Tutorial here: http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial You’ll learn for example: - Adding content to pages on save - Log when a document is modified - Send a mail whenever a comment is added ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
On 30 May 2014 at 07:39:44, Marius Dumitru Florea (mariusdumitru.flo...@xwiki.com(mailto:mariusdumitru.flo...@xwiki.com)) wrote: Event listeners should not keep a reference to the XWiki context from when they were created. XWiki context is created per request while the event listener is used on multiple requests. I updated the LoggingEventListener. Thanks but I think it’s better to get it from the passed “data” parameters which represents the XWikiContext. Also http://platform.xwiki.org/xwiki/bin/download/DevGuide/WritingEventListenerTutorial/groovynotifier.txt needs to be updated too. Thanks -Vincent Thanks, Marius On Thu, May 29, 2014 at 7:39 PM, vinc...@massol.net wrote: Dear XWiki users, Since I’ve seen several questions recently on the list related to XWiki events, I’ve spent several hours rewriting the XWiki Notifications Tutorial here: http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial You’ll learn for example: - Adding content to pages on save - Log when a document is modified - Send a mail whenever a comment is added Enjoy! Thanks -Vincent ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
On Fri, May 30, 2014 at 9:32 AM, vinc...@massol.net vinc...@massol.net wrote: On 30 May 2014 at 07:39:44, Marius Dumitru Florea (mariusdumitru.flo...@xwiki.com(mailto:mariusdumitru.flo...@xwiki.com)) wrote: Event listeners should not keep a reference to the XWiki context from when they were created. XWiki context is created per request while the event listener is used on multiple requests. I updated the LoggingEventListener. Thanks but I think it’s better to get it from the passed “data” parameters which represents the XWikiContext. I didn't say otherwise :) , even if you get it from the passed data or from the execution context you should still not keep a reference to the XWiki context between events. Also http://platform.xwiki.org/xwiki/bin/download/DevGuide/WritingEventListenerTutorial/groovynotifier.txt needs to be updated too. Thanks -Vincent Thanks, Marius On Thu, May 29, 2014 at 7:39 PM, vinc...@massol.net wrote: Dear XWiki users, Since I’ve seen several questions recently on the list related to XWiki events, I’ve spent several hours rewriting the XWiki Notifications Tutorial here: http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial You’ll learn for example: - Adding content to pages on save - Log when a document is modified - Send a mail whenever a comment is added Enjoy! Thanks -Vincent ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
[xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
Dear XWiki users, Since I’ve seen several questions recently on the list related to XWiki events, I’ve spent several hours rewriting the XWiki Notifications Tutorial here: http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial You’ll learn for example: - Adding content to pages on save - Log when a document is modified - Send a mail whenever a comment is added Enjoy! Thanks -Vincent ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] New Notifications Tutorial (a.k.a Event Listener)
Event listeners should not keep a reference to the XWiki context from when they were created. XWiki context is created per request while the event listener is used on multiple requests. I updated the LoggingEventListener. Thanks, Marius On Thu, May 29, 2014 at 7:39 PM, vinc...@massol.net vinc...@massol.net wrote: Dear XWiki users, Since I’ve seen several questions recently on the list related to XWiki events, I’ve spent several hours rewriting the XWiki Notifications Tutorial here: http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingEventListenerTutorial You’ll learn for example: - Adding content to pages on save - Log when a document is modified - Send a mail whenever a comment is added Enjoy! Thanks -Vincent ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users