Search in sources :

Example 1 with RepositoryScanner

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);
    }
}
Also used : BasicManagedRepository(org.apache.archiva.repository.BasicManagedRepository) RepositoryScanner(org.apache.archiva.repository.scanner.RepositoryScanner) KnownRepositoryContentConsumer(org.apache.archiva.consumers.KnownRepositoryContentConsumer) RepositoryScanStatistics(org.apache.archiva.repository.scanner.RepositoryScanStatistics) ArrayList(java.util.ArrayList) RepositoryScannerException(org.apache.archiva.repository.scanner.RepositoryScannerException) InvalidRepositoryContentConsumer(org.apache.archiva.consumers.InvalidRepositoryContentConsumer)

Aggregations

ArrayList (java.util.ArrayList)1 InvalidRepositoryContentConsumer (org.apache.archiva.consumers.InvalidRepositoryContentConsumer)1 KnownRepositoryContentConsumer (org.apache.archiva.consumers.KnownRepositoryContentConsumer)1 BasicManagedRepository (org.apache.archiva.repository.BasicManagedRepository)1 RepositoryScanStatistics (org.apache.archiva.repository.scanner.RepositoryScanStatistics)1 RepositoryScanner (org.apache.archiva.repository.scanner.RepositoryScanner)1 RepositoryScannerException (org.apache.archiva.repository.scanner.RepositoryScannerException)1