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 List<Event> getEvents() {
return Arrays.<Event>asList(
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#HComp…
(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