@PostConstruct
    public void buildListener() throws RepositoryException {
        LOGGER.debug("Constructing an observer for JCR events...");
        session = getJcrSession(repository.login());
        session.getWorkspace().getObservationManager()
                .addEventListener(this, EVENT_TYPES, "/", true, null, null, false);
        session.save();
    }
@ PostConstruct public void buildListener ( ) throws RepositoryException { LOGGER . debug ( "Constructing an observer for JCR events..." ) ; session = getJcrSession ( repository . login ( ) ) ; session . getWorkspace ( ) . getObservationManager ( ) . addEventListener ( this , EVENT_TYPES , "/" , true , null , null , false ) ; session . save ( ) ; }
Register this observer with the JCR event listeners

@throws RepositoryException if repository exception occurred