Search in sources :

Example 1 with JcrListenerBaseConfig

use of org.apache.sling.jcr.resource.internal.JcrListenerBaseConfig in project sling by apache.

the class JcrResourceProvider method registerListeners.

/**
     * Register all observation listeners.
     */
private void registerListeners() {
    if (this.repository != null) {
        logger.debug("Registering resource listeners...");
        try {
            this.listenerConfig = new JcrListenerBaseConfig(this.getProviderContext().getObservationReporter(), this.repository);
            for (final ObserverConfiguration config : this.getProviderContext().getObservationReporter().getObserverConfigurations()) {
                logger.debug("Registering listener for {}", config.getPaths());
                final Closeable listener = new JcrResourceListener(this.listenerConfig, config);
                this.listeners.put(config, listener);
            }
        } catch (final RepositoryException e) {
            throw new SlingException("Can't create the JCR event listener.", e);
        }
        logger.debug("Registered resource listeners");
    }
}
Also used : JcrListenerBaseConfig(org.apache.sling.jcr.resource.internal.JcrListenerBaseConfig) Closeable(java.io.Closeable) ObserverConfiguration(org.apache.sling.spi.resource.provider.ObserverConfiguration) SlingException(org.apache.sling.api.SlingException) RepositoryException(javax.jcr.RepositoryException) JcrResourceListener(org.apache.sling.jcr.resource.internal.JcrResourceListener)

Aggregations

Closeable (java.io.Closeable)1 RepositoryException (javax.jcr.RepositoryException)1 SlingException (org.apache.sling.api.SlingException)1 JcrListenerBaseConfig (org.apache.sling.jcr.resource.internal.JcrListenerBaseConfig)1 JcrResourceListener (org.apache.sling.jcr.resource.internal.JcrResourceListener)1 ObserverConfiguration (org.apache.sling.spi.resource.provider.ObserverConfiguration)1