Hello All,
I am writing two eventListener methods in activate method with two different paths.
The event is not getting fired when I have both methods, but will work fine only if one method is used.
Thanks,
Vish
Solved! Go to Solution.
HI
"The filters of an already-registered EventListener can be changed at runtime by re-registering the same EventListener object (i.e. the same actual Java object) with a new set of filter arguments. The implementation must ensure that no events are lost during the changeover."
So in above mentioned code, we can see that we have 2 event listener. Try this (create 2 listeners), if it would work for you.
Thanks and Regards
Kautuk Sahni
I tried to search online, but i have not found any case where we have multiple EventListner in a function (activate).
Workaround could be,
Option 1: Create 2 OSGI bundles for both listner.
Option 2 (Not tried): Create 2 ObservationManager object and add listener to respective ObservationManager object.
Rest i will let community to take on this answer.
I hope this would help you a bit.
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
Hi
I have found a reference link, i hope this would help you.
Example 4
From project jackrabbit, under directory /jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/acl/, in source file EntryCollector.java
/** * @param systemSession * @param rootID * @throws RepositoryException */protected EntryCollector(SessionImpl systemSession,NodeId rootID) throws RepositoryException {this.systemSession=systemSession;this.rootID=rootID;ObservationManager observationMgr=systemSession.getWorkspace().getObservationManager();int events=Event.PROPERTY_CHANGED | Event.NODE_ADDED | Event.NODE_REMOVED;String[] ntNames=new String[]{systemSession.getJCRName(NT_REP_ACCESS_CONTROLLABLE),systemSession.getJCRName(NT_REP_ACL),systemSession.getJCRName(NT_REP_ACE)};String rootPath=systemSession.getRootNode().getPath();observationMgr.addEventListener(this,events,rootPath,true,null,ntNames,true);moveListener=new MoveListener();observationMgr.addEventListener(moveListener,Event.NODE_MOVED,rootPath,true,null,null,true);}
Link:- http://www.programcreek.com/java-api-examples/index.php?api=javax.jcr.observation.ObservationManager (Example 4)
Thanks and Regards
Kautuk Sahni
Views
Replies
Total Likes
HI
"The filters of an already-registered EventListener can be changed at runtime by re-registering the same EventListener object (i.e. the same actual Java object) with a new set of filter arguments. The implementation must ensure that no events are lost during the changeover."
So in above mentioned code, we can see that we have 2 event listener. Try this (create 2 listeners), if it would work for you.
Thanks and Regards
Kautuk Sahni