Interface Observer
-
- All Known Implementing Classes:
BackgroundObserver
,ChangeDispatcher
,CompositeObserver
,DiffObserver
,EmptyObserver
,FilteringDispatcher
,FilteringObserver
,LuceneIndexProvider
,NodeObserver
public interface Observer
Extension point for observing changes in an Oak repository. Observer implementations might use the observed content changes to update caches, trigger JCR-level observation events or otherwise process the changes.An observer is informed about content changes by calling the
contentChanged(NodeState, CommitInfo)
method. The frequency and granularity of these callbacks is not specified. However, each observer is always guaranteed to see a linear sequence of changes. In other words the method will not be called concurrently from multiple threads and successive calls represent a linear sequence of repository states, i.e. the root state passed to a call is guaranteed to represent a repository state that is not newer than the root state passed to the next call. The observer is expected to keep track of the previously observed state if it wants to use a content diff to determine what exactly changed between two states.For local changes repository passes in a
CommitInfo
instance which was used as part of commit and make it available to observers along with the committed content changes. In such cases, i.e. when the commit info argument is non-null
, the reported content change is guaranteed to contain only changes from that specific commit (and the applied commit hooks). Note that it is possible for a repository to report commit information for only some commits but not others.For external changes repository would construct a
CommitInfo
instance which might include some metadata which can be used by observers. SuchCommitInfo
instances wouldexternal
flag set to trueIt should also be noted that two observers may not necessarily see the same sequence of content changes. It is also possible for an observer to be notified when no actual content changes have happened therefore passing the same root state to subsequent calls.
A specific implementation or deployment may offer more guarantees about when and how observers are notified of content changes. See the relevant documentation for more details about such cases.
- Since:
- Oak 0.11
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
contentChanged(@NotNull NodeState root, @NotNull CommitInfo info)
Observes a content change.
-
-
-
Method Detail
-
contentChanged
void contentChanged(@NotNull @NotNull NodeState root, @NotNull @NotNull CommitInfo info)
Observes a content change. See theObserver
class javadocs and relevant repository and observer registration details for more information on when and how this method gets called.- Parameters:
root
- root state of the repositoryinfo
- commit information
-
-