Thanks Alex for the response.
Ariel
On May 26, 2009, at 8:19 PM, Alexander Klimetschek wrote:
On Tue, May 26, 2009 at 2:03 AM, ASTI Araza, Ariel D.
<[email protected]> wrote:
I've been searching the Jackrabbit documentation and I couldn't
find anything that answers my question. I am using the jackrabbit
webapp and I don't want to subclass, or modify existing jackrabbit
classes just to insert code that register my own event listener to
observe repository changes like addition, modifications, removal,
etc. In the WEB-INF/config.xml I saw <iomanager> and
<propertymanager> registration but there's unfortunately not
anything that looks like event listeners registration.
No, there is no declarative way to do so, because it is part of the
JCR API (iomanager and co. are Jackrabbit-specific extensions that
have to be run at startup) and most importantly, it requires a
session, which in turn requires you to log in with a certain user.
How you do this depends on your application framework, because in most
cases you want that eventlistener to be started in a long-running
component (the session needs to stay open as long as you want to
receive events). Then you "only" have to call
session.getWorkspace().getObservationManager().registerEventListener
[1].
[1] http://day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/observation/ObservationManager.html#addEventListener(javax.jcr.observation.EventListener,%20int,%20java.lang.String,%20boolean,%20java.lang.String
[],%20java.lang.String[],%20boolean)
Regards,
Alex
--
Alexander Klimetschek
[email protected]