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 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)
Add a #PathFilterSet for properties items.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.static ScopedWorkspaceFilter
createApplicationScoped(DefaultWorkspaceFilter base)
static ScopedWorkspaceFilter
createContentScoped(DefaultWorkspaceFilter base)
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.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 filterboolean
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.protected PathFilter
readFilter(Element elem)
void
resetSource()
Resets the source content to a null state.void
setGlobalIgnored(PathFilter ignored)
void
setImportMode(ImportMode importMode)
WorkspaceFilter
translate(PathMapping mapping)
Translates this workspace filter using the given path mapping.-
Methods inherited from class org.apache.jackrabbit.vault.fs.config.DefaultWorkspaceFilter
equals, 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:DefaultWorkspaceFilter
Add a #PathFilterSet for nodes items.- Overrides:
add
in classDefaultWorkspaceFilter
- Parameters:
set
- the set of filters to add.
-
add
public void add(PathFilterSet nodeFilter, PathFilterSet propFilter)
Description copied from class:DefaultWorkspaceFilter
Add a #PathFilterSet for node and property items.- Overrides:
add
in 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:DefaultWorkspaceFilter
Add a #PathFilterSet for properties items.- Overrides:
addPropertyFilterSet
in classDefaultWorkspaceFilter
- Parameters:
set
- the set of filters to add.
-
getFilterSets
public List<PathFilterSet> getFilterSets()
Description copied from class:DefaultWorkspaceFilter
Returns a list of path filter sets for node items.- Specified by:
getFilterSets
in interfaceWorkspaceFilter
- Overrides:
getFilterSets
in classDefaultWorkspaceFilter
- Returns:
- the list of path filter sets.
-
getPropertyFilterSets
public List<PathFilterSet> getPropertyFilterSets()
Description copied from class:DefaultWorkspaceFilter
Returns a list of path filter sets for property items.- Specified by:
getPropertyFilterSets
in interfaceWorkspaceFilter
- Overrides:
getPropertyFilterSets
in classDefaultWorkspaceFilter
- Returns:
- the list of path filter sets.
-
getCoveringFilterSet
public PathFilterSet getCoveringFilterSet(String path)
Description copied from class:DefaultWorkspaceFilter
Returns the filter set that covers the respective node path- Specified by:
getCoveringFilterSet
in interfaceWorkspaceFilter
- Overrides:
getCoveringFilterSet
in classDefaultWorkspaceFilter
- Parameters:
path
- the path- Returns:
- the filter set or
null
-
getImportMode
public ImportMode getImportMode(String path)
Description copied from class:DefaultWorkspaceFilter
Returns the import mode for the given node path.- Specified by:
getImportMode
in interfaceWorkspaceFilter
- Overrides:
getImportMode
in classDefaultWorkspaceFilter
- 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)
- Overrides:
setImportMode
in classDefaultWorkspaceFilter
-
contains
public boolean contains(String path)
Description copied from class:DefaultWorkspaceFilter
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
- Overrides:
contains
in classDefaultWorkspaceFilter
- Parameters:
path
- to check- Returns:
true
if the given path is included in this filter.
-
covers
public boolean covers(String path)
Description copied from class:DefaultWorkspaceFilter
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
- Overrides:
covers
in classDefaultWorkspaceFilter
- Parameters:
path
- the path to check- Returns:
true
if the given path is covered by this filter.
-
isAncestor
public boolean isAncestor(String path)
Description copied from class:DefaultWorkspaceFilter
Checks if the given node path is an ancestor of any of the filter sets.- Specified by:
isAncestor
in interfaceWorkspaceFilter
- Overrides:
isAncestor
in classDefaultWorkspaceFilter
- Parameters:
path
- the item to check- Returns:
true
if the given item is an ancestor
-
isGloballyIgnored
public boolean isGloballyIgnored(String path)
Description copied from class:DefaultWorkspaceFilter
Checks if the given node path is globally ignored.- Specified by:
isGloballyIgnored
in interfaceWorkspaceFilter
- Overrides:
isGloballyIgnored
in classDefaultWorkspaceFilter
- Parameters:
path
- the path to check.- Returns:
true
if the item is globally ignored.
-
translate
public WorkspaceFilter translate(PathMapping mapping)
Description copied from class:DefaultWorkspaceFilter
Translates this workspace filter using the given path mapping.- Specified by:
translate
in interfaceWorkspaceFilter
- Overrides:
translate
in classDefaultWorkspaceFilter
- Parameters:
mapping
- the path mapping- Returns:
- a new workspace filter
-
load
public void load(File file) throws IOException, ConfigurationException
Description copied from class:DefaultWorkspaceFilter
Loads the workspace filter from the given file- Overrides:
load
in 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:DefaultWorkspaceFilter
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
- Overrides:
getSource
in classDefaultWorkspaceFilter
- Returns:
- the source xml
-
getSourceAsString
public String getSourceAsString()
Description copied from class:DefaultWorkspaceFilter
Returns the source xml that constructs this filter- Specified by:
getSourceAsString
in interfaceWorkspaceFilter
- Overrides:
getSourceAsString
in classDefaultWorkspaceFilter
- Returns:
- the source xml
-
load
public void load(InputStream in) throws IOException, ConfigurationException
Description copied from class:DefaultWorkspaceFilter
Loads the workspace filter from the given input source.The specified stream remains open after this method returns.
- Overrides:
load
in 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:
readFilter
in classDefaultWorkspaceFilter
- Throws:
ConfigurationException
-
dump
public void dump(DumpContext ctx, boolean isLast)
Description copied from class:DefaultWorkspaceFilter
Dumps some human readable information using the given context.- Specified by:
dump
in interfaceDumpable
- Overrides:
dump
in 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:DefaultWorkspaceFilter
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 (DefaultWorkspaceFilter.add(PathFilterSet)
,DefaultWorkspaceFilter.add(PathFilterSet, PathFilterSet)
,DefaultWorkspaceFilter.addPropertyFilterSet(PathFilterSet)
,DefaultWorkspaceFilter.load(Element)
,DefaultWorkspaceFilter.load(InputStream)
andDefaultWorkspaceFilter.load(File)
).- Overrides:
resetSource
in classDefaultWorkspaceFilter
-
setGlobalIgnored
public void setGlobalIgnored(PathFilter ignored)
- Overrides:
setGlobalIgnored
in classDefaultWorkspaceFilter
-
dumpCoverage
public void dumpCoverage(Node rootNode, ProgressTrackerListener listener) throws RepositoryException
Description copied from class:DefaultWorkspaceFilter
Dumps the coverage of this filter against the given node to the listener.- Specified by:
dumpCoverage
in interfaceWorkspaceFilter
- Overrides:
dumpCoverage
in 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:DefaultWorkspaceFilter
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
- Overrides:
dumpCoverage
in classDefaultWorkspaceFilter
- Parameters:
session
- sessionlistener
- listener which receives coverage informationskipJcrContent
-true
to skip jcr:content nodes- Throws:
RepositoryException
- if an error occurs
-
-