Class BasicObservationReporter

java.lang.Object
org.apache.sling.resourceresolver.impl.observation.BasicObservationReporter
All Implemented Interfaces:
ObservationReporter

public class BasicObservationReporter extends Object implements ObservationReporter
Implementation of the observation reporter. Each resource provider gets its on instance.
  • Constructor Details

    • BasicObservationReporter

      public BasicObservationReporter(List<String> searchPath, Collection<ResourceChangeListenerInfo> infos)
      Create a reporter listening for resource provider changes
      Parameters:
      searchPath - The search path
      infos - The listeners map
    • BasicObservationReporter

      public BasicObservationReporter(List<String> searchPath, Collection<ResourceChangeListenerInfo> infos, Path providerPath, PathSet excludePaths)
      Create a reporter listening for a provider
      Parameters:
      searchPath - The search paths
      infos - The listeners map
      providerPath - The mount point of the provider
      excludePaths - Excluded paths for that provider
  • Method Details

    • getObserverConfigurations

      public List<ObserverConfiguration> getObserverConfigurations()
      Description copied from interface: ObservationReporter
      Get the list of observer configurations affecting the provider this reporter is bound to.
      Specified by:
      getObserverConfigurations in interface ObservationReporter
      Returns:
      A list of observer configurations, the list might be empty.
    • reportChanges

      public void reportChanges(Iterable<ResourceChange> changes, boolean distribute)
      Description copied from interface: ObservationReporter
      A resource provider can inform about a list of changes. If the resource provider is not able to report external events on other instances, it should set the distribute flag. In this case the resource resolver implementation will distribute the events to all other instances. Due to performance reasons, the observation reporter might not verify if the reported change matches the observer configurations. If the resource provider part which is reporting the changes is using just a single mechanism reporting changes, this method must be used to report changes across all observer configurations. However, if the implementation is using a mechanism per observation configuration ObservationReporter.reportChanges(ObserverConfiguration, Iterable, boolean) must be used instead.
      Specified by:
      reportChanges in interface ObservationReporter
      Parameters:
      changes - The list of changes.
      distribute - Whether the changes should be distributed to other instances.
    • reportChanges

      public void reportChanges(ObserverConfiguration config, Iterable<ResourceChange> changes, boolean distribute)
      Description copied from interface: ObservationReporter
      A resource provider can inform about a list of changes. If the resource provider is not able to report external events on other instances, it should set the distribute flag. In this case the resource resolver implementation will distribute the events to all other instances. Due to performance reasons, the observation reporter might not verify if the reported change matches the observer configurations. If the resource provider part which is reporting the changes is using just a single mechanism reporting changes, ObservationReporter.reportChanges(Iterable, boolean) must be used to report changes across all observer configurations. However, if the implementation is using a mechanism per observation configuration this method must be used instead.
      Specified by:
      reportChanges in interface ObservationReporter
      Parameters:
      config - The configuration the change belongs to
      changes - The list of changes.
      distribute - Whether the changes should be distributed to other instances.