Class EventGenerator
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.observation.EventGenerator
-
public class EventGenerator extends java.lang.Object
Continuation-based content diff implementation that generatesEventHandler
callbacks by recursing down a content diff in a way that guarantees that only a finite number of callbacks will be made during agenerate()
method call, regardless of how large or complex the content diff is.A simple usage pattern would look like this:
EventGenerator generator = new EventGenerator(before, after, handler); while (!generator.isDone()) { generator.generate(); }
-
-
Constructor Summary
Constructors Constructor Description EventGenerator()
Creates a new generator instance.EventGenerator(@NotNull NodeState before, @NotNull NodeState after, @NotNull EventHandler handler)
Creates a new generator instance for processing the given changes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHandler(NodeState before, NodeState after, EventHandler handler)
void
generate()
Generates a finite number ofEventHandler
callbacks based on the content changes that have yet to be processed.boolean
isDone()
Checks whether there are no more content changes to be processed.
-
-
-
Constructor Detail
-
EventGenerator
public EventGenerator()
Creates a new generator instance. Changes to process need to be added throughaddHandler(NodeState, NodeState, EventHandler)
-
EventGenerator
public EventGenerator(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull EventHandler handler)
Creates a new generator instance for processing the given changes.
-
-
Method Detail
-
addHandler
public void addHandler(NodeState before, NodeState after, EventHandler handler)
-
isDone
public boolean isDone()
Checks whether there are no more content changes to be processed.
-
generate
public void generate()
Generates a finite number ofEventHandler
callbacks based on the content changes that have yet to be processed. Further processing (even if no callbacks were made) may be postponed to a futuregenerate()
call, until theisDone()
method finally returntrue
.
-
-