SeamFramework.orgCommunity Documentation

Chapter 65. Seam JCR - Event Mapping

65.1.
65.2.

Seam JCR provides functionality to fire CDI Events based on events found in JCR. The rules of how events are fired are based around the underlying implementation.

Tip

You will not have an active JCR Session during the event firing, a new one will need to be created.

Tip

Some JCR implementations, like Modeshape fires events on a separate thread, so probably you will get errors if your observer method is declared on a @RequestScoped object, for example.

To observe an event, use the @Observes and the additional qualifiers on seam-jcr-api module (Check package org.jboss.seam.jcr.annotations.events). If you need to watch any JCR event, then avoid using any Qualifier at all.

    import javax.jcr.observation.Event;
       
    public void observeAdded(@Observes @NodeAdded Event evt) {
    	// Called when a node is added
    }
    public void observeAll(@Observes javax.jcr.observation.Event evt) {
    	// Called when any node event occurs 
    }