Search in sources :

Example 1 with RepositoryScannerInstance

use of org.apache.archiva.repository.scanner.RepositoryScannerInstance in project archiva by apache.

the class DefaultSystemStatusService method getRepositoryScannerStatistics.

@Override
public List<RepositoryScannerStatistics> getRepositoryScannerStatistics() throws ArchivaRestServiceException {
    Set<RepositoryScannerInstance> repositoryScannerInstances = scanner.getInProgressScans();
    if (repositoryScannerInstances.isEmpty()) {
        return Collections.emptyList();
    }
    List<RepositoryScannerStatistics> repositoryScannerStatisticsList = new ArrayList<RepositoryScannerStatistics>(repositoryScannerInstances.size());
    for (RepositoryScannerInstance instance : repositoryScannerInstances) {
        RepositoryScannerStatistics repositoryScannerStatistics = new RepositoryScannerStatistics();
        repositoryScannerStatisticsList.add(repositoryScannerStatistics);
        try {
            repositoryScannerStatistics.setManagedRepository(managedRepositoryAdmin.getManagedRepository(instance.getRepository().getId()));
        } catch (RepositoryAdminException e) {
            log.error("Could not retrieve repository '{}'", instance.getRepository().getId());
        }
        repositoryScannerStatistics.setNewFileCount(instance.getStats().getNewFileCount());
        repositoryScannerStatistics.setTotalFileCount(instance.getStats().getTotalFileCount());
        repositoryScannerStatistics.setConsumerScanningStatistics(mapConsumerScanningStatistics(instance));
    }
    return repositoryScannerStatisticsList;
}
Also used : ArrayList(java.util.ArrayList) RepositoryAdminException(org.apache.archiva.admin.model.RepositoryAdminException) RepositoryScannerInstance(org.apache.archiva.repository.scanner.RepositoryScannerInstance) RepositoryScannerStatistics(org.apache.archiva.rest.api.model.RepositoryScannerStatistics)

Aggregations

ArrayList (java.util.ArrayList)1 RepositoryAdminException (org.apache.archiva.admin.model.RepositoryAdminException)1 RepositoryScannerInstance (org.apache.archiva.repository.scanner.RepositoryScannerInstance)1 RepositoryScannerStatistics (org.apache.archiva.rest.api.model.RepositoryScannerStatistics)1