Class FilterBuilder
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.observation.filter.FilterBuilder
-
public final class FilterBuilder extends Object
Builder forFilterProvider
instances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
FilterBuilder.AddSubtreeTreeCondition
static interface
FilterBuilder.Condition
protected static class
FilterBuilder.DeleteSubtreeTreeCondition
protected static class
FilterBuilder.MoveCondition
-
Constructor Summary
Constructors Constructor Description FilterBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull FilterBuilder.Condition
accessControl(@NotNull PermissionProviderFactory permissionProviderFactory)
A condition that hold for accessible items as determined by the passed permission provider.FilterBuilder
addPathsForMBean(@NotNull Set<String> paths)
Adds paths to the FilterConfigMBean's getPaths set@NotNull FilterBuilder.Condition
addSubtree()
@NotNull FilterBuilder
addSubTree(@NotNull String absPath)
Adds a path to the set of paths whose subtrees include all events of this filter.FilterBuilder
aggregator(EventAggregator aggregator)
@NotNull FilterBuilder.Condition
all(@NotNull Iterable<FilterBuilder.Condition> conditions)
A compound condition that holds when all of its constituents hold.@NotNull FilterBuilder.Condition
all(@NotNull List<FilterBuilder.Condition> conditions)
A compound condition that holds when all of its constituents hold.@NotNull FilterBuilder.Condition
all(@NotNull FilterBuilder.Condition... conditions)
A compound condition that holds when all of its constituents hold.@NotNull FilterBuilder.Condition
any(@NotNull Iterable<FilterBuilder.Condition> conditions)
A compound condition that holds when any of its constituents hold.@NotNull FilterBuilder.Condition
any(@NotNull FilterBuilder.Condition... conditions)
A compound condition that holds when any of its constituents hold.@NotNull FilterProvider
build()
Create aFilterProvider
reflecting the current state of this builder.@NotNull FilterBuilder
condition(@NotNull FilterBuilder.Condition condition)
Set the condition of this filter.@NotNull FilterBuilder.Condition
deleteSubtree()
@NotNull FilterBuilder.Condition
eventType(int eventTypes)
A condition that holds for matching event types.@NotNull FilterBuilder.Condition
excludeAll()
A condition that never holds@NotNull FilterBuilder.Condition
includeAll()
A condition the always holds@NotNull FilterBuilder
includeClusterExternal(boolean include)
Whether to include cluster external changes.@NotNull FilterBuilder
includeClusterLocal(boolean include)
Whether to include cluster local changes.@NotNull FilterBuilder
includeSessionLocal(boolean include)
Whether to include session local changes.@NotNull FilterBuilder.Condition
moveSubtree()
@NotNull FilterBuilder.Condition
nodeType(@NotNull UniversalFilter.Selector selector, @Nullable String[] ntNames)
A condition that holds for matching node types.@NotNull FilterBuilder.Condition
not(@NotNull FilterBuilder.Condition condition)
A compound condition that holds when its constituent does not hold.@NotNull FilterBuilder.Condition
path(@NotNull String pathPattern)
A condition that holds on the paths matching a certain pattern.@NotNull FilterBuilder.Condition
property(@NotNull UniversalFilter.Selector selector, @NotNull String name, @NotNull Predicate<PropertyState> predicate)
A condition that holds when the property predicate matches.@NotNull FilterBuilder
setChangeSetFilter(@NotNull ChangeSetFilter changeSetFilter)
@NotNull FilterBuilder.Condition
universal(@NotNull UniversalFilter.Selector selector, @NotNull Predicate<NodeState> predicate)
A condition that holds when the predicate matches.@NotNull FilterBuilder.Condition
uuid(@NotNull UniversalFilter.Selector selector, @Nullable String[] uuids)
A condition that holds for matching uuids.
-
-
-
Method Detail
-
setChangeSetFilter
@NotNull public @NotNull FilterBuilder setChangeSetFilter(@NotNull @NotNull ChangeSetFilter changeSetFilter)
-
addSubTree
@NotNull public @NotNull FilterBuilder addSubTree(@NotNull @NotNull String absPath)
Adds a path to the set of paths whose subtrees include all events of this filter. Does nothing if the paths is already covered by an path added earlier.This is used for optimisation in order to restrict traversal to these sub trees.
- Parameters:
absPath
- absolute path- Returns:
- this instance
-
addPathsForMBean
public FilterBuilder addPathsForMBean(@NotNull @NotNull Set<String> paths)
Adds paths to the FilterConfigMBean's getPaths set- Parameters:
paths
-- Returns:
-
aggregator
public FilterBuilder aggregator(EventAggregator aggregator)
-
includeSessionLocal
@NotNull public @NotNull FilterBuilder includeSessionLocal(boolean include)
Whether to include session local changes. Defaults tofalse
.- Parameters:
include
- iftrue
session local changes are included, otherwise session local changes are not included.- Returns:
- this instance
-
includeClusterExternal
@NotNull public @NotNull FilterBuilder includeClusterExternal(boolean include)
Whether to include cluster external changes. Defaults tofalse
.- Parameters:
include
- iftrue
cluster external changes are included, otherwise cluster external changes are not included.- Returns:
- this instance
-
includeClusterLocal
@NotNull public @NotNull FilterBuilder includeClusterLocal(boolean include)
Whether to include cluster local changes. Defaults totrue
.- Parameters:
include
- iftrue
cluster local changes are included, otherwise cluster local changes are not included.- Returns:
- this instance
-
condition
@NotNull public @NotNull FilterBuilder condition(@NotNull @NotNull FilterBuilder.Condition condition)
Set the condition of this filter. Conditions are obtained from the various methods on this instance that return aCondition
instance.- Parameters:
condition
- the conditions to apply- Returns:
- this instance
-
includeAll
@NotNull public @NotNull FilterBuilder.Condition includeAll()
A condition the always holds- Returns:
- true condition
-
excludeAll
@NotNull public @NotNull FilterBuilder.Condition excludeAll()
A condition that never holds- Returns:
- false condition
-
accessControl
@NotNull public @NotNull FilterBuilder.Condition accessControl(@NotNull @NotNull PermissionProviderFactory permissionProviderFactory)
A condition that hold for accessible items as determined by the passed permission provider.- Parameters:
permissionProviderFactory
- permission provider for checking whether an item is accessible.- Returns:
- access control condition
- See Also:
ACFilter
-
path
@NotNull public @NotNull FilterBuilder.Condition path(@NotNull @NotNull String pathPattern)
A condition that holds on the paths matching a certain pattern.- Parameters:
pathPattern
-- Returns:
- path condition
- See Also:
GlobbingPathFilter
-
eventType
@NotNull public @NotNull FilterBuilder.Condition eventType(int eventTypes)
A condition that holds for matching event types.- Parameters:
eventTypes
-- Returns:
- event type condition
- See Also:
EventTypeFilter
-
nodeType
@NotNull public @NotNull FilterBuilder.Condition nodeType(@NotNull @NotNull UniversalFilter.Selector selector, @Nullable @Nullable String[] ntNames)
A condition that holds for matching node types.- Parameters:
selector
- selector selecting the node to check the condition onntNames
- node type names to match. This conditions never matches ifnull
and always matches if empty.- Returns:
- node type condition
-
uuid
@NotNull public @NotNull FilterBuilder.Condition uuid(@NotNull @NotNull UniversalFilter.Selector selector, @Nullable @Nullable String[] uuids)
A condition that holds for matching uuids.- Parameters:
selector
- selector selecting the node to check the condition onuuids
- uuids to match. This conditions never matches ifnull
and always matches if empty.- Returns:
- node type condition
-
property
@NotNull public @NotNull FilterBuilder.Condition property(@NotNull @NotNull UniversalFilter.Selector selector, @NotNull @NotNull String name, @NotNull @NotNull Predicate<PropertyState> predicate)
A condition that holds when the property predicate matches.- Parameters:
selector
- selector selecting the node to check the condition onname
- the name of the property to check the predicate onpredicate
- the predicate to check on the named property- Returns:
- property condition
-
universal
@NotNull public @NotNull FilterBuilder.Condition universal(@NotNull @NotNull UniversalFilter.Selector selector, @NotNull @NotNull Predicate<NodeState> predicate)
A condition that holds when the predicate matches.- Parameters:
selector
- selector selecting the node to check the condition onpredicate
- the predicate to check on the selected node- Returns:
- universal condition
-
addSubtree
@NotNull public @NotNull FilterBuilder.Condition addSubtree()
- Returns:
- a condition that holds for children of added nodes.
-
deleteSubtree
@NotNull public @NotNull FilterBuilder.Condition deleteSubtree()
- Returns:
- a condition that holds for children of deleted nodes.
-
moveSubtree
@NotNull public @NotNull FilterBuilder.Condition moveSubtree()
- Returns:
- a condition that holds for children of the target of a moved node
-
any
@NotNull public @NotNull FilterBuilder.Condition any(@NotNull @NotNull FilterBuilder.Condition... conditions)
A compound condition that holds when any of its constituents hold.- Parameters:
conditions
- conditions of which any must hold in order for this condition to hold- Returns:
- any condition
-
all
@NotNull public @NotNull FilterBuilder.Condition all(@NotNull @NotNull FilterBuilder.Condition... conditions)
A compound condition that holds when all of its constituents hold.- Parameters:
conditions
- conditions of which all must hold in order for this condition to hold- Returns:
- any condition
-
all
@NotNull public @NotNull FilterBuilder.Condition all(@NotNull @NotNull List<FilterBuilder.Condition> conditions)
A compound condition that holds when all of its constituents hold.- Parameters:
conditions
- conditions of which all must hold in order for this condition to hold- Returns:
- any condition
-
not
@NotNull public @NotNull FilterBuilder.Condition not(@NotNull @NotNull FilterBuilder.Condition condition)
A compound condition that holds when its constituent does not hold.- Parameters:
condition
- condition which must not hold in order for this condition to hold- Returns:
- not condition
-
any
@NotNull public @NotNull FilterBuilder.Condition any(@NotNull @NotNull Iterable<FilterBuilder.Condition> conditions)
A compound condition that holds when any of its constituents hold.- Parameters:
conditions
- conditions of which any must hold in order for this condition to hold- Returns:
- any condition
-
all
@NotNull public @NotNull FilterBuilder.Condition all(@NotNull @NotNull Iterable<FilterBuilder.Condition> conditions)
A compound condition that holds when all of its constituents hold.- Parameters:
conditions
- conditions of which all must hold in order for this condition to hold- Returns:
- any condition
-
build
@NotNull public @NotNull FilterProvider build()
Create aFilterProvider
reflecting the current state of this builder.- Returns:
- filter provider of the current state of this builder
-
-