sinceWhen = previousStats.getScanStartTime().getTime();
previousFileCount = previousStats.getTotalFileCount();
}
}
RepositoryScanStatistics stats;
try
{
stats = repoScanner.scan( arepo, sinceWhen );
}
catch ( RepositoryScannerException e )
{
throw new TaskExecutionException( "Repository error when executing repository job.", e );
}
log.info( "Finished first scan: {}", stats.toDump( arepo ) );
// further statistics will be populated by the following method
Date endTime = new Date( stats.getWhenGathered().getTime() + stats.getDuration() );
log.info( "Gathering repository statistics" );
repositoryStatisticsManager.addStatisticsAfterScan( metadataRepository, repoId,
stats.getWhenGathered(), endTime,
stats.getTotalFileCount(),
stats.getTotalFileCount() - previousFileCount );
repositorySession.save();
}
catch ( MetadataRepositoryException e )
{
throw new TaskExecutionException( "Unable to store updated statistics: " + e.getMessage(), e );