Class JCRNodeChangeEventHandler

  • All Implemented Interfaces:
    org.apache.sling.api.resource.observation.ExternalResourceChangeListener, org.apache.sling.api.resource.observation.ResourceChangeListener, org.osgi.service.event.EventHandler

    @Property(label="JCR paths to watch for changes. (legacy)",description="Paths expressed in LDAP syntax. Example: (|(path=/content*)(path=/etc*)) - Watches for changes under /content or /etc. This is deprecated - consider using resource.paths instead for better performance.",name="event.filter") @Property(label="JCR paths to watch for changes.",value={"/content","/etc"},description="List of paths to watch. Entries with the \'glob:\' prefix are interpreted as globs, i.e. the * and ** wildcards are supported.",name="resource.paths") @Property(label="Type of change to listen to",value={"ADDED","REMOVED","CHANGED"},name="resource.change.types") @Property(name="webconsole.configurationFactory.nameHint",value="JCR paths to watch for changes: {event.filter} {resource.paths}",propertyPrivate=true)
    public class JCRNodeChangeEventHandler
    extends Object
    implements org.osgi.service.event.EventHandler, org.apache.sling.api.resource.observation.ResourceChangeListener, org.apache.sling.api.resource.observation.ExternalResourceChangeListener
    Sample http cache invalidation job creator. Creates invalidation job when there is a change in JCR repository. Cache invalidation events could be sling event handlers, sling filter to trap replication events, workflow steps, etc. Invalidation event creates and starts Invalidation jobs.

    This is modeled as a sling observer which listens to any change in paths (by default) -- /content, /etc and creates an invalidation job. The intention of this invalidation job is that whenever there is any change in the above said paths, the configured cache needs to be invalidated.

    • Constructor Detail

      • JCRNodeChangeEventHandler

        public JCRNodeChangeEventHandler()
    • Method Detail

      • activate

        @Activate
        protected void activate​(org.osgi.framework.BundleContext context,
                                Map<String,​Object> config)
      • deactivate

        @Deactivate
        protected void deactivate()
      • handleEvent

        public void handleEvent​(org.osgi.service.event.Event event)
        Specified by:
        handleEvent in interface org.osgi.service.event.EventHandler
      • onChange

        public void onChange​(List<org.apache.sling.api.resource.observation.ResourceChange> changes)
        Specified by:
        onChange in interface org.apache.sling.api.resource.observation.ResourceChangeListener