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 OakEventFilterImplaggregator(EventAggregator aggregator)FilterBuilderbuilder()StringgetAbsPath()Returns theabsPathparameter of the filter.FilterBuilder.ConditiongetAdditionalIncludeConditions(Set<String> includePaths)String[]getAdditionalPaths()Returns theabsPathsparameter of the filter.EventAggregatorgetAggregator()intgetEventTypes()Returns theeventTypesparameter of the filter.String[]getExcludedPaths()Returns theexcludedPathsparameter of the filter.String[]getIdentifiers()Returns theuuidsparameter of the filter.booleangetIsDeep()Returns theisDeepparameter of the filter.String[]getNodeTypes()Returns thenodeTypeNameparameter of the filter.booleangetNoExternal()Returns thenoExternalparameter of the filter.booleangetNoInternal()Returns thenoInternalparameter of the filter.booleangetNoLocal()Returns thenoLocalparameter of the filter.JackrabbitEventFiltersetAbsPath(String absPath)Sets theabsPathparameter of the filter.JackrabbitEventFiltersetAdditionalPaths(String... absPaths)Sets theabsPathsparameter of the filter.JackrabbitEventFiltersetEventTypes(int eventTypes)Sets theeventTypesparameter of the filter.JackrabbitEventFiltersetExcludedPaths(String... excludedPaths)Sets theexcludedPathsparameter of the filter.JackrabbitEventFiltersetIdentifiers(String[] identifiers)Sets theidentifiersparameter of the filter.JackrabbitEventFiltersetIsDeep(boolean isDeep)Sets theisDeepparameter of the filter.JackrabbitEventFiltersetNodeTypes(String[] nodeTypeNames)Sets thenodeTypeNamesparameter of the filter.JackrabbitEventFiltersetNoExternal(boolean noExternal)Sets thenoExternalparameter of the filter.JackrabbitEventFiltersetNoInternal(boolean noInternal)Sets thenoInternalparameter of the filter.JackrabbitEventFiltersetNoLocal(boolean noLocal)Sets thenoLocalparameter of the filter.OakEventFilterwithApplyNodeTypeOnSelf()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).OakEventFilterwithIncludeAncestorsRemove()This causes the registration of independent, additional !deep NODE_REMOVED filter-conditions of all parents of the include paths (both normal and glob).OakEventFilterwithIncludeGlobPaths(String... globPaths)Adds the provided glob paths to the set of include paths.OakEventFilterwithIncludeSubtreeOnRemove()This flag causes remove events to be sent for all nodes and properties of an entire subtree (hence use with care!).OakEventFilterwithNodeTypeAggregate(String[] nodeTypes, 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.ConditionwrapMainCondition(FilterBuilder.Condition mainCondition, FilterBuilder filterBuilder, PermissionProviderFactory permissionProviderFactory)
-
-
-
Constructor Detail
-
OakEventFilterImpl
public OakEventFilterImpl(@NotNull @NotNull JackrabbitEventFilter delegate)
-
-
Method Detail
-
getAbsPath
public String getAbsPath()
Description copied from class:JackrabbitEventFilterReturns theabsPathparameter of the filter.- Overrides:
getAbsPathin classJackrabbitEventFilter- Returns:
- a
String.
-
setAbsPath
public JackrabbitEventFilter setAbsPath(String absPath)
Description copied from class:JackrabbitEventFilterSets theabsPathparameter of the filter. If left unset, this parameter defaults tonull.- Overrides:
setAbsPathin classJackrabbitEventFilter- Parameters:
absPath- an absolute pathString.- Returns:
- This EventFilter object with the
absPathparameter set.
-
getAdditionalPaths
public String[] getAdditionalPaths()
Description copied from class:JackrabbitEventFilterReturns theabsPathsparameter of the filter.- Overrides:
getAdditionalPathsin classJackrabbitEventFilter- Returns:
- a
Stringarray.
-
setAdditionalPaths
public JackrabbitEventFilter setAdditionalPaths(String... absPaths)
Description copied from class:JackrabbitEventFilterSets theabsPathsparameter of the filter. If left unset, this parameter defaults to an empty array.- Overrides:
setAdditionalPathsin classJackrabbitEventFilter- Parameters:
absPaths- an absolute pathStringarray.- Returns:
- This EventFilter object with the
absPathsparameter set.
-
getEventTypes
public int getEventTypes()
Description copied from class:JackrabbitEventFilterReturns theeventTypesparameter of the filter.- Overrides:
getEventTypesin classJackrabbitEventFilter- Returns:
- an
int.
-
setEventTypes
public JackrabbitEventFilter setEventTypes(int eventTypes)
Description copied from class:JackrabbitEventFilterSets theeventTypesparameter of the filter. If left unset, this parameter defaults to0.- Overrides:
setEventTypesin classJackrabbitEventFilter- Parameters:
eventTypes- anint.- Returns:
- This EventFilter object with the
eventTypesparameter set.
-
getExcludedPaths
public String[] getExcludedPaths()
Description copied from class:JackrabbitEventFilterReturns theexcludedPathsparameter of the filter.- Overrides:
getExcludedPathsin classJackrabbitEventFilter- Returns:
- a
Stringarray.
-
setExcludedPaths
public JackrabbitEventFilter setExcludedPaths(String... excludedPaths)
Description copied from class:JackrabbitEventFilterSets theexcludedPathsparameter of the filter. If left unset, this parameter defaults to an empty array.- Overrides:
setExcludedPathsin classJackrabbitEventFilter- Parameters:
excludedPaths- an absolute pathStringarray.- Returns:
- This EventFilter object with the
excludedPathsparameter set.
-
getIdentifiers
public String[] getIdentifiers()
Description copied from class:JackrabbitEventFilterReturns theuuidsparameter of the filter.- Overrides:
getIdentifiersin classJackrabbitEventFilter- Returns:
- a
Stringarray.
-
setIdentifiers
public JackrabbitEventFilter setIdentifiers(String[] identifiers)
Description copied from class:JackrabbitEventFilterSets theidentifiersparameter of the filter. If left unset, this parameter defaults tonull.- Overrides:
setIdentifiersin classJackrabbitEventFilter- Parameters:
identifiers- aStringarray.- Returns:
- This EventFilter object with the
identifiersparameter set.
-
getIsDeep
public boolean getIsDeep()
Description copied from class:JackrabbitEventFilterReturns theisDeepparameter of the filter.- Overrides:
getIsDeepin classJackrabbitEventFilter- Returns:
- a
boolean.
-
setIsDeep
public JackrabbitEventFilter setIsDeep(boolean isDeep)
Description copied from class:JackrabbitEventFilterSets theisDeepparameter of the filter. If left unset, this parameter defaults tofalse.- Overrides:
setIsDeepin classJackrabbitEventFilter- Parameters:
isDeep- aboolean.- Returns:
- This EventFilter object with the
isDeepparameter set.
-
getNodeTypes
public String[] getNodeTypes()
Description copied from class:JackrabbitEventFilterReturns thenodeTypeNameparameter of the filter.- Overrides:
getNodeTypesin classJackrabbitEventFilter- Returns:
- a
Stringarray.
-
setNodeTypes
public JackrabbitEventFilter setNodeTypes(String[] nodeTypeNames)
Description copied from class:JackrabbitEventFilterSets thenodeTypeNamesparameter of the filter. If left unset, this parameter defaults tonull.- Overrides:
setNodeTypesin classJackrabbitEventFilter- Parameters:
nodeTypeNames- aStringarray.- Returns:
- This EventFilter object with the
nodeTypesparameter set.
-
getNoExternal
public boolean getNoExternal()
Description copied from class:JackrabbitEventFilterReturns thenoExternalparameter of the filter.- Overrides:
getNoExternalin classJackrabbitEventFilter- Returns:
- a
boolean.
-
setNoExternal
public JackrabbitEventFilter setNoExternal(boolean noExternal)
Description copied from class:JackrabbitEventFilterSets thenoExternalparameter of the filter. If left unset, this parameter defaults tofalse.- Overrides:
setNoExternalin classJackrabbitEventFilter- Parameters:
noExternal- aboolean.- Returns:
- This EventFilter object with the
noExternalparameter set.
-
getNoInternal
public boolean getNoInternal()
Description copied from class:JackrabbitEventFilterReturns thenoInternalparameter of the filter.- Overrides:
getNoInternalin classJackrabbitEventFilter- Returns:
- a
boolean.
-
setNoInternal
public JackrabbitEventFilter setNoInternal(boolean noInternal)
Description copied from class:JackrabbitEventFilterSets thenoInternalparameter of the filter. If left unset, this parameter defaults tofalse.- Overrides:
setNoInternalin classJackrabbitEventFilter- Parameters:
noInternal- aboolean.- Returns:
- This EventFilter object with the
noExternalparameter set.
-
getNoLocal
public boolean getNoLocal()
Description copied from class:JackrabbitEventFilterReturns thenoLocalparameter of the filter.- Overrides:
getNoLocalin classJackrabbitEventFilter- Returns:
- a
boolean.
-
setNoLocal
public JackrabbitEventFilter setNoLocal(boolean noLocal)
Description copied from class:JackrabbitEventFilterSets thenoLocalparameter of the filter. If left unset, this parameter defaults tofalse.- Overrides:
setNoLocalin classJackrabbitEventFilter- Parameters:
noLocal- aboolean.- Returns:
- This EventFilter object with the
noLocalparameter set.
-
withApplyNodeTypeOnSelf
public OakEventFilter withApplyNodeTypeOnSelf()
Description copied from class:OakEventFilterThis 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:
withApplyNodeTypeOnSelfin classOakEventFilter- Returns:
- this filter with the filter change applied
-
withIncludeAncestorsRemove
public OakEventFilter withIncludeAncestorsRemove()
Description copied from class:OakEventFilterThis 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/!deepflag 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:
withIncludeAncestorsRemovein 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:OakEventFilterThis 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:
withIncludeSubtreeOnRemovein classOakEventFilter- Returns:
- this filter with the filter change applied
-
withIncludeGlobPaths
public OakEventFilter withIncludeGlobPaths(String... globPaths)
Description copied from class:OakEventFilterAdds 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:
withIncludeGlobPathsin 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(Set<String> includePaths)
-
getAggregator
public EventAggregator getAggregator()
-
withNodeTypeAggregate
public OakEventFilter withNodeTypeAggregate(String[] nodeTypes, String[] relativeGlobPaths)
Description copied from class:OakEventFilterGreedy 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:
withNodeTypeAggregatein 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
-
-