Class ScopedWorkspaceFilter
- java.lang.Object
-
- org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter
-
- org.apache.jackrabbit.vault.packaging.ScopedWorkspaceFilter
-
- All Implemented Interfaces:
Dumpable,WorkspaceFilter
public class ScopedWorkspaceFilter extends DefaultWorkspaceFilter
Workspace filter wrapper that limits the filter in- or outside certain paths. This is mostly used to limit the scope of mixed content packages to either application or content.
-
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter
ATTR_VERSION, SUPPORTED_VERSION, version
-
-
Constructor Summary
Constructors Constructor Description ScopedWorkspaceFilter(DefaultWorkspaceFilter base, boolean allow, String[] roots)
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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)Add a #PathFilterSet for properties items.booleancontains(String path)Checks if the given node path is contained (and by that also covered) in this workspace filter.booleancovers(String path)Checks if the given node path is covered in this workspace filter.static ScopedWorkspaceFiltercreateApplicationScoped(DefaultWorkspaceFilter base)static ScopedWorkspaceFiltercreateContentScoped(DefaultWorkspaceFilter base)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.PathFilterSetgetCoveringFilterSet(String path)Returns the filter set that covers the respective node pathList<PathFilterSet>getFilterSets()Returns a list of path filter sets for node items.ImportModegetImportMode(String path)Returns the import mode for the given node path.List<PathFilterSet>getPropertyFilterSets()Returns a list of path filter sets for property items.InputStreamgetSource()Returns the source xml that constructs this filter It is the obligation of the caller to close the returned input stream.StringgetSourceAsString()Returns the source xml that constructs this filterbooleanisAncestor(String path)Checks if the given node path is an ancestor of any of the filter sets.booleanisGloballyIgnored(String path)Checks if the given node path is globally ignored.voidload(File file)Loads the workspace filter from the given filevoidload(InputStream in)Loads the workspace filter from the given input source.protected PathFilterreadFilter(Element elem)voidresetSource()Resets the source content to a null state.voidsetGlobalIgnored(PathFilter ignored)voidsetImportMode(ImportMode importMode)WorkspaceFiltertranslate(PathMapping mapping)Translates this workspace filter using the given path mapping.-
Methods inherited from class org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter
equals, getDirectChildNamesTowardsFilterRoots, hashCode, includesProperty, load, toString
-
-
-
-
Constructor Detail
-
ScopedWorkspaceFilter
public ScopedWorkspaceFilter(DefaultWorkspaceFilter base, boolean allow, String[] roots)
-
-
Method Detail
-
createApplicationScoped
public static ScopedWorkspaceFilter createApplicationScoped(DefaultWorkspaceFilter base)
-
createContentScoped
public static ScopedWorkspaceFilter createContentScoped(DefaultWorkspaceFilter base)
-
add
public void add(PathFilterSet set)
Description copied from class:DefaultWorkspaceFilterAdd a #PathFilterSet for nodes items.- Overrides:
addin classDefaultWorkspaceFilter- Parameters:
set- the set of filters to add.
-
add
public void add(PathFilterSet nodeFilter, PathFilterSet propFilter)
Description copied from class:DefaultWorkspaceFilterAdd a #PathFilterSet for node and property items.- Overrides:
addin classDefaultWorkspaceFilter- Parameters:
nodeFilter- the set of filters to add.propFilter- the set of filters to add.
-
addPropertyFilterSet
public void addPropertyFilterSet(PathFilterSet set)
Description copied from class:DefaultWorkspaceFilterAdd a #PathFilterSet for properties items.- Overrides:
addPropertyFilterSetin classDefaultWorkspaceFilter- Parameters:
set- the set of filters to add.
-
getFilterSets
public List<PathFilterSet> getFilterSets()
Description copied from class:DefaultWorkspaceFilterReturns a list of path filter sets for node items.- Specified by:
getFilterSetsin interfaceWorkspaceFilter- Overrides:
getFilterSetsin classDefaultWorkspaceFilter- Returns:
- the list of path filter sets.
-
getPropertyFilterSets
public List<PathFilterSet> getPropertyFilterSets()
Description copied from class:DefaultWorkspaceFilterReturns a list of path filter sets for property items.- Specified by:
getPropertyFilterSetsin interfaceWorkspaceFilter- Overrides:
getPropertyFilterSetsin classDefaultWorkspaceFilter- Returns:
- the list of path filter sets.
-
getCoveringFilterSet
public PathFilterSet getCoveringFilterSet(String path)
Description copied from class:DefaultWorkspaceFilterReturns the filter set that covers the respective node path- Specified by:
getCoveringFilterSetin interfaceWorkspaceFilter- Overrides:
getCoveringFilterSetin classDefaultWorkspaceFilter- Parameters:
path- the path- Returns:
- the filter set or
null
-
getImportMode
public ImportMode getImportMode(String path)
Description copied from class:DefaultWorkspaceFilterReturns the import mode for the given node path.- Specified by:
getImportModein interfaceWorkspaceFilter- Overrides:
getImportModein classDefaultWorkspaceFilter- 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)
- Overrides:
setImportModein classDefaultWorkspaceFilter
-
contains
public boolean contains(String path)
Description copied from class:DefaultWorkspaceFilterChecks if the given node path is contained (and by that also covered) in this workspace filter. It returnstrueif any of the filter sets contain the path and it's not globally ignored.If
WorkspaceFilter.contains(String)returnstruefor one path, alsoWorkspaceFilter.covers(String)would returntruefor the same path, but not vice-versa.- Specified by:
containsin interfaceWorkspaceFilter- Overrides:
containsin classDefaultWorkspaceFilter- Parameters:
path- to check- Returns:
trueif the given path is included in this filter.
-
covers
public boolean covers(String path)
Description copied from class:DefaultWorkspaceFilterChecks 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.Still
WorkspaceFilter.contains(String)might returnfalsefor the same path in case there is some exclusion patterns matching the given path.- Specified by:
coversin interfaceWorkspaceFilter- Overrides:
coversin classDefaultWorkspaceFilter- Parameters:
path- the path to check- Returns:
trueif the given path is covered by this filter.
-
isAncestor
public boolean isAncestor(String path)
Description copied from class:DefaultWorkspaceFilterChecks if the given node path is an ancestor of any of the filter sets.- Specified by:
isAncestorin interfaceWorkspaceFilter- Overrides:
isAncestorin classDefaultWorkspaceFilter- Parameters:
path- the item to check- Returns:
trueif the given item is an ancestor
-
isGloballyIgnored
public boolean isGloballyIgnored(String path)
Description copied from class:DefaultWorkspaceFilterChecks if the given node path is globally ignored.- Specified by:
isGloballyIgnoredin interfaceWorkspaceFilter- Overrides:
isGloballyIgnoredin classDefaultWorkspaceFilter- Parameters:
path- the path to check.- Returns:
trueif the item is globally ignored.
-
translate
public WorkspaceFilter translate(PathMapping mapping)
Description copied from class:DefaultWorkspaceFilterTranslates this workspace filter using the given path mapping.- Specified by:
translatein interfaceWorkspaceFilter- Overrides:
translatein classDefaultWorkspaceFilter- Parameters:
mapping- the path mapping- Returns:
- a new workspace filter
-
load
public void load(File file) throws IOException, ConfigurationException
Description copied from class:DefaultWorkspaceFilterLoads the workspace filter from the given file- Overrides:
loadin classDefaultWorkspaceFilter- Parameters:
file- source- Throws:
IOException- if an I/O error occursConfigurationException- if the source is not valid
-
getSource
public InputStream getSource()
Description copied from class:DefaultWorkspaceFilterReturns the source xml that constructs this filter It is the obligation of the caller to close the returned input stream.- Specified by:
getSourcein interfaceWorkspaceFilter- Overrides:
getSourcein classDefaultWorkspaceFilter- Returns:
- the source xml
-
getSourceAsString
public String getSourceAsString()
Description copied from class:DefaultWorkspaceFilterReturns the source xml that constructs this filter- Specified by:
getSourceAsStringin interfaceWorkspaceFilter- Overrides:
getSourceAsStringin classDefaultWorkspaceFilter- Returns:
- the source xml
-
load
public void load(InputStream in) throws IOException, ConfigurationException
Description copied from class:DefaultWorkspaceFilterLoads the workspace filter from the given input source.The specified stream remains open after this method returns.
- Overrides:
loadin classDefaultWorkspaceFilter- Parameters:
in- source- Throws:
IOException- if an I/O error occursConfigurationException- if the source is not valid
-
readFilter
protected PathFilter readFilter(Element elem) throws ConfigurationException
- Overrides:
readFilterin classDefaultWorkspaceFilter- Throws:
ConfigurationException
-
dump
public void dump(DumpContext ctx, boolean isLast)
Description copied from class:DefaultWorkspaceFilterDumps some human readable information using the given context.- Specified by:
dumpin interfaceDumpable- Overrides:
dumpin classDefaultWorkspaceFilter- Parameters:
ctx- the dump contextisLast- specifies if this is the last element to dump on this level
-
resetSource
public void resetSource()
Description copied from class:DefaultWorkspaceFilterResets the source content to a null state. This leads to generating the source from scratch if necessary. Is called implicitly for every modifying operation (DefaultWorkspaceFilter.add(PathFilterSet),DefaultWorkspaceFilter.add(PathFilterSet, PathFilterSet),DefaultWorkspaceFilter.addPropertyFilterSet(PathFilterSet),DefaultWorkspaceFilter.load(Element),DefaultWorkspaceFilter.load(InputStream)andDefaultWorkspaceFilter.load(File)).- Overrides:
resetSourcein classDefaultWorkspaceFilter
-
setGlobalIgnored
public void setGlobalIgnored(PathFilter ignored)
- Overrides:
setGlobalIgnoredin classDefaultWorkspaceFilter
-
dumpCoverage
public void dumpCoverage(Node rootNode, ProgressTrackerListener listener) throws RepositoryException
Description copied from class:DefaultWorkspaceFilterDumps the coverage of this filter against the given node to the listener.- Specified by:
dumpCoveragein interfaceWorkspaceFilter- Overrides:
dumpCoveragein classDefaultWorkspaceFilter- 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
Description copied from class:DefaultWorkspaceFilterDumps the coverage of this filter using the given session. IfskipJcrContentistruethe jcr:content nodes are excluded from traversal and reporting.- Specified by:
dumpCoveragein interfaceWorkspaceFilter- Overrides:
dumpCoveragein classDefaultWorkspaceFilter- Parameters:
session- sessionlistener- listener which receives coverage informationskipJcrContent-trueto skip jcr:content nodes- Throws:
RepositoryException- if an error occurs
-
-