Interface ObservationReporter


  • @ProviderType
    public interface ObservationReporter
    A ResourceProvider must use an observation reporter to report changes to resources. The resource provider gets an instance of this reporter through the ProviderContext.
    Since:
    1.0.0 (Sling API Bundle 2.11.0)
    • Method Detail

      • getObserverConfigurations

        @NotNull
        @NotNull java.util.List<ObserverConfiguration> getObserverConfigurations()
        Get the list of observer configurations affecting the provider this reporter is bound to.
        Returns:
        A list of observer configurations, the list might be empty.
      • reportChanges

        void reportChanges​(@NotNull
                           @NotNull java.lang.Iterable<ResourceChange> changes,
                           boolean distribute)
        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 reportChanges(ObserverConfiguration, Iterable, boolean) must be used instead.
        Parameters:
        changes - The list of changes.
        distribute - Whether the changes should be distributed to other instances.
      • reportChanges

        void reportChanges​(@NotNull
                           @NotNull ObserverConfiguration config,
                           @NotNull
                           @NotNull java.lang.Iterable<ResourceChange> changes,
                           boolean distribute)
        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, 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.
        Parameters:
        config - The configuration the change belongs to
        changes - The list of changes.
        distribute - Whether the changes should be distributed to other instances.
        Since:
        1.1.0 (Sling API Bundle 2.15.0)