use of org.apache.archiva.repository.scanner.RepositoryScanner in project archiva by apache.
the class ArchivaCli method doScan.
private void doScan(String path, String[] consumers) throws ConsumerException, MalformedURLException {
BasicManagedRepository repo = new BasicManagedRepository(Paths.get(path).getFileName().toString(), "Archiva CLI Provided Repo", Paths.get(path).getParent());
repo.setLocation(Paths.get(path).toUri());
List<KnownRepositoryContentConsumer> knownConsumerList = new ArrayList<>();
knownConsumerList.addAll(getConsumerList(consumers));
List<InvalidRepositoryContentConsumer> invalidConsumerList = Collections.emptyList();
List<String> ignoredContent = new ArrayList<>();
ignoredContent.addAll(Arrays.asList(RepositoryScanner.IGNORABLE_CONTENT));
RepositoryScanner scanner = applicationContext.getBean(RepositoryScanner.class);
try {
RepositoryScanStatistics stats = scanner.scan(repo, knownConsumerList, invalidConsumerList, ignoredContent, RepositoryScanner.FRESH_SCAN);
LOGGER.info(stats.toDump(repo));
} catch (RepositoryScannerException e) {
LOGGER.error(e.getMessage(), e);
}
}
Aggregations