Class DefaultWorkspaceFilter
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter
-
- All Implemented Interfaces:
Dumpable
,WorkspaceFilter
- Direct Known Subclasses:
ScopedWorkspaceFilter
public class DefaultWorkspaceFilter extends Object implements Dumpable, WorkspaceFilter
Holds a list ofPathFilterSet
s.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_VERSION
static double
SUPPORTED_VERSION
protected double
version
-
Constructor Summary
Constructors Constructor Description DefaultWorkspaceFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(PathFilterSet set)
Add a #PathFilterSet for nodes items.void
add(PathFilterSet nodeFilter, PathFilterSet propFilter)
Add a #PathFilterSet for node and property items.void
addPropertyFilterSet(PathFilterSet set)
Deprecated.useadd(PathFilterSet, PathFilterSet)
instead.boolean
contains(String path)
Checks if the given node path is contained (and by that also covered) in this workspace filter.boolean
covers(String path)
Checks if the given node path is covered in this workspace filter.void
dump(DumpContext ctx, boolean isLast)
Dumps some human readable information using the given context.void
dumpCoverage(Node rootNode, ProgressTrackerListener listener)
Dumps the coverage of this filter against the given node to the listener.void
dumpCoverage(Session session, ProgressTrackerListener listener, boolean skipJcrContent)
Dumps the coverage of this filter using the given session.boolean
equals(Object obj)
PathFilterSet
getCoveringFilterSet(String path)
Returns the filter set that covers the respective node pathList<PathFilterSet>
getFilterSets()
Returns a list of path filter sets for node items.ImportMode
getImportMode(String path)
Returns the import mode for the given node path.List<PathFilterSet>
getPropertyFilterSets()
Returns a list of path filter sets for property items.InputStream
getSource()
Returns the source xml that constructs this filter It is the obligation of the caller to close the returned input stream.String
getSourceAsString()
Returns the source xml that constructs this filterint
hashCode()
boolean
includesProperty(String propertyPath)
Tests if the given workspace filter includes the given property.boolean
isAncestor(String path)
Checks if the given node path is an ancestor of any of the filter sets.boolean
isGloballyIgnored(String path)
Checks if the given node path is globally ignored.void
load(File file)
Loads the workspace filter from the given filevoid
load(InputStream in)
Loads the workspace filter from the given input source.void
load(Element doc)
protected PathFilter
readFilter(Element elem)
void
resetSource()
Resets the source content to a null state.void
setGlobalIgnored(PathFilter ignored)
void
setImportMode(ImportMode importMode)
String
toString()
WorkspaceFilter
translate(PathMapping mapping)
Translates this workspace filter using the given path mapping.
-
-
-
Field Detail
-
ATTR_VERSION
public static final String ATTR_VERSION
- See Also:
- Constant Field Values
-
SUPPORTED_VERSION
public static final double SUPPORTED_VERSION
- See Also:
- Constant Field Values
-
version
protected double version
-
-
Method Detail
-
add
public void add(PathFilterSet set)
Add a #PathFilterSet for nodes items.- Parameters:
set
- the set of filters to add.
-
add
public void add(PathFilterSet nodeFilter, PathFilterSet propFilter)
Add a #PathFilterSet for node and property items.- Parameters:
nodeFilter
- the set of filters to add.propFilter
- the set of filters to add.
-
addPropertyFilterSet
@Deprecated public void addPropertyFilterSet(PathFilterSet set)
Deprecated.useadd(PathFilterSet, PathFilterSet)
instead.Add a #PathFilterSet for properties items.- Parameters:
set
- the set of filters to add.
-
getFilterSets
public List<PathFilterSet> getFilterSets()
Returns a list of path filter sets for node items.- Specified by:
getFilterSets
in interfaceWorkspaceFilter
- Returns:
- the list of path filter sets.
-
getPropertyFilterSets
public List<PathFilterSet> getPropertyFilterSets()
Returns a list of path filter sets for property items.- Specified by:
getPropertyFilterSets
in interfaceWorkspaceFilter
- Returns:
- the list of path filter sets.
-
getCoveringFilterSet
public PathFilterSet getCoveringFilterSet(String path)
Returns the filter set that covers the respective node path- Specified by:
getCoveringFilterSet
in interfaceWorkspaceFilter
- Parameters:
path
- the path- Returns:
- the filter set or
null
-
getImportMode
public ImportMode getImportMode(String path)
Returns the import mode for the given node path.- Specified by:
getImportMode
in interfaceWorkspaceFilter
- Parameters:
path
- path to check- Returns:
- the import mode or
ImportMode.REPLACE
if the given path is not covered by this filter.
-
setImportMode
public void setImportMode(ImportMode importMode)
-
contains
public boolean contains(String path)
Checks if the given node path is contained (and by that also covered) in this workspace filter. It returnstrue
if any of the filter sets contain the path and it's not globally ignored.If
WorkspaceFilter.contains(String)
returnstrue
for one path, alsoWorkspaceFilter.covers(String)
would returntrue
for the same path, but not vice-versa.- Specified by:
contains
in interfaceWorkspaceFilter
- Parameters:
path
- to check- Returns:
true
if the given path is included in this filter.
-
covers
public boolean covers(String path)
Checks if the given node path is covered in this workspace filter. It only returnstrue
if at least one of the sets covers the path and is not globally ignored.Still
WorkspaceFilter.contains(String)
might returnfalse
for the same path in case there is some exclusion patterns matching the given path.- Specified by:
covers
in interfaceWorkspaceFilter
- Parameters:
path
- the path to check- Returns:
true
if the given path is covered by this filter.
-
includesProperty
public boolean includesProperty(String propertyPath)
Description copied from interface:WorkspaceFilter
Tests if the given workspace filter includes the given property. If the filter does not cover the property, it returnstrue
.- Specified by:
includesProperty
in interfaceWorkspaceFilter
- Parameters:
propertyPath
- the path to the property- Returns:
true
if the property is included in the filter
-
isAncestor
public boolean isAncestor(String path)
Checks if the given node path is an ancestor of any of the filter sets.- Specified by:
isAncestor
in interfaceWorkspaceFilter
- Parameters:
path
- the item to check- Returns:
true
if the given item is an ancestor
-
isGloballyIgnored
public boolean isGloballyIgnored(String path)
Checks if the given node path is globally ignored.- Specified by:
isGloballyIgnored
in interfaceWorkspaceFilter
- Parameters:
path
- the path to check.- Returns:
true
if the item is globally ignored.
-
translate
public WorkspaceFilter translate(PathMapping mapping)
Translates this workspace filter using the given path mapping.- Specified by:
translate
in interfaceWorkspaceFilter
- Parameters:
mapping
- the path mapping- Returns:
- a new workspace filter
-
load
public void load(File file) throws IOException, ConfigurationException
Loads the workspace filter from the given file- Parameters:
file
- source- Throws:
ConfigurationException
- if the source is not validIOException
- if an I/O error occurs
-
getSource
public InputStream getSource()
Returns the source xml that constructs this filter It is the obligation of the caller to close the returned input stream.- Specified by:
getSource
in interfaceWorkspaceFilter
- Returns:
- the source xml
-
getSourceAsString
public String getSourceAsString()
Returns the source xml that constructs this filter- Specified by:
getSourceAsString
in interfaceWorkspaceFilter
- Returns:
- the source xml
-
load
public void load(InputStream in) throws IOException, ConfigurationException
Loads the workspace filter from the given input source.The specified stream remains open after this method returns.
- Parameters:
in
- source- Throws:
ConfigurationException
- if the source is not validIOException
- if an I/O error occurs
-
load
public void load(Element doc) throws ConfigurationException
- Throws:
ConfigurationException
-
readFilter
protected PathFilter readFilter(Element elem) throws ConfigurationException
- Throws:
ConfigurationException
-
dump
public void dump(DumpContext ctx, boolean isLast)
Dumps some human readable information using the given context.
-
resetSource
public void resetSource()
Resets the source content to a null state. This leads to generating the source from scratch if necessary. Is called implicitly for every modifying operation (add(PathFilterSet)
,add(PathFilterSet, PathFilterSet)
,addPropertyFilterSet(PathFilterSet)
,load(Element)
,load(InputStream)
andload(File)
).
-
setGlobalIgnored
public void setGlobalIgnored(PathFilter ignored)
-
dumpCoverage
public void dumpCoverage(Node rootNode, ProgressTrackerListener listener) throws RepositoryException
Dumps the coverage of this filter against the given node to the listener.- Specified by:
dumpCoverage
in interfaceWorkspaceFilter
- Parameters:
rootNode
- root nodelistener
- listener which receives coverage information- Throws:
RepositoryException
- if an error occurs
-
dumpCoverage
public void dumpCoverage(Session session, ProgressTrackerListener listener, boolean skipJcrContent) throws RepositoryException
Dumps the coverage of this filter using the given session. IfskipJcrContent
istrue
the jcr:content nodes are excluded from traversal and reporting.- Specified by:
dumpCoverage
in interfaceWorkspaceFilter
- Parameters:
session
- sessionlistener
- listener which receives coverage informationskipJcrContent
-true
to skip jcr:content nodes- Throws:
RepositoryException
- if an error occurs
-
-