diff options
author | Brett Porter <brett@apache.org> | 2014-08-01 12:14:33 +1000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2014-08-01 12:48:26 +1000 |
commit | 2b8f78afe223f8bf2fbd9690ccec9f5bccc55686 (patch) | |
tree | 12d128bc82401eefe98c414a62849b06da0ac2dd /archiva-modules/archiva-scheduler/archiva-scheduler-repository | |
parent | 1e589ddd62ec068e3797f351566ff62274a549ba (diff) | |
download | archiva-2b8f78afe223f8bf2fbd9690ccec9f5bccc55686.tar.gz archiva-2b8f78afe223f8bf2fbd9690ccec9f5bccc55686.zip |
take advantage of generic type
Diffstat (limited to 'archiva-modules/archiva-scheduler/archiva-scheduler-repository')
-rw-r--r-- | archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java index f23d08b09..3493168af 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/main/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutor.java @@ -53,7 +53,7 @@ import java.util.Date; */ @Service( "taskExecutor#repository-scanning" ) public class ArchivaRepositoryScanningTaskExecutor - implements TaskExecutor + implements TaskExecutor<RepositoryTask> { private Logger log = LoggerFactory.getLogger( ArchivaRepositoryScanningTaskExecutor.class ); @@ -86,7 +86,7 @@ public class ArchivaRepositoryScanningTaskExecutor @SuppressWarnings( "unchecked" ) @Override - public void executeTask( Task task ) + public void executeTask( RepositoryTask task ) throws TaskExecutionException { try @@ -101,9 +101,7 @@ public class ArchivaRepositoryScanningTaskExecutor this.task = task; - RepositoryTask repoTask = (RepositoryTask) task; - - String repoId = repoTask.getRepositoryId(); + String repoId = task.getRepositoryId(); if ( StringUtils.isBlank( repoId ) ) { throw new TaskExecutionException( "Unable to execute RepositoryTask with blank repository Id." ); @@ -112,14 +110,14 @@ public class ArchivaRepositoryScanningTaskExecutor ManagedRepository arepo = managedRepositoryAdmin.getManagedRepository( repoId ); // execute consumers on resource file if set - if ( repoTask.getResourceFile() != null ) + if ( task.getResourceFile() != null ) { - log.debug( "Executing task from queue with job name: {}", repoTask ); - consumers.executeConsumers( arepo, repoTask.getResourceFile(), repoTask.isUpdateRelatedArtifacts() ); + log.debug( "Executing task from queue with job name: {}", task ); + consumers.executeConsumers( arepo, task.getResourceFile(), task.isUpdateRelatedArtifacts() ); } else { - log.info( "Executing task from queue with job name: {}", repoTask ); + log.info( "Executing task from queue with job name: {}", task ); // otherwise, execute consumers on whole repository if ( arepo == null ) @@ -135,7 +133,7 @@ public class ArchivaRepositoryScanningTaskExecutor MetadataRepository metadataRepository = repositorySession.getRepository(); try { - if ( !repoTask.isScanAll() ) + if ( !task.isScanAll() ) { RepositoryStatistics previousStats = repositoryStatisticsManager.getLastStatistics( metadataRepository, repoId ); @@ -183,7 +181,7 @@ public class ArchivaRepositoryScanningTaskExecutor // metadataRepository.findAllProjects(); // FIXME: do something - log.info( "Finished repository task: {}", repoTask ); + log.info( "Finished repository task: {}", task ); this.task = null; } |