use of org.apache.commons.collections4.Closure in project archiva by apache.
the class RepositoryScannerInstance method visitFile.
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (excludeMatcher.stream().noneMatch(m -> m.matches(file)) && includeMatcher.stream().allMatch(m -> m.matches(file))) {
log.debug("Walk Step: {}, {}", file);
stats.increaseFileCount();
// consume files regardless - the predicate will check the timestamp
Path repoPath = PathUtil.getPathFromUri(repository.getLocation());
BaseFile basefile = new BaseFile(repoPath.toString(), file.toFile());
// Timestamp finished points to the last successful scan, not this current one.
if (Files.getLastModifiedTime(file).toMillis() >= changesSince) {
stats.increaseNewFileCount();
}
consumerProcessFile.setBasefile(basefile);
consumerWantsFile.setBasefile(basefile);
Closure<RepositoryContentConsumer> processIfWanted = IfClosure.ifClosure(consumerWantsFile, consumerProcessFile);
IterableUtils.forEach(this.knownConsumers, processIfWanted);
if (consumerWantsFile.getWantedFileCount() <= 0) {
// Nothing known processed this file. It is invalid!
IterableUtils.forEach(this.invalidConsumers, consumerProcessFile);
}
}
return FileVisitResult.CONTINUE;
}
Aggregations