Package org.eclipse.jetty.util
Class PathWatcher.Config
- java.lang.Object
-
- org.eclipse.jetty.util.PathWatcher.Config
-
- All Implemented Interfaces:
java.util.function.Predicate<java.nio.file.Path>
- Enclosing class:
- PathWatcher
public static class PathWatcher.Config extends java.lang.Object implements java.util.function.Predicate<java.nio.file.Path>
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanexcludeHiddenprotected IncludeExcludeSet<java.nio.file.PathMatcher,java.nio.file.Path>includeExcludeprotected PathWatcher.Configparentprotected java.nio.file.Pathpathprotected longpauseUntilprotected intrecurseDepthstatic intUNLIMITED_DEPTH
-
Constructor Summary
Constructors Constructor Description Config(java.nio.file.Path path)Config(java.nio.file.Path path, PathWatcher.Config parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExclude(java.lang.String syntaxAndPattern)Add an exclude PathMatcher.voidaddExclude(java.nio.file.PathMatcher matcher)Add an exclude PathMatchervoidaddExcludeGlobRelative(java.lang.String pattern)Add aglob:syntax pattern exclude reference in a directory relative, os neutral, pattern.voidaddExcludeHidden()Exclude hidden files and hidden directoriesvoidaddExcludes(java.util.List<java.lang.String> syntaxAndPatterns)Add multiple exclude PathMatchersvoidaddInclude(java.lang.String syntaxAndPattern)Add an include PathMatchervoidaddInclude(java.nio.file.PathMatcher matcher)Add an include PathMatchervoidaddIncludeGlobRelative(java.lang.String pattern)Add aglob:syntax pattern reference in a directory relative, os neutral, pattern.voidaddIncludes(java.util.List<java.lang.String> syntaxAndPatterns)Add multiple include PathMatchersPathWatcher.ConfigasSubConfig(java.nio.file.Path dir)Build a new config from a this configuration.PathWatcher.ConfiggetParent()java.nio.file.PathgetPath()intgetRecurseDepth()booleanisHidden(java.nio.file.Path path)booleanisPaused(long now)booleanisRecurseDepthUnlimited()java.nio.file.Pathresolve(java.nio.file.Path path)voidsetPauseUntil(long time)voidsetRecurseDepth(int depth)Set the recurse depth for the directory scanning.booleantest(java.nio.file.Path path)java.lang.StringtoShortPath(java.nio.file.Path path)java.lang.StringtoString()
-
-
-
Field Detail
-
UNLIMITED_DEPTH
public static final int UNLIMITED_DEPTH
- See Also:
- Constant Field Values
-
parent
protected final PathWatcher.Config parent
-
path
protected final java.nio.file.Path path
-
includeExclude
protected final IncludeExcludeSet<java.nio.file.PathMatcher,java.nio.file.Path> includeExclude
-
recurseDepth
protected int recurseDepth
-
excludeHidden
protected boolean excludeHidden
-
pauseUntil
protected long pauseUntil
-
-
Constructor Detail
-
Config
public Config(java.nio.file.Path path)
-
Config
public Config(java.nio.file.Path path, PathWatcher.Config parent)
-
-
Method Detail
-
getParent
public PathWatcher.Config getParent()
-
setPauseUntil
public void setPauseUntil(long time)
-
isPaused
public boolean isPaused(long now)
-
addExclude
public void addExclude(java.nio.file.PathMatcher matcher)
Add an exclude PathMatcher- Parameters:
matcher- the path matcher for this exclude
-
addExclude
public void addExclude(java.lang.String syntaxAndPattern)
Add an exclude PathMatcher.Note: this pattern is FileSystem specific (so use "/" for Linux and OSX, and "\\" for Windows)
- Parameters:
syntaxAndPattern- the PathMatcher syntax and pattern to use- See Also:
for detail on syntax and pattern
-
addExcludeGlobRelative
public void addExcludeGlobRelative(java.lang.String pattern)
Add aglob:syntax pattern exclude reference in a directory relative, os neutral, pattern.On Linux: Config config = new Config(Path("/home/user/example")); config.addExcludeGlobRelative("*.war") => "glob:/home/user/example/*.war" On Windows Config config = new Config(Path("D:/code/examples")); config.addExcludeGlobRelative("*.war") => "glob:D:\\code\\examples\\*.war"- Parameters:
pattern- the pattern, in unixy format, relative to config.dir
-
addExcludeHidden
public void addExcludeHidden()
Exclude hidden files and hidden directories
-
addExcludes
public void addExcludes(java.util.List<java.lang.String> syntaxAndPatterns)
Add multiple exclude PathMatchers- Parameters:
syntaxAndPatterns- the list of PathMatcher syntax and patterns to use- See Also:
for detail on syntax and pattern
-
addInclude
public void addInclude(java.nio.file.PathMatcher matcher)
Add an include PathMatcher- Parameters:
matcher- the path matcher for this include
-
addInclude
public void addInclude(java.lang.String syntaxAndPattern)
Add an include PathMatcher- Parameters:
syntaxAndPattern- the PathMatcher syntax and pattern to use- See Also:
for detail on syntax and pattern
-
addIncludeGlobRelative
public void addIncludeGlobRelative(java.lang.String pattern)
Add aglob:syntax pattern reference in a directory relative, os neutral, pattern.On Linux: Config config = new Config(Path("/home/user/example")); config.addIncludeGlobRelative("*.war") => "glob:/home/user/example/*.war" On Windows Config config = new Config(Path("D:/code/examples")); config.addIncludeGlobRelative("*.war") => "glob:D:\\code\\examples\\*.war"- Parameters:
pattern- the pattern, in unixy format, relative to config.dir
-
addIncludes
public void addIncludes(java.util.List<java.lang.String> syntaxAndPatterns)
Add multiple include PathMatchers- Parameters:
syntaxAndPatterns- the list of PathMatcher syntax and patterns to use- See Also:
for detail on syntax and pattern
-
asSubConfig
public PathWatcher.Config asSubConfig(java.nio.file.Path dir)
Build a new config from a this configuration.Useful for working with sub-directories that also need to be watched.
- Parameters:
dir- the directory to build new Config from (using this config as source of includes/excludes)- Returns:
- the new Config
-
getRecurseDepth
public int getRecurseDepth()
-
isRecurseDepthUnlimited
public boolean isRecurseDepthUnlimited()
-
getPath
public java.nio.file.Path getPath()
-
resolve
public java.nio.file.Path resolve(java.nio.file.Path path)
-
test
public boolean test(java.nio.file.Path path)
- Specified by:
testin interfacejava.util.function.Predicate<java.nio.file.Path>
-
setRecurseDepth
public void setRecurseDepth(int depth)
Set the recurse depth for the directory scanning.-999 indicates arbitrarily deep recursion, 0 indicates no recursion, 1 is only one directory deep, and so on.
- Parameters:
depth- the number of directories deep to recurse
-
isHidden
public boolean isHidden(java.nio.file.Path path)
-
toShortPath
public java.lang.String toShortPath(java.nio.file.Path path)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-