Class FilterBuilder
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.observation.filter.FilterBuilder
-
public final class FilterBuilder extends Object
Builder forFilterProviderinstances.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classFilterBuilder.AddSubtreeTreeConditionstatic interfaceFilterBuilder.Conditionprotected static classFilterBuilder.DeleteSubtreeTreeConditionprotected static classFilterBuilder.MoveCondition
-
Constructor Summary
Constructors Constructor Description FilterBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull FilterBuilder.ConditionaccessControl(@NotNull PermissionProviderFactory permissionProviderFactory)A condition that hold for accessible items as determined by the passed permission provider.FilterBuilderaddPathsForMBean(@NotNull Set<String> paths)Adds paths to the FilterConfigMBean's getPaths set@NotNull FilterBuilder.ConditionaddSubtree()@NotNull FilterBuilderaddSubTree(@NotNull String absPath)Adds a path to the set of paths whose subtrees include all events of this filter.FilterBuilderaggregator(EventAggregator aggregator)@NotNull FilterBuilder.Conditionall(@NotNull Iterable<FilterBuilder.Condition> conditions)A compound condition that holds when all of its constituents hold.@NotNull FilterBuilder.Conditionall(@NotNull List<FilterBuilder.Condition> conditions)A compound condition that holds when all of its constituents hold.@NotNull FilterBuilder.Conditionall(@NotNull FilterBuilder.Condition... conditions)A compound condition that holds when all of its constituents hold.@NotNull FilterBuilder.Conditionany(@NotNull Iterable<FilterBuilder.Condition> conditions)A compound condition that holds when any of its constituents hold.@NotNull FilterBuilder.Conditionany(@NotNull FilterBuilder.Condition... conditions)A compound condition that holds when any of its constituents hold.@NotNull FilterProviderbuild()Create aFilterProviderreflecting the current state of this builder.@NotNull FilterBuildercondition(@NotNull FilterBuilder.Condition condition)Set the condition of this filter.@NotNull FilterBuilder.ConditiondeleteSubtree()@NotNull FilterBuilder.ConditioneventType(int eventTypes)A condition that holds for matching event types.@NotNull FilterBuilder.ConditionexcludeAll()A condition that never holds@NotNull FilterBuilder.ConditionincludeAll()A condition the always holds@NotNull FilterBuilderincludeClusterExternal(boolean include)Whether to include cluster external changes.@NotNull FilterBuilderincludeClusterLocal(boolean include)Whether to include cluster local changes.@NotNull FilterBuilderincludeSessionLocal(boolean include)Whether to include session local changes.@NotNull FilterBuilder.ConditionmoveSubtree()@NotNull FilterBuilder.ConditionnodeType(@NotNull UniversalFilter.Selector selector, @Nullable String[] ntNames)A condition that holds for matching node types.@NotNull FilterBuilder.Conditionnot(@NotNull FilterBuilder.Condition condition)A compound condition that holds when its constituent does not hold.@NotNull FilterBuilder.Conditionpath(@NotNull String pathPattern)A condition that holds on the paths matching a certain pattern.@NotNull FilterBuilder.Conditionproperty(@NotNull UniversalFilter.Selector selector, @NotNull String name, @NotNull Predicate<PropertyState> predicate)A condition that holds when the property predicate matches.@NotNull FilterBuildersetChangeSetFilter(@NotNull ChangeSetFilter changeSetFilter)@NotNull FilterBuilder.Conditionuniversal(@NotNull UniversalFilter.Selector selector, @NotNull Predicate<NodeState> predicate)A condition that holds when the predicate matches.@NotNull FilterBuilder.Conditionuuid(@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- iftruesession 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- iftruecluster 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- iftruecluster 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 aConditioninstance.- 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 ifnulland 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 ifnulland 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 aFilterProviderreflecting the current state of this builder.- Returns:
- filter provider of the current state of this builder
-
-