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 java.lang.Object implements Dumpable, WorkspaceFilter
Holds a list ofPathFilterSets.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTR_VERSIONstatic doubleSUPPORTED_VERSION
-
Constructor Summary
Constructors Constructor Description DefaultWorkspaceFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(PathFilterSet set)Add a #PathFilterSet for nodes items.voidadd(PathFilterSet nodeFilter, PathFilterSet propFilter)Add a #PathFilterSet for node and property items.voidaddPropertyFilterSet(PathFilterSet set)Deprecated.useadd(PathFilterSet, PathFilterSet)instead.booleancontains(java.lang.String path)Checks if the given node path is contained in this workspace filter.booleancovers(java.lang.String path)Checks if the given node path is covered in this workspace filter.voiddump(DumpContext ctx, boolean isLast)Dumps some human readable information using the given context.voiddumpCoverage(Node rootNode, ProgressTrackerListener listener)Dumps the coverage of this filter against the given node to the listener.voiddumpCoverage(Session session, ProgressTrackerListener listener, boolean skipJcrContent)Dumps the coverage of this filter using the given session.booleanequals(java.lang.Object obj)PathFilterSetgetCoveringFilterSet(java.lang.String path)Returns the filter set that covers the respective node pathjava.util.List<PathFilterSet>getFilterSets()Returns a list of path filter sets for node items.ImportModegetImportMode(java.lang.String path)Returns the import mode for the given node path.java.util.List<PathFilterSet>getPropertyFilterSets()Returns a list of path filter sets for property items.java.io.InputStreamgetSource()Returns the source xml that constructs this filter It is the obligation of the caller to close the returned input stream.java.lang.StringgetSourceAsString()Returns the source xml that constructs this filterinthashCode()booleanisAncestor(java.lang.String path)Checks if the given node path is an ancestor of any of the filter sets.booleanisGloballyIgnored(java.lang.String path)Checks if the given node path is globally ignored.voidload(java.io.File file)Loads the workspace filter from the given filevoidload(java.io.InputStream in)Loads the workspace filter from the given input source.voidload(org.w3c.dom.Element doc)voidresetSource()Reset the source content to a null state.voidsetGlobalIgnored(PathFilter ignored)voidsetImportMode(ImportMode importMode)java.lang.StringtoString()WorkspaceFiltertranslate(PathMapping mapping)Translates this workspace filter using the given path mapping.
-
-
-
Field Detail
-
ATTR_VERSION
public static final java.lang.String ATTR_VERSION
- See Also:
- Constant Field Values
-
SUPPORTED_VERSION
public static final double SUPPORTED_VERSION
- See Also:
- Constant Field Values
-
-
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 java.util.List<PathFilterSet> getFilterSets()
Returns a list of path filter sets for node items.- Specified by:
getFilterSetsin interfaceWorkspaceFilter- Returns:
- the list of path filter sets.
-
getPropertyFilterSets
public java.util.List<PathFilterSet> getPropertyFilterSets()
Returns a list of path filter sets for property items.- Specified by:
getPropertyFilterSetsin interfaceWorkspaceFilter- Returns:
- the list of path filter sets.
-
getCoveringFilterSet
public PathFilterSet getCoveringFilterSet(java.lang.String path)
Returns the filter set that covers the respective node path- Specified by:
getCoveringFilterSetin interfaceWorkspaceFilter- Parameters:
path- the path- Returns:
- the filter set or
null
-
getImportMode
public ImportMode getImportMode(java.lang.String path)
Returns the import mode for the given node path.- Specified by:
getImportModein interfaceWorkspaceFilter- Parameters:
path- path to check- Returns:
- the import mode or
ImportMode.REPLACEif the given path is not covered by this filter.
-
setImportMode
public void setImportMode(ImportMode importMode)
-
contains
public boolean contains(java.lang.String path)
Checks if the given node path is contained in this workspace filter. It returnstrueif any of the filter sets contain the path and it's not globally ignored.- Specified by:
containsin interfaceWorkspaceFilter- Parameters:
path- to check- Returns:
trueif the given path is included in this filter.
-
covers
public boolean covers(java.lang.String path)
Checks if the given node path is covered in this workspace filter. It only returnstrueif at least one of the sets covers the path and is not globally ignored.- Specified by:
coversin interfaceWorkspaceFilter- Parameters:
path- the pathto check- Returns:
trueif the given path is covered by this filter.
-
isAncestor
public boolean isAncestor(java.lang.String path)
Checks if the given node path is an ancestor of any of the filter sets.- Specified by:
isAncestorin interfaceWorkspaceFilter- Parameters:
path- the item to check- Returns:
trueif the given item is an ancestor
-
isGloballyIgnored
public boolean isGloballyIgnored(java.lang.String path)
Checks if the given node path is globally ignored.- Specified by:
isGloballyIgnoredin interfaceWorkspaceFilter- Parameters:
path- the path to check.- Returns:
trueif the item is globally ignored.
-
translate
public WorkspaceFilter translate(PathMapping mapping)
Translates this workspace filter using the given path mapping.- Specified by:
translatein interfaceWorkspaceFilter- Parameters:
mapping- the path mapping- Returns:
- a new workspace filter
-
load
public void load(java.io.File file) throws java.io.IOException, ConfigurationExceptionLoads the workspace filter from the given file- Parameters:
file- source- Throws:
ConfigurationException- if the source is not validjava.io.IOException- if an I/O error occurs
-
getSource
public java.io.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:
getSourcein interfaceWorkspaceFilter- Returns:
- the source xml
-
getSourceAsString
public java.lang.String getSourceAsString()
Returns the source xml that constructs this filter- Specified by:
getSourceAsStringin interfaceWorkspaceFilter- Returns:
- the source xml
-
load
public void load(java.io.InputStream in) throws java.io.IOException, ConfigurationExceptionLoads 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 validjava.io.IOException- if an I/O error occurs
-
load
public void load(org.w3c.dom.Element doc) 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()
Reset the source content to a null state.
-
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:
dumpCoveragein interfaceWorkspaceFilter- Parameters:
rootNode- root nodelistener- listener- 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. The traversal starts at the common ancestor of all filter sets. IfskipJcrContentistruethe jcr:content nodes are excluded from traversal and reporting.- Specified by:
dumpCoveragein interfaceWorkspaceFilter- Parameters:
session- sessionlistener- listener to report progressskipJcrContent-trueto skip jcr:content nodes- Throws:
RepositoryException- if an error occurs
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-