use of java.nio.file.PathMatcher in project heron by twitter.
the class TopologyUtils method lookUpTopologyDefnFile.
public static String lookUpTopologyDefnFile(String dir, String filename) {
String pattern = String.format("glob:%s/%s.defn", dir, filename);
PathMatcher matcher = FileSystems.getDefault().getPathMatcher(pattern);
for (File file : new File(dir).listFiles()) {
if (matcher.matches(file.toPath())) {
// We would return the first one matched
return file.getPath();
}
}
throw new IllegalStateException("Failed to find topology defn file");
}
use of java.nio.file.PathMatcher in project winery by eclipse.
the class CsarImporter method handleExclude.
/**
* Modifies given allFiles object to exclude all files given by the excl pattern
* <p>
* Semantics: Remove all files from the set, which match the given pattern
*/
private void handleExclude(Exclude excl, Path localRoot, Set<Path> allFiles) {
PathMatcher pathMatcher = localRoot.getFileSystem().getPathMatcher("glob:" + excl.getPattern());
allFiles.removeIf(pathMatcher::matches);
}
Aggregations