Class UniversalFilter
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.observation.filter.UniversalFilter
-
- All Implemented Interfaces:
EventFilter
public class UniversalFilter extends Object implements EventFilter
An universalFilterimplementation, which can be parametrised by aUniversalFilter.Selectorand aPredicate. The selector maps a call back on this filter to aNodeState. That node state is in turn passed to the predicate for determining whether to include or to exclude the respective event.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceUniversalFilter.SelectorA selector instance maps call backs onFilterstoNodeStateinstances, which should be used for determining inclusion or exclusion of the associated event.
-
Constructor Summary
Constructors Constructor Description UniversalFilter(@NotNull NodeState before, @NotNull NodeState after, @NotNull UniversalFilter.Selector selector, @NotNull Predicate<NodeState> predicate)Create a new instance of an universal filter rooted at the passed trees.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventFiltercreate(String name, NodeState before, NodeState after)Factory for creating a filter instance for the given child node@NotNull NodeStategetAfterState()@NotNull NodeStategetBeforeState()booleanincludeAdd(String name, NodeState after)Include an added nodebooleanincludeAdd(PropertyState after)Include an added propertybooleanincludeChange(PropertyState before, PropertyState after)Include a changed propertybooleanincludeDelete(String name, NodeState before)Include a deleted nodebooleanincludeDelete(PropertyState before)Include a deleted propertybooleanincludeMove(String sourcePath, String name, NodeState moved)Include a moved nodebooleanincludeReorder(String destName, String name, NodeState reordered)Include a reordered node
-
-
-
Constructor Detail
-
UniversalFilter
public UniversalFilter(@NotNull @NotNull NodeState before, @NotNull @NotNull NodeState after, @NotNull @NotNull UniversalFilter.Selector selector, @NotNull @NotNull Predicate<NodeState> predicate)Create a new instance of an universal filter rooted at the passed trees.- Parameters:
before- before stateafter- after stateselector- selector for selecting the tree to match the predicate againstpredicate- predicate for determining whether to include or to exclude an event
-
-
Method Detail
-
getBeforeState
@NotNull public @NotNull NodeState getBeforeState()
- Returns:
- before state for this filter
-
getAfterState
@NotNull public @NotNull NodeState getAfterState()
- Returns:
- after state for this filter
-
includeAdd
public boolean includeAdd(PropertyState after)
Description copied from interface:EventFilterInclude an added property- Specified by:
includeAddin interfaceEventFilter- Parameters:
after- added property- Returns:
trueif the property should be included
-
includeChange
public boolean includeChange(PropertyState before, PropertyState after)
Description copied from interface:EventFilterInclude a changed property- Specified by:
includeChangein interfaceEventFilter- Parameters:
before- property before the changeafter- property after the change- Returns:
trueif the property should be included
-
includeDelete
public boolean includeDelete(PropertyState before)
Description copied from interface:EventFilterInclude a deleted property- Specified by:
includeDeletein interfaceEventFilter- Parameters:
before- deleted property- Returns:
trueif the property should be included
-
includeAdd
public boolean includeAdd(String name, NodeState after)
Description copied from interface:EventFilterInclude an added node- Specified by:
includeAddin interfaceEventFilter- Parameters:
name- name of the nodeafter- added node- Returns:
trueif the node should be included
-
includeDelete
public boolean includeDelete(String name, NodeState before)
Description copied from interface:EventFilterInclude a deleted node- Specified by:
includeDeletein interfaceEventFilter- Parameters:
name- name of the nodebefore- deleted node- Returns:
trueif the node should be included
-
includeMove
public boolean includeMove(String sourcePath, String name, NodeState moved)
Description copied from interface:EventFilterInclude a moved node- Specified by:
includeMovein interfaceEventFilter- Parameters:
sourcePath- source path of the move operationname- name of the moved nodemoved- the moved node- Returns:
trueif the node should be included
-
includeReorder
public boolean includeReorder(String destName, String name, NodeState reordered)
Description copied from interface:EventFilterInclude a reordered node- Specified by:
includeReorderin interfaceEventFilter- Parameters:
destName- name of theorderBefore()destination nodename- name of the reordered nodereordered- the reordered node- Returns:
trueif the node should be included
-
create
public EventFilter create(String name, NodeState before, NodeState after)
Description copied from interface:EventFilterFactory for creating a filter instance for the given child node- Specified by:
createin interfaceEventFilter- Parameters:
name- name of the child nodebefore- before state of the child nodeafter- after state of the child node- Returns:
- filter instance for filtering the child node or
nullto exclude the sub tree rooted at this child node.
-
-