@@ -0,0 +1,1398 @@
+package com.github.digital_wonderland.sling_metrics.sling;%0A%0Aimport com.github.digital_wonderland.sling_metrics.service.MetricService;%0Aimport org.apache.felix.scr.annotations.*;%0Aimport org.apache.sling.api.SlingConstants;%0Aimport org.osgi.service.event.Event;%0Aimport org.osgi.service.event.EventConstants;%0Aimport org.osgi.service.event.EventHandler;%0A%0A@Component(immediate = true, metatype = false)%0A@Service%0A@Properties(%7B%0A        @Property(name = EventConstants.EVENT_TOPIC, value = %7B SlingConstants.TOPIC_RESOURCE_ADDED,%0A                SlingConstants.TOPIC_RESOURCE_CHANGED,%0A                SlingConstants.TOPIC_RESOURCE_REMOVED%7D),%0A        @Property(name = EventConstants.EVENT_FILTER, value = %22(path=/*)%22)%0A%7D)%0Apublic class JcrResourceEventListener implements EventHandler %7B%0A%0A    @Reference%0A    private MetricService metricService;%0A%0A    @Override%0A    public void handleEvent(Event event) %7B%0A        final String topic = event.getTopic();%0A        if (SlingConstants.TOPIC_RESOURCE_ADDED.equals(topic)) %7B%0A            metricService.getRegistry().meter(%22jcr.resource.added%22).mark();%0A        %7D else if (SlingConstants.TOPIC_RESOURCE_CHANGED.equals(topic)) %7B%0A            metricService.getRegistry().meter(%22jcr.resource.changed%22).mark();%0A        %7D else if (SlingConstants.TOPIC_RESOURCE_REMOVED.equals(topic)) %7B%0A            metricService.getRegistry().meter(%22jcr.resource.removed%22).mark();%0A        %7D%0A    %7D%0A%7D%0A

add JCR resource event listener