Class OakEventFilterImpl
- java.lang.Object
-
- org.apache.jackrabbit.api.observation.JackrabbitEventFilter
-
- org.apache.jackrabbit.oak.jcr.observation.filter.OakEventFilter
-
- org.apache.jackrabbit.oak.jcr.observation.OakEventFilterImpl
-
public class OakEventFilterImpl extends OakEventFilter
Implements OakEventFilter which is an extension to the JackrabbitEventFilter with features only supported by Oak.
-
-
Constructor Summary
Constructors Constructor Description OakEventFilterImpl(@NotNull JackrabbitEventFilter delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OakEventFilterImpl
aggregator(EventAggregator aggregator)
FilterBuilder
builder()
java.lang.String
getAbsPath()
Returns theabsPath
parameter of the filter.FilterBuilder.Condition
getAdditionalIncludeConditions(java.util.Set<java.lang.String> includePaths)
java.lang.String[]
getAdditionalPaths()
Returns theabsPaths
parameter of the filter.EventAggregator
getAggregator()
int
getEventTypes()
Returns theeventTypes
parameter of the filter.java.lang.String[]
getExcludedPaths()
Returns theexcludedPaths
parameter of the filter.java.lang.String[]
getIdentifiers()
Returns theuuids
parameter of the filter.boolean
getIsDeep()
Returns theisDeep
parameter of the filter.java.lang.String[]
getNodeTypes()
Returns thenodeTypeName
parameter of the filter.boolean
getNoExternal()
Returns thenoExternal
parameter of the filter.boolean
getNoInternal()
Returns thenoInternal
parameter of the filter.boolean
getNoLocal()
Returns thenoLocal
parameter of the filter.JackrabbitEventFilter
setAbsPath(java.lang.String absPath)
Sets theabsPath
parameter of the filter.JackrabbitEventFilter
setAdditionalPaths(java.lang.String... absPaths)
Sets theabsPaths
parameter of the filter.JackrabbitEventFilter
setEventTypes(int eventTypes)
Sets theeventTypes
parameter of the filter.JackrabbitEventFilter
setExcludedPaths(java.lang.String... excludedPaths)
Sets theexcludedPaths
parameter of the filter.JackrabbitEventFilter
setIdentifiers(java.lang.String[] identifiers)
Sets theidentifiers
parameter of the filter.JackrabbitEventFilter
setIsDeep(boolean isDeep)
Sets theisDeep
parameter of the filter.JackrabbitEventFilter
setNodeTypes(java.lang.String[] nodeTypeNames)
Sets thenodeTypeNames
parameter of the filter.JackrabbitEventFilter
setNoExternal(boolean noExternal)
Sets thenoExternal
parameter of the filter.JackrabbitEventFilter
setNoInternal(boolean noInternal)
Sets thenoInternal
parameter of the filter.JackrabbitEventFilter
setNoLocal(boolean noLocal)
Sets thenoLocal
parameter of the filter.OakEventFilter
withApplyNodeTypeOnSelf()
This causes the node type filter to be applied on 'this' node instead of the 'parent' node, thus allows to create a filter which listens on adding/removing/etc on nodes of a particular node type (while the default was that the node type was applicable on the parent).OakEventFilter
withIncludeAncestorsRemove()
This causes the registration of independent, additional !deep NODE_REMOVED filter-conditions of all parents of the include paths (both normal and glob).OakEventFilter
withIncludeGlobPaths(java.lang.String... globPaths)
Adds the provided glob paths to the set of include paths.OakEventFilter
withIncludeSubtreeOnRemove()
This flag causes remove events to be sent for all nodes and properties of an entire subtree (hence use with care!).OakEventFilter
withNodeTypeAggregate(java.lang.String[] nodeTypes, java.lang.String[] relativeGlobPaths)
Greedy aggregating filter which upon first (hence greedy) hit of provided nodeTypes checks if the child subtree leading to the actual change matches any of the provided relativeGlobPaths.FilterBuilder.Condition
wrapMainCondition(FilterBuilder.Condition mainCondition, FilterBuilder filterBuilder, PermissionProviderFactory permissionProviderFactory)
-
-
-
Constructor Detail
-
OakEventFilterImpl
public OakEventFilterImpl(@NotNull @NotNull JackrabbitEventFilter delegate)
-
-
Method Detail
-
getAbsPath
public java.lang.String getAbsPath()
Description copied from class:JackrabbitEventFilter
Returns theabsPath
parameter of the filter.- Overrides:
getAbsPath
in classJackrabbitEventFilter
- Returns:
- a
String
.
-
setAbsPath
public JackrabbitEventFilter setAbsPath(java.lang.String absPath)
Description copied from class:JackrabbitEventFilter
Sets theabsPath
parameter of the filter. If left unset, this parameter defaults tonull
.- Overrides:
setAbsPath
in classJackrabbitEventFilter
- Parameters:
absPath
- an absolute pathString
.- Returns:
- This EventFilter object with the
absPath
parameter set.
-
getAdditionalPaths
public java.lang.String[] getAdditionalPaths()
Description copied from class:JackrabbitEventFilter
Returns theabsPaths
parameter of the filter.- Overrides:
getAdditionalPaths
in classJackrabbitEventFilter
- Returns:
- a
String
array.
-
setAdditionalPaths
public JackrabbitEventFilter setAdditionalPaths(java.lang.String... absPaths)
Description copied from class:JackrabbitEventFilter
Sets theabsPaths
parameter of the filter. If left unset, this parameter defaults to an empty array.- Overrides:
setAdditionalPaths
in classJackrabbitEventFilter
- Parameters:
absPaths
- an absolute pathString
array.- Returns:
- This EventFilter object with the
absPaths
parameter set.
-
getEventTypes
public int getEventTypes()
Description copied from class:JackrabbitEventFilter
Returns theeventTypes
parameter of the filter.- Overrides:
getEventTypes
in classJackrabbitEventFilter
- Returns:
- an
int
.
-
setEventTypes
public JackrabbitEventFilter setEventTypes(int eventTypes)
Description copied from class:JackrabbitEventFilter
Sets theeventTypes
parameter of the filter. If left unset, this parameter defaults to0
.- Overrides:
setEventTypes
in classJackrabbitEventFilter
- Parameters:
eventTypes
- anint
.- Returns:
- This EventFilter object with the
eventTypes
parameter set.
-
getExcludedPaths
public java.lang.String[] getExcludedPaths()
Description copied from class:JackrabbitEventFilter
Returns theexcludedPaths
parameter of the filter.- Overrides:
getExcludedPaths
in classJackrabbitEventFilter
- Returns:
- a
String
array.
-
setExcludedPaths
public JackrabbitEventFilter setExcludedPaths(java.lang.String... excludedPaths)
Description copied from class:JackrabbitEventFilter
Sets theexcludedPaths
parameter of the filter. If left unset, this parameter defaults to an empty array.- Overrides:
setExcludedPaths
in classJackrabbitEventFilter
- Parameters:
excludedPaths
- an absolute pathString
array.- Returns:
- This EventFilter object with the
excludedPaths
parameter set.
-
getIdentifiers
public java.lang.String[] getIdentifiers()
Description copied from class:JackrabbitEventFilter
Returns theuuids
parameter of the filter.- Overrides:
getIdentifiers
in classJackrabbitEventFilter
- Returns:
- a
String
array.
-
setIdentifiers
public JackrabbitEventFilter setIdentifiers(java.lang.String[] identifiers)
Description copied from class:JackrabbitEventFilter
Sets theidentifiers
parameter of the filter. If left unset, this parameter defaults tonull
.- Overrides:
setIdentifiers
in classJackrabbitEventFilter
- Parameters:
identifiers
- aString
array.- Returns:
- This EventFilter object with the
identifiers
parameter set.
-
getIsDeep
public boolean getIsDeep()
Description copied from class:JackrabbitEventFilter
Returns theisDeep
parameter of the filter.- Overrides:
getIsDeep
in classJackrabbitEventFilter
- Returns:
- a
boolean
.
-
setIsDeep
public JackrabbitEventFilter setIsDeep(boolean isDeep)
Description copied from class:JackrabbitEventFilter
Sets theisDeep
parameter of the filter. If left unset, this parameter defaults tofalse
.- Overrides:
setIsDeep
in classJackrabbitEventFilter
- Parameters:
isDeep
- aboolean
.- Returns:
- This EventFilter object with the
isDeep
parameter set.
-
getNodeTypes
public java.lang.String[] getNodeTypes()
Description copied from class:JackrabbitEventFilter
Returns thenodeTypeName
parameter of the filter.- Overrides:
getNodeTypes
in classJackrabbitEventFilter
- Returns:
- a
String
array.
-
setNodeTypes
public JackrabbitEventFilter setNodeTypes(java.lang.String[] nodeTypeNames)
Description copied from class:JackrabbitEventFilter
Sets thenodeTypeNames
parameter of the filter. If left unset, this parameter defaults tonull
.- Overrides:
setNodeTypes
in classJackrabbitEventFilter
- Parameters:
nodeTypeNames
- aString
array.- Returns:
- This EventFilter object with the
nodeTypes
parameter set.
-
getNoExternal
public boolean getNoExternal()
Description copied from class:JackrabbitEventFilter
Returns thenoExternal
parameter of the filter.- Overrides:
getNoExternal
in classJackrabbitEventFilter
- Returns:
- a
boolean
.
-
setNoExternal
public JackrabbitEventFilter setNoExternal(boolean noExternal)
Description copied from class:JackrabbitEventFilter
Sets thenoExternal
parameter of the filter. If left unset, this parameter defaults tofalse
.- Overrides:
setNoExternal
in classJackrabbitEventFilter
- Parameters:
noExternal
- aboolean
.- Returns:
- This EventFilter object with the
noExternal
parameter set.
-
getNoInternal
public boolean getNoInternal()
Description copied from class:JackrabbitEventFilter
Returns thenoInternal
parameter of the filter.- Overrides:
getNoInternal
in classJackrabbitEventFilter
- Returns:
- a
boolean
.
-
setNoInternal
public JackrabbitEventFilter setNoInternal(boolean noInternal)
Description copied from class:JackrabbitEventFilter
Sets thenoInternal
parameter of the filter. If left unset, this parameter defaults tofalse
.- Overrides:
setNoInternal
in classJackrabbitEventFilter
- Parameters:
noInternal
- aboolean
.- Returns:
- This EventFilter object with the
noExternal
parameter set.
-
getNoLocal
public boolean getNoLocal()
Description copied from class:JackrabbitEventFilter
Returns thenoLocal
parameter of the filter.- Overrides:
getNoLocal
in classJackrabbitEventFilter
- Returns:
- a
boolean
.
-
setNoLocal
public JackrabbitEventFilter setNoLocal(boolean noLocal)
Description copied from class:JackrabbitEventFilter
Sets thenoLocal
parameter of the filter. If left unset, this parameter defaults tofalse
.- Overrides:
setNoLocal
in classJackrabbitEventFilter
- Parameters:
noLocal
- aboolean
.- Returns:
- This EventFilter object with the
noLocal
parameter set.
-
withApplyNodeTypeOnSelf
public OakEventFilter withApplyNodeTypeOnSelf()
Description copied from class:OakEventFilter
This causes the node type filter to be applied on 'this' node instead of the 'parent' node, thus allows to create a filter which listens on adding/removing/etc on nodes of a particular node type (while the default was that the node type was applicable on the parent).Note that this is an 'either/or' thing: either the node type is applied on the parent (default) or on 'self/this' (via this switch) but not both.
Also note that this is independent from the nodeTypeAggregate, and will only be applied to the (main) node types set on this filter, not on the nodeTypeAggregate's node types.
- Specified by:
withApplyNodeTypeOnSelf
in classOakEventFilter
- Returns:
- this filter with the filter change applied
-
withIncludeAncestorsRemove
public OakEventFilter withIncludeAncestorsRemove()
Description copied from class:OakEventFilter
This causes the registration of independent, additional !deep NODE_REMOVED filter-conditions of all parents of the include paths (both normal and glob). (These additional filter-conditions are added in 'OR' mode to the otherwise resulting filter-conditions, thus you can still have an independentdeep/!deep
flag too)- include path /a/b/c/d results in additional !deep NODE_REMOVED filters on /a/b/c, on /a/b and on /a
- include path /a/b/** results in additional !deep NODE_REMOVED filter on /a, /a/b and /a/b/**
- include path /a/b/**
/
*.jsp results in additional deep NODE_REMOVED filter on /a, /a/b and /a/b/**
Note that this and the above result in the same additional include paths since all this includeAncestorsRemove flag does is include potential ancestors, it doesn't guarantee that there are children matching the given paths (eg it doesn't traverse down) - additionally for paths with globs (eg /a/b/**
/
*.jsp) it adds a deep NODE_REMOVED filter explicitly for that path using the same method as withIncludeSubtreeOnRemove does, but only limited to said path. So in this case you get a NODE_REMOVED for all *.jsp that are deleted in a subtree individually
Note that unlike 'normal' include and exclude paths, this variant doesn't apply Oak's NamePathMapper on the ancestors of the registers paths.
Also note that this might disable 'observation prefiltering based on paths' (OAK-4796) on this listener.
- Specified by:
withIncludeAncestorsRemove
in classOakEventFilter
- Returns:
- this filter with the filter change applied
-
wrapMainCondition
public FilterBuilder.Condition wrapMainCondition(FilterBuilder.Condition mainCondition, FilterBuilder filterBuilder, PermissionProviderFactory permissionProviderFactory)
-
withIncludeSubtreeOnRemove
public OakEventFilter withIncludeSubtreeOnRemove()
Description copied from class:OakEventFilter
This flag causes remove events to be sent for all nodes and properties of an entire subtree (hence use with care!).It is only applied when a parent node is actually removed. For a parent node move this is not applied.
- Specified by:
withIncludeSubtreeOnRemove
in classOakEventFilter
- Returns:
- this filter with the filter change applied
-
withIncludeGlobPaths
public OakEventFilter withIncludeGlobPaths(java.lang.String... globPaths)
Description copied from class:OakEventFilter
Adds the provided glob paths to the set of include paths.The definition of a glob path is here
Note that unlike 'normal' include and exclude paths, this variant doesn't apply Oak's NamePathMapper.
This filter property is added in 'or' mode.
- Specified by:
withIncludeGlobPaths
in classOakEventFilter
- Parameters:
globPaths
- glob paths that should be added as include path pattern. Note that the NamePathMapper is not applied on these globPaths.- Returns:
- this filter with the filter change applied
-
builder
public FilterBuilder builder()
-
aggregator
public OakEventFilterImpl aggregator(EventAggregator aggregator)
-
getAdditionalIncludeConditions
public FilterBuilder.Condition getAdditionalIncludeConditions(java.util.Set<java.lang.String> includePaths)
-
getAggregator
public EventAggregator getAggregator()
-
withNodeTypeAggregate
public OakEventFilter withNodeTypeAggregate(java.lang.String[] nodeTypes, java.lang.String[] relativeGlobPaths)
Description copied from class:OakEventFilter
Greedy aggregating filter which upon first (hence greedy) hit of provided nodeTypes checks if the child subtree leading to the actual change matches any of the provided relativeGlobPaths.Note that unlike 'normal' include and exclude paths, this variant doesn't apply Oak's NamePathMapper.
This filter property is added in 'and' mode.
- Specified by:
withNodeTypeAggregate
in classOakEventFilter
- Parameters:
nodeTypes
- note that these nodeTypes are not mapped to oak nor validatedrelativeGlobPaths
- glob paths that are added to the set of include paths. To match the node with the desired node type itself, add an empty String ("") as one of the relativeGlobPaths too. Note that Oak's NamePathMapper is not applied to these relativeGlobPaths.- Returns:
- this filter with the filter change applied
-
-