public void executeTask( Task task )
throws TaskExecutionException
{
this.task = task;
RepositoryTask repoTask = (RepositoryTask) task;
if ( StringUtils.isBlank( repoTask.getRepositoryId() ) )
{
throw new TaskExecutionException("Unable to execute RepositoryTask with blank repository Id.");
}
ManagedRepositoryConfiguration arepo = archivaConfiguration.getConfiguration().findManagedRepositoryById( repoTask.getRepositoryId() );
// execute consumers on resource file if set
if( repoTask.getResourceFile() != null )
{
log.debug( "Executing task from queue with job name: " + repoTask.getName() );
consumers.executeConsumers( arepo, repoTask.getResourceFile(), repoTask.isUpdateRelatedArtifacts() );
}
else
{
log.info( "Executing task from queue with job name: " + repoTask.getName() );
// otherwise, execute consumers on whole repository
try
{
if ( arepo == null )
{
throw new TaskExecutionException( "Unable to execute RepositoryTask with invalid repository id: " + repoTask.getRepositoryId() );
}
long sinceWhen = RepositoryScanner.FRESH_SCAN;
List<RepositoryContentStatistics> results = (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );