public class FilteringObserver extends Object implements Observer, Closeable
The FilteringObserver uses an explicit Filter to decide whether or not to forward a content change to the BackgroundObserver. If the Filter decides to include the change things happen as usual. If the Filter decides to exclude the change, this FilteringObserver does not forward the change, but remembers the fact that the last change was filtered. The first included change after excluded ones will cause a NOOP_CHANGE commitInfo to be passed along to the BackgroundObserver. That NOOP_CHANGE is then used by the FilteringDispatcher: if a CommitInfo is a NOOP_CHANGE then the FilteringDispatcher will not forward anything to the FilteringAwareObserver and only adjust the 'before' state accordingly (which it does also for a NOOP_CHANGE, to exactly achieve the skipping effect).
| Constructor and Description |
|---|
FilteringObserver(BackgroundObserver backgroundObserver,
Filter filter)
Alternative constructor where the BackgroundObserver is created elsewhere
|
FilteringObserver(Executor executor,
int queueLength,
Filter filter,
FilteringAwareObserver observer)
Default constructor which creates a BackgroundObserver automatically, including
creating a FilteringDispatcher.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
contentChanged(NodeState root,
CommitInfo info)
Observes a content change.
|
BackgroundObserver |
getBackgroundObserver() |
public FilteringObserver(Executor executor, int queueLength, Filter filter, FilteringAwareObserver observer)
executor - the executor that should be used for the BackgroundObserverqueueLength - the queue length of the BackgroundObserverfilter - the Filter to be used for filteringobserver - the FilteringAwareObserver to which content changes ultimately
are delivered after going through a chain of
FilteringObserver->BackgroundObserver->FilteringDispatcher.public FilteringObserver(BackgroundObserver backgroundObserver, Filter filter)
backgroundObserver - the BackgroundObserver to be used by this FilteringObserverfilter - the Filter to be used for filteringpublic BackgroundObserver getBackgroundObserver()
public final void contentChanged(NodeState root, CommitInfo info)
ObserverObserver class javadocs
and relevant repository and observer registration details for more
information on when and how this method gets called.contentChanged in interface Observerroot - root state of the repositoryinfo - commit informationpublic void close()
close in interface Closeableclose in interface AutoCloseable"Copyright © 2010 - 2017 Adobe Systems Incorporated. All Rights Reserved"