Class BasicObservationReporter
java.lang.Object
org.apache.sling.resourceresolver.impl.observation.BasicObservationReporter
- All Implemented Interfaces:
ObservationReporter
Implementation of the observation reporter.
Each resource provider gets its on instance.
-
Constructor Summary
ConstructorDescriptionBasicObservationReporter
(List<String> searchPath, Collection<ResourceChangeListenerInfo> infos) Create a reporter listening for resource provider changesBasicObservationReporter
(List<String> searchPath, Collection<ResourceChangeListenerInfo> infos, Path providerPath, PathSet excludePaths) Create a reporter listening for a provider -
Method Summary
Modifier and TypeMethodDescriptionGet the list of observer configurations affecting the provider this reporter is bound to.void
reportChanges
(Iterable<ResourceChange> changes, boolean distribute) A resource provider can inform about a list of changes.void
reportChanges
(ObserverConfiguration config, Iterable<ResourceChange> changes, boolean distribute) A resource provider can inform about a list of changes.
-
Constructor Details
-
BasicObservationReporter
public BasicObservationReporter(List<String> searchPath, Collection<ResourceChangeListenerInfo> infos) Create a reporter listening for resource provider changes- Parameters:
searchPath
- The search pathinfos
- 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 pathsinfos
- The listeners mapproviderPath
- The mount point of the providerexcludePaths
- Excluded paths for that provider
-
-
Method Details
-
getObserverConfigurations
Description copied from interface:ObservationReporter
Get the list of observer configurations affecting the provider this reporter is bound to.- Specified by:
getObserverConfigurations
in interfaceObservationReporter
- Returns:
- A list of observer configurations, the list might be empty.
-
reportChanges
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 configurationObservationReporter.reportChanges(ObserverConfiguration, Iterable, boolean)
must be used instead.- Specified by:
reportChanges
in interfaceObservationReporter
- 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 interfaceObservationReporter
- Parameters:
config
- The configuration the change belongs tochanges
- The list of changes.distribute
- Whether the changes should be distributed to other instances.
-