Hi
I have created two listeners with eventType ‘NODE_ADDED’ for   “dms” & 
“website” section of Author Instance respectively following the observation 
module example of magnolia documentation.
First listener’s job is to execute a command to activate the content to Public 
instance when we upload a new file under “downloads” of “demo-projects” folder. 
The second listener’s job is to output a message to console when a new page is 
added under “demo-projects” of website 
section.[img]C:\Users\m1009523\Desktop\listener.png[/img][u][b]
1st listener[/b][/u]

activateDownloads
listener
command
 class-…. ActivationCommand
 repository –dms
class- RestrictToNodeTypeEventListener
active-true
description –activates download files
eventType -NODE_ADDED
path - /demo-project/downloads
repository-dms

[u][b]2nd listener[/b][/u]

pageAddedAlerts
listener
class - …. PageListener
 repository  – website
class - RestrictToNodeTypeEventListener
active-true
description – activates page added
eventType  - NODE_ADDED
path - /demo-project
repository - website

[u][b]PageListener class[/b][/u]
package info.magnolia.module.observation.sample;
 
  
 import info.magnolia.cms.core.Content;
import info.magnolia.context.LifeTimeJCRSessionUtil;

import javax.jcr.observation.Event;
import javax.jcr.observation.EventIterator;
import javax.jcr.observation.EventListener;
 
  
  
 /**
 
  * basic example that prints a message to the console
 
  * @author tmiyar
 
  *
 
  */
 
 public class PageListener implements EventListener {
 
  
     public void onEvent(EventIterator events) {
 
         System.out.println("EventListener Test: Text Message");
 
        Event event;
 
        while(events.hasNext()){
 
  
                 event = (Event) events.nextEvent();
 
         // depends of the type of event
 
         Content node;
 
         try {
 
  
                
           // node = new 
SystemRepositoryStrategy((SystemContext)MgnlContext.getSystemContext()).getHierarchyManager("website",
 "website").getContent(event.getPath());
 
             node = 
LifeTimeJCRSessionUtil.getHierarchyManager("website").getContent(event.getPath());
 
  
         } catch (Exception e) {
 
             // TODO Auto-generated catch block
 
             e.printStackTrace();
 
         }
 
         }
 
         System.out.println("EventListener Test: Text Message2");
 
  
     }
 
 }
 
I have kept the .class file of PageListener class under
[b]
C:\Program 
Files\MagnoliaEnterpriseEdition\apache-tomcat-6.0.32\webapps\magnoliaAuthor\WEB-INF\classes[/b]
 
I tested & found both of these listeners are not working. In the console I 
found no message output. If anyone is having any clue to proceed will be of 
great help for me. Need to get a clear picture how it works.
I am getting the following error in console when trying to activate the 
observation module in author instance.Is it required necessarily ??

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=526cdc1e-a2a3-41b9-91a1-dbfabec05d40


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to