Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 59909 invoked from network); 28 Jul 2006 13:49:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Jul 2006 13:49:46 -0000 Received: (qmail 7355 invoked by uid 500); 28 Jul 2006 13:49:44 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 7327 invoked by uid 500); 28 Jul 2006 13:49:44 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 7318 invoked by uid 99); 28 Jul 2006 13:49:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jul 2006 06:49:44 -0700 X-ASF-Spam-Status: No, hits=2.7 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST,INFO_TLD,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of piccinatto@ibest.com.br designates 200.181.68.90 as permitted sender) Received: from [200.181.68.90] (HELO ancalagon.ibest.com.br) (200.181.68.90) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jul 2006 06:49:42 -0700 Received: from ibest.com.br (localhost.localdomain [127.0.0.1]) by ancalagon.ibest.com.br (Postfix) with ESMTP id 5B6B01275FD for ; Fri, 28 Jul 2006 13:49:19 +0000 (GMT) Content-Transfer-Encoding: binary Content-Type: multipart/mixed; boundary="_----------=_11540945592090042" MIME-Version: 1.0 X-Mailer: MIME::Lite 2.117 (F2.6; A1.50; B2.12; Q2.03) X-Mailer: IbestMail X-Organization: Ibest S/A X-Identity: 931768_1154094559 From: "hsp" To: Marcel Reutegger Cc: dev@jackrabbit.apache.org Subject: Re: event listener not getting any events.. Date: Fri, 28 Jul 2006 10:49:19 -0300 Message-Id: <20060728134919.5B6B01275FD@ancalagon.ibest.com.br> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --_----------=_11540945592090042 Content-Disposition: inline Content-Length: 6799 Content-Transfer-Encoding: binary Content-Type: text/plain >hsp wrote: >> But, the node I create is kind of type "esc:base" and it is > > inside the iterator, and its child (autocreated) that is kind > > of type "nt:hierarchyNode" also is inside the iterator, why? > >this has been discussed already extensively on the user list. See: >http://thread.gmane.org/gmane.comp.apache.jackrabbit.user/408 > >> Another doubt, the absPath is relative to the root of the >> workspace, or it means the root of the parent node that > > generates the event? > >it's the absolute path to a node in the workspace. > >> I configured the isDeep as "false" and it didn't fired anymore. > >with an absPath of "/" you will only get events when the root node is >modified. > >> Is the event Listener stable? Because it seens some times not >> firing the listener class. > >Can you please provide a test case that shows this behaviour? Thank you. > >regards > marcel > Hi Marcel. There is attached a class test for the comment I did ">> Is the event Listener stable? Because it seens some times not >> firing the listener class." In this test, the listener is not firing in each node creation. There is a loop that creates nt:folder nodes some times, and in the log the class was not called for all nodes creation. I hope that its could be some easy to fix, thanks. import javax.jcr.observation.EventIterator; import javax.jcr.observation.EventListener; import org.apache.jackrabbit.core.observation.EventImpl; public class ListenerNodeAddEscribaBase implements EventListener { private static ListenerNodeAddEscribaBase instance = null; private ListenerNodeAddEscribaBase() { } public static ListenerNodeAddEscribaBase getInstance(){ if(instance == null){ instance = new ListenerNodeAddEscribaBase(); } return instance; } public void onEvent(EventIterator arg0) { System.out.println("Estou no ListenerNodeAddEscribaBase"); while(arg0.hasNext()){ EventImpl e = (EventImpl)arg0.nextEvent(); try { System.out.println("Path: " + e.getPath()); System.out.println("Tipo: " + e.getType()); System.out.println("UserId: " + e.getUserID()); } catch (Exception e0) { e0.printStackTrace(); } } } } public class TestObserver { private static void criaNode(String nomeNode){ try { Repository rep = RepositorioEscriba.getRepository(); Session session = null; SimpleCredentials creds = null; creds = new SimpleCredentials("thiago", "".toCharArray()); session = rep.login(creds); session.getWorkspace().getObservationManager().addEventListener( ListenerNodeAddEscribaBase.getInstance(), Event.NODE_ADDED, "/", true, null, new String[] {"nt:base"}, false ); Node nodeGrupo = (Node)session.getItem("/"); nodeGrupo.addNode(nomeNode, "nt:folder"); session.save(); session.logout(); logger.info(nomeNode + " gravado com sucesso"); } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args){ try { logger.info("Testando Observer"); /*Primeira tentativa*/ for(int i=0 ; i<20 ; i++){ criaNode("nodeX" + i); } } catch (Exception e) { e.printStackTrace(); } } } and the log..... 10:29:21,686 INFO [STDOUT] 10:29:21,686 INFO [RepositoryStartupServlet] Testando Observer 10:29:21,915 INFO [STDOUT] Estou no ListenerNodeAddEscribaBase 10:29:21,915 INFO [STDOUT] Path: /nodeX0 10:29:21,916 INFO [STDOUT] Tipo: 1 10:29:21,916 INFO [STDOUT] UserId: thiago 10:29:21,917 INFO [STDOUT] 10:29:21,917 INFO [RepositoryStartupServlet] nodeX0 gravado com sucesso 10:29:21,927 INFO [STDOUT] Estou no ListenerNodeAddEscribaBase 10:29:21,928 INFO [STDOUT] Path: /nodeX1 10:29:21,928 INFO [STDOUT] Tipo: 1 10:29:21,928 INFO [STDOUT] UserId: thiago 10:29:21,930 INFO [STDOUT] 10:29:21,930 INFO [RepositoryStartupServlet] nodeX1 gravado com sucesso 10:29:21,969 INFO [STDOUT] Estou no ListenerNodeAddEscribaBase 10:29:21,970 INFO [STDOUT] Path: /nodeX2 10:29:21,970 INFO [STDOUT] Tipo: 1 10:29:21,970 INFO [STDOUT] UserId: thiago 10:29:21,971 INFO [STDOUT] 10:29:21,971 INFO [RepositoryStartupServlet] nodeX2 gravado com sucesso 10:29:22,011 INFO [STDOUT] 10:29:22,011 INFO [RepositoryStartupServlet] nodeX3 gravado com sucesso 10:29:22,036 INFO [STDOUT] Estou no ListenerNodeAddEscribaBase 10:29:22,036 INFO [STDOUT] Path: /nodeX4 10:29:22,036 INFO [STDOUT] Tipo: 1 10:29:22,036 INFO [STDOUT] UserId: thiago 10:29:22,038 INFO [STDOUT] 10:29:22,037 INFO [RepositoryStartupServlet] nodeX4 gravado com sucesso 10:29:22,097 INFO [STDOUT] Estou no ListenerNodeAddEscribaBase 10:29:22,097 INFO [STDOUT] Path: /nodeX5 10:29:22,097 INFO [STDOUT] Tipo: 1 10:29:22,097 INFO [STDOUT] UserId: thiago 10:29:22,098 INFO [STDOUT] 10:29:22,098 INFO [RepositoryStartupServlet] nodeX5 gravado com sucesso 10:29:22,128 INFO [STDOUT] Estou no ListenerNodeAddEscribaBase 10:29:22,128 INFO [STDOUT] Path: /nodeX6 10:29:22,128 INFO [STDOUT] Tipo: 1 10:29:22,128 INFO [STDOUT] UserId: thiago 10:29:22,130 INFO [STDOUT] 10:29:22,129 INFO [RepositoryStartupServlet] nodeX6 gravado com sucesso 10:29:22,170 INFO [STDOUT] 10:29:22,170 INFO [RepositoryStartupServlet] nodeX7 gravado com sucesso 10:29:22,188 INFO [STDOUT] 10:29:22,188 INFO [RepositoryStartupServlet] nodeX8 gravado com sucesso 10:29:22,225 INFO [STDOUT] 10:29:22,225 INFO [RepositoryStartupServlet] nodeX9 gravado com sucesso 10:29:22,271 INFO [STDOUT] 10:29:22,271 INFO [RepositoryStartupServlet] nodeX10 gravado com sucesso 10:29:22,313 INFO [STDOUT] 10:29:22,312 INFO [RepositoryStartupServlet] nodeX11 gravado com sucesso 10:29:22,371 INFO [STDOUT] 10:29:22,371 INFO [RepositoryStartupServlet] nodeX12 gravado com sucesso 10:29:22,413 INFO [STDOUT] Estou no ListenerNodeAddEscribaBase 10:29:22,413 INFO [STDOUT] Path: /nodeX13 10:29:22,413 INFO [STDOUT] Tipo: 1 10:29:22,413 INFO [STDOUT] UserId: thiago 10:29:22,415 INFO [STDOUT] 10:29:22,415 INFO [RepositoryStartupServlet] nodeX13 gravado com sucesso 10:29:22,447 INFO [STDOUT] 10:29:22,447 INFO [RepositoryStartupServlet] nodeX14 gravado com sucesso 10:29:22,491 INFO [STDOUT] 10:29:22,491 INFO [RepositoryStartupServlet] nodeX15 gravado com sucesso 10:29:22,525 INFO [STDOUT] 10:29:22,524 INFO [RepositoryStartupServlet] nodeX16 gravado com sucesso 10:29:22,563 INFO [STDOUT] 10:29:22,563 INFO [RepositoryStartupServlet] nodeX17 gravado com sucesso 10:29:22,605 INFO [STDOUT] 10:29:22,605 INFO [RepositoryStartupServlet] nodeX18 gravado com sucesso 10:29:22,643 INFO [STDOUT] 10:29:22,642 INFO [RepositoryStartupServlet] nodeX19 gravado com sucesso Hsp. --_----------=_11540945592090042--