Search in sources :

Example 1 with ObservationReporter

use of org.apache.sling.spi.resource.provider.ObservationReporter in project sling by apache.

the class ResourceProviderTracker method postResourceProviderChange.

/**
     * Post a change event for a resource provider change
     * @param type The change type
     * @param info The resource provider
     */
private void postResourceProviderChange(final ProviderEvent event) {
    final ObservationReporter or = this.providerReporter;
    if (or != null) {
        final ResourceChange change = new ResourceChange(event.isAdd ? ChangeType.PROVIDER_ADDED : ChangeType.PROVIDER_REMOVED, event.path, false);
        or.reportChanges(Collections.singletonList(change), false);
    }
}
Also used : ObservationReporter(org.apache.sling.spi.resource.provider.ObservationReporter) ResourceChange(org.apache.sling.api.resource.observation.ResourceChange)

Example 2 with ObservationReporter

use of org.apache.sling.spi.resource.provider.ObservationReporter in project sling by apache.

the class FileMonitor method run.

/**
     * @see java.util.TimerTask#run()
     */
@Override
public void run() {
    synchronized (timer) {
        stopped = false;
        if (stop) {
            stopped = true;
            timer.notifyAll();
            return;
        }
    }
    synchronized (this) {
        try {
            // if we don't have an observation reporter, we just skip the check
            final ObservationReporter reporter = this.provider.getObservationReporter();
            if (reporter != null) {
                this.check(this.root, reporter);
            }
        } catch (Exception e) {
        // ignore this
        }
    }
    synchronized (timer) {
        stopped = true;
        timer.notifyAll();
    }
}
Also used : ObservationReporter(org.apache.sling.spi.resource.provider.ObservationReporter)

Aggregations

ObservationReporter (org.apache.sling.spi.resource.provider.ObservationReporter)2 ResourceChange (org.apache.sling.api.resource.observation.ResourceChange)1