From b2a4a02c00b70a0265251bd57fc772bebafba434 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Fri, 11 May 2007 22:25:12 +0000 Subject: [MRM-336]: Repository Admin - "Index Repository" appears to not do anything. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@537304 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-model/src/main/mdo/archiva-base.xml | 113 +++++++++-- .../scanner/DefaultRepositoryScanner.java | 36 +++- .../scanner/RepositoryContentConsumers.java | 48 ++--- .../org/apache/maven/archiva/cli/ArchivaCli.java | 21 +- archiva-scheduled/pom.xml | 52 ++--- .../maven/archiva/scheduled/ArchivaTaskQueue.java | 120 ------------ .../archiva/scheduled/ArchivaTaskScheduler.java | 25 ++- .../scheduled/DefaultArchivaTaskScheduler.java | 216 ++++++++++++++------- .../ArchivaDatabaseUpdateTaskExecutor.java | 89 +++++++++ .../ArchivaRepositoryScanningTaskExecutor.java | 113 +++++++++++ .../executors/ArchivaScheduledTaskExecutor.java | 161 --------------- .../tasks/RepositoryTaskSelectionPredicate.java | 54 ++++++ .../main/resources/META-INF/plexus/components.xml | 104 ++++++++++ .../src/test/conf/repository-manager.xml | 36 ++-- .../ArchivaDatabaseUpdateTaskExecutorTest.java | 200 +++++++++++++++++++ .../ArchivaRepositoryScanningTaskExecutorTest.java | 180 +++++++++++++++++ .../ArchivaScheduledTaskExecutorTest.java | 200 ------------------- .../javax/sql/jdbc/2.0/jdbc-2.0.jar.md5 | 1 + .../javax/sql/jdbc/2.0/jdbc-2.0.jar.sha1 | 1 + .../org/apache/maven/A/1.0/A-1.0.pom.md5 | 1 + .../org/apache/maven/A/1.0/A-1.0.pom.sha1 | 1 + .../org/apache/maven/A/1.0/A-1.0.war.md5 | 1 + .../org/apache/maven/A/1.0/A-1.0.war.sha1 | 1 + .../org/apache/maven/B/1.0/B-1.0.pom.md5 | 1 + .../org/apache/maven/B/1.0/B-1.0.pom.sha1 | 1 + .../org/apache/maven/B/2.0/B-2.0.pom.md5 | 1 + .../org/apache/maven/B/2.0/B-2.0.pom.sha1 | 1 + .../org/apache/maven/C/1.0/C-1.0.pom.md5 | 1 + .../org/apache/maven/C/1.0/C-1.0.pom.sha1 | 1 + .../org/apache/maven/C/1.0/C-1.0.war.md5 | 1 + .../org/apache/maven/C/1.0/C-1.0.war.sha1 | 1 + .../testgroup/discovery/1.0/discovery-1.0.pom.md5 | 1 + .../testgroup/discovery/1.0/discovery-1.0.pom.sha1 | 1 + .../ArchivaDatabaseUpdateTaskExecutorTest.xml | 78 ++++++++ .../ArchivaRepositoryScanningTaskExecutorTest.xml | 86 ++++++++ .../executors/ArchivaScheduledTaskExecutorTest.xml | 96 --------- .../src/appserver-base/conf/archiva.xml | 1 - .../web/action/admin/IndexRepositoryAction.java | 33 +++- .../main/resources/META-INF/plexus/application.xml | 47 +++-- 39 files changed, 1343 insertions(+), 782 deletions(-) delete mode 100644 archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java create mode 100644 archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutor.java create mode 100644 archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java delete mode 100644 archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java create mode 100644 archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/RepositoryTaskSelectionPredicate.java create mode 100644 archiva-scheduled/src/main/resources/META-INF/plexus/components.xml create mode 100644 archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java create mode 100644 archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java delete mode 100644 archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.java create mode 100644 archiva-scheduled/src/test/repositories/default-repository/javax/sql/jdbc/2.0/jdbc-2.0.jar.md5 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/javax/sql/jdbc/2.0/jdbc-2.0.jar.sha1 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.pom.md5 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.pom.sha1 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.war.md5 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.war.sha1 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/1.0/B-1.0.pom.md5 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/1.0/B-1.0.pom.sha1 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/2.0/B-2.0.pom.md5 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/2.0/B-2.0.pom.sha1 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.pom.md5 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.pom.sha1 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.war.md5 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.war.sha1 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom.md5 create mode 100644 archiva-scheduled/src/test/repositories/default-repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom.sha1 create mode 100644 archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.xml create mode 100644 archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml delete mode 100644 archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.xml delete mode 100644 archiva-web/archiva-webapp/src/appserver-base/conf/archiva.xml diff --git a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml index 4985c4226..59cf67869 100644 --- a/archiva-base/archiva-model/src/main/mdo/archiva-base.xml +++ b/archiva-base/archiva-model/src/main/mdo/archiva-base.xml @@ -2098,27 +2098,110 @@ 1.0.0+ - - private transient long startTimestamp; + " ); + } - public void increaseNewFileCount() { - this.newFileCount++; + buf.append( "\n Invalid Consumers : " ); + if ( !isEmpty( invalidConsumers ) ) + { + buf.append( "(" ).append( invalidConsumers.size() ).append( " configured)" ); + for ( java.util.Iterator iter = invalidConsumers.iterator(); iter.hasNext(); ) + { + String id = (String) iter.next(); + buf.append( "\n " ).append( id ); } - + } + else + { + buf.append( "" ); + } + + buf.append( "\n Duration : " ); + buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( this.getDuration() ) ); + buf.append( "\n When Gathered : " ).append( df.format( this.getWhenGathered() ) ); + buf.append( "\n Total File Count : " ).append( this.getTotalFileCount() ); + long averageMsPerFile = ( this.getDuration() / this.getTotalFileCount() ); + buf.append( "\n Avg Time Per File : " ); + buf.append( org.apache.maven.archiva.common.utils.DateUtil.getDuration( averageMsPerFile ) ); + buf.append( "\n______________________________________________________________" ); + + return buf.toString(); + } + + ]]> diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java index cf9b790ae..4a8d20915 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/DefaultRepositoryScanner.java @@ -19,8 +19,10 @@ package org.apache.maven.archiva.repository.scanner; * under the License. */ +import org.apache.commons.collections.Closure; import org.apache.commons.collections.CollectionUtils; import org.apache.maven.archiva.configuration.FileTypes; +import org.apache.maven.archiva.consumers.RepositoryContentConsumer; import org.apache.maven.archiva.model.ArchivaRepository; import org.apache.maven.archiva.model.RepositoryContentStatistics; import org.apache.maven.archiva.repository.RepositoryException; @@ -123,6 +125,38 @@ public class DefaultRepositoryScanner // Execute scan. dirWalker.scan(); - return scannerInstance.getStatistics(); + RepositoryContentStatistics stats = scannerInstance.getStatistics(); + + ConsumerIdClosure consumerIdList; + + consumerIdList = new ConsumerIdClosure(); + CollectionUtils.forAllDo( knownContentConsumers, consumerIdList ); + stats.setKnownConsumers( consumerIdList.getList() ); + + consumerIdList = new ConsumerIdClosure(); + CollectionUtils.forAllDo( invalidContentConsumers, consumerIdList ); + stats.setInvalidConsumers( consumerIdList.getList() ); + + return stats; + } + + class ConsumerIdClosure + implements Closure + { + private List list = new ArrayList(); + + public void execute( Object input ) + { + if ( input instanceof RepositoryContentConsumer ) + { + RepositoryContentConsumer consumer = (RepositoryContentConsumer) input; + list.add( consumer.getId() ); + } + } + + public List getList() + { + return list; + } } } diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java index 6e38b7ae2..e57c633c1 100644 --- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java +++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java @@ -24,11 +24,13 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Predicate; import org.apache.commons.collections.functors.IfClosure; import org.apache.maven.archiva.configuration.ArchivaConfiguration; -import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration; import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.maven.archiva.consumers.RepositoryContentConsumer; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; import java.util.ArrayList; import java.util.HashMap; @@ -44,6 +46,8 @@ import java.util.Map; * @plexus.component role="org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers" */ public class RepositoryContentConsumers + extends AbstractLogEnabled + implements Initializable { /** * @plexus.requirement @@ -60,6 +64,10 @@ public class RepositoryContentConsumers */ private List availableInvalidConsumers; + private SelectedKnownRepoConsumersPredicate selectedKnownPredicate; + + private SelectedInvalidRepoConsumersPredicate selectedInvalidPredicate; + class SelectedKnownRepoConsumersPredicate implements Predicate { @@ -70,14 +78,14 @@ public class RepositoryContentConsumers if ( object instanceof KnownRepositoryContentConsumer ) { KnownRepositoryContentConsumer known = (KnownRepositoryContentConsumer) object; - Configuration config = archivaConfiguration.getConfiguration(); + RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration() + .getRepositoryScanning(); - return config.getRepositoryScanning().getKnownContentConsumers().contains( known.getId() ); + return scanning.getKnownContentConsumers().contains( known.getId() ); } return satisfies; } - } class SelectedInvalidRepoConsumersPredicate @@ -90,9 +98,10 @@ public class RepositoryContentConsumers if ( object instanceof InvalidRepositoryContentConsumer ) { InvalidRepositoryContentConsumer invalid = (InvalidRepositoryContentConsumer) object; - Configuration config = archivaConfiguration.getConfiguration(); + RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration() + .getRepositoryScanning(); - return config.getRepositoryScanning().getInvalidContentConsumers().contains( invalid.getId() ); + return scanning.getInvalidContentConsumers().contains( invalid.getId() ); } return satisfies; @@ -119,22 +128,19 @@ public class RepositoryContentConsumers } } - public Predicate getKnownSelectionPredicate() + public void initialize() + throws InitializationException { - return new SelectedKnownRepoConsumersPredicate(); + this.selectedKnownPredicate = new SelectedKnownRepoConsumersPredicate(); + this.selectedInvalidPredicate = new SelectedInvalidRepoConsumersPredicate(); } - public Predicate getInvalidSelectionPredicate() - { - return new SelectedInvalidRepoConsumersPredicate(); - } - public List getSelectedKnownConsumerIds() { RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); return scanning.getKnownContentConsumers(); } - + public List getSelectedInvalidConsumerIds() { RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); @@ -144,7 +150,7 @@ public class RepositoryContentConsumers public Map getSelectedKnownConsumersMap() { RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure(); - Closure ifclosure = IfClosure.getInstance( getKnownSelectionPredicate(), consumerMapClosure ); + Closure ifclosure = IfClosure.getInstance( selectedKnownPredicate, consumerMapClosure ); CollectionUtils.forAllDo( availableKnownConsumers, ifclosure ); return consumerMapClosure.getMap(); @@ -153,28 +159,24 @@ public class RepositoryContentConsumers public Map getSelectedInvalidConsumersMap() { RepoConsumerToMapClosure consumerMapClosure = new RepoConsumerToMapClosure(); - Closure ifclosure = IfClosure.getInstance( getInvalidSelectionPredicate(), consumerMapClosure ); + Closure ifclosure = IfClosure.getInstance( selectedInvalidPredicate, consumerMapClosure ); CollectionUtils.forAllDo( availableInvalidConsumers, ifclosure ); return consumerMapClosure.getMap(); } - + public List getSelectedKnownConsumers() { - RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); - List ret = new ArrayList(); - ret.addAll( CollectionUtils.select( scanning.getKnownContentConsumers(), getKnownSelectionPredicate() )); + ret.addAll( CollectionUtils.select( availableKnownConsumers, selectedKnownPredicate ) ); return ret; } public List getSelectedInvalidConsumers() { - RepositoryScanningConfiguration scanning = archivaConfiguration.getConfiguration().getRepositoryScanning(); - List ret = new ArrayList(); - ret.addAll( CollectionUtils.select( scanning.getInvalidContentConsumers(), getInvalidSelectionPredicate() )); + ret.addAll( CollectionUtils.select( availableInvalidConsumers, selectedInvalidPredicate ) ); return ret; } diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java index 3f5b03872..a9824e8ac 100644 --- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java +++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java @@ -23,7 +23,6 @@ import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.common.utils.DateUtil; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.RepositoryContentConsumer; @@ -40,7 +39,6 @@ import org.codehaus.plexus.tools.cli.AbstractCli; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -187,24 +185,7 @@ public class ArchivaCli RepositoryContentStatistics stats = scanner.scan( repo, knownConsumerList, invalidConsumerList, ignoredContent, RepositoryScanner.FRESH_SCAN ); - SimpleDateFormat df = new SimpleDateFormat(); - System.out.println( "" ); - System.out.println( ".\\ Scan of " + repo.getId() + " \\.__________________________________________" ); - System.out.println( " Repository URL : " + repo.getUrl() ); - System.out.println( " Repository Name : " + repo.getModel().getName() ); - System.out.println( " Repository Layout : " + repo.getModel().getLayoutName() ); - System.out.println( " Consumers : (" + knownConsumerList.size() + " active)" ); - for ( Iterator iter = knownConsumerList.iterator(); iter.hasNext(); ) - { - RepositoryContentConsumer consumer = (RepositoryContentConsumer) iter.next(); - System.out.println( " " + consumer.getId() + " - " + consumer.getDescription() ); - } - System.out.println( " Duration : " + DateUtil.getDuration( stats.getDuration() ) ); - System.out.println( " When Gathered : " + df.format( stats.getWhenGathered() ) ); - System.out.println( " Total File Count : " + stats.getTotalFileCount() ); - long averageMsPerFile = ( stats.getDuration() / stats.getTotalFileCount() ); - System.out.println( " Avg Time Per File : " + DateUtil.getDuration( averageMsPerFile ) ); - System.out.println( "______________________________________________________________" ); + System.out.println( "\n" + stats.toDump( repo ) ); } catch ( RepositoryException e ) { diff --git a/archiva-scheduled/pom.xml b/archiva-scheduled/pom.xml index 04b01d202..7f07cc256 100644 --- a/archiva-scheduled/pom.xml +++ b/archiva-scheduled/pom.xml @@ -41,14 +41,6 @@ org.apache.maven.archiva archiva-repository-layer - - org.apache.maven.archiva - archiva-core-consumers - - - org.apache.maven.archiva - archiva-database-consumers - org.codehaus.plexus plexus-taskqueue @@ -77,6 +69,22 @@ 1.0-alpha-2 + + hsqldb + hsqldb + 1.8.0.7 + test + + + org.apache.maven.archiva + archiva-core-consumers + test + + + org.apache.maven.archiva + archiva-database-consumers + test + org.codehaus.plexus.registry plexus-registry-commons @@ -98,23 +106,23 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 2.2 - - - **/Abstract* - **/*TestCase.java - **/*Tests.java - **/*TestSuite.java - **/ArchivaScheduledTaskExecutorTest* - - - org.codehaus.plexus plexus-maven-plugin + + + merge + + merge-descriptors + + + + ${basedir}/src/main/resources/META-INF/plexus/components.xml + ${project.build.directory}/generated-resources/plexus/META-INF/plexus/components.xml + + + + diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java deleted file mode 100644 index 4d221fff3..000000000 --- a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskQueue.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.apache.maven.archiva.scheduled; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; -import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; -import org.codehaus.plexus.taskqueue.DefaultTaskQueue; -import org.codehaus.plexus.taskqueue.Task; -import org.codehaus.plexus.taskqueue.TaskQueueException; - -import java.util.Iterator; -import java.util.List; - -/** - * ArchivaTaskQueue - * - * @author Joakim Erdfelt - * @version $Id$ - * @plexus.component role="org.codehaus.plexus.taskqueue.TaskQueue" - * role-hint="archiva-task-queue" - * lifecycle-handler="plexus-configurable" - */ -public class ArchivaTaskQueue - extends DefaultTaskQueue -{ - - public ArchivaTaskQueue() - { - super(); - /* do nothing special */ - } - - public boolean hasDatabaseTaskInQueue() - { - try - { - List queue = getQueueSnapshot(); - Iterator it = queue.iterator(); - while ( it.hasNext() ) - { - Task task = (Task) it.next(); - if ( task instanceof DatabaseTask ) - { - return true; - } - } - return false; - } - catch ( TaskQueueException e ) - { - return false; - } - } - - public boolean hasFilesystemTaskInQueue() - { - try - { - List queue = getQueueSnapshot(); - Iterator it = queue.iterator(); - while ( it.hasNext() ) - { - Task task = (Task) it.next(); - if ( task instanceof RepositoryTask ) - { - return true; - } - } - return false; - } - catch ( TaskQueueException e ) - { - return false; - } - } - - public boolean hasRepositoryTaskInQueue( String repoid ) - { - try - { - List queue = getQueueSnapshot(); - Iterator it = queue.iterator(); - while ( it.hasNext() ) - { - Task task = (Task) it.next(); - if ( task instanceof RepositoryTask ) - { - RepositoryTask rtask = (RepositoryTask) task; - if ( StringUtils.equals( repoid, rtask.getRepositoryId() ) ) - { - return true; - } - } - } - return false; - } - catch ( TaskQueueException e ) - { - return false; - } - } -} diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java index 9becfb2f2..225af2184 100644 --- a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java +++ b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/ArchivaTaskScheduler.java @@ -19,6 +19,10 @@ package org.apache.maven.archiva.scheduled; * under the License. */ +import org.apache.maven.archiva.common.ArchivaException; +import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; +import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; +import org.codehaus.plexus.taskqueue.TaskQueueException; import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; /** @@ -32,15 +36,28 @@ public interface ArchivaTaskScheduler * The Plexus component role. */ public final static String ROLE = ArchivaTaskScheduler.class.getName(); - - public ArchivaTaskQueue getTaskQueue(); + + public boolean isProcessingAnyRepositoryTask() + throws ArchivaException; + + public boolean isProcessingDatabaseTask() + throws ArchivaException; + + public boolean isProcessingRepositoryTask( String repositoryId ) + throws ArchivaException; + + public void queueDatabaseTask( DatabaseTask task ) + throws TaskQueueException; + + public void queueRepositoryTask( RepositoryTask task ) + throws TaskQueueException; public void scheduleAllRepositoryTasks() throws TaskExecutionException; - + public void scheduleDatabaseTasks() throws TaskExecutionException; - + public void scheduleRepositoryTask( String repositoryId ) throws TaskExecutionException; } diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java index 50de8347f..c8fd75229 100644 --- a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java +++ b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/DefaultArchivaTaskScheduler.java @@ -19,9 +19,14 @@ package org.apache.maven.archiva.scheduled; * under the License. */ +import org.apache.commons.collections.CollectionUtils; +import org.apache.maven.archiva.common.ArchivaException; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.RepositoryConfiguration; import org.apache.maven.archiva.scheduled.tasks.ArchivaTask; +import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; +import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; +import org.apache.maven.archiva.scheduled.tasks.RepositoryTaskSelectionPredicate; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Startable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.StartingException; @@ -30,6 +35,7 @@ import org.codehaus.plexus.registry.Registry; import org.codehaus.plexus.registry.RegistryListener; import org.codehaus.plexus.scheduler.Scheduler; import org.codehaus.plexus.taskqueue.TaskQueue; +import org.codehaus.plexus.taskqueue.TaskQueueException; import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; import org.quartz.CronTrigger; import org.quartz.JobDataMap; @@ -56,43 +62,48 @@ public class DefaultArchivaTaskScheduler */ private Scheduler scheduler; - /** - * @plexus.requirement role-hint="archiva-task-queue" + * @plexus.requirement role-hint="database-update" */ - private TaskQueue archivaTaskQueue; - + private TaskQueue databaseUpdateQueue; + + /** + * @plexus.requirement role-hint="repository-scanning" + */ + private TaskQueue repositoryScanningQueue; + /** * @plexus.requirement */ private ArchivaConfiguration archivaConfiguration; - - + public static final String DATABASE_SCAN_GROUP = "database-group"; - + public static final String DATABASE_JOB = "database-job"; + public static final String DATABASE_JOB_TRIGGER = "database-job-trigger"; - + public static final String REPOSITORY_SCAN_GROUP = "repository-group"; - + public static final String REPOSITORY_JOB = "repository-job"; + public static final String REPOSITORY_JOB_TRIGGER = "repository-job-trigger"; - + public void start() throws StartingException { try { - List repositories = archivaConfiguration.getConfiguration().getRepositories(); - - for ( Iterator i = repositories.iterator(); i.hasNext(); ) - { - RepositoryConfiguration repoConfig = (RepositoryConfiguration)i.next(); - - scheduleRepositoryJobs( repoConfig ); - } - - scheduleDatabaseJobs( ); + List repositories = archivaConfiguration.getConfiguration().getRepositories(); + + for ( Iterator i = repositories.iterator(); i.hasNext(); ) + { + RepositoryConfiguration repoConfig = (RepositoryConfiguration) i.next(); + + scheduleRepositoryJobs( repoConfig ); + } + + scheduleDatabaseJobs(); } catch ( SchedulerException e ) { @@ -101,66 +112,68 @@ public class DefaultArchivaTaskScheduler } private void scheduleRepositoryJobs( RepositoryConfiguration repoConfig ) - throws SchedulerException + throws SchedulerException { if ( repoConfig.getRefreshCronExpression() == null ) { getLogger().warn( "Skipping job, no cron expression for " + repoConfig.getId() ); return; } - + // get the cron string for these database scanning jobs - String cronString = repoConfig.getRefreshCronExpression(); - + String cronString = repoConfig.getRefreshCronExpression(); + // setup the unprocessed artifact job - JobDetail repositoryJob = - new JobDetail( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP, RepositoryTaskJob.class ); + JobDetail repositoryJob = new JobDetail( REPOSITORY_JOB + ":" + repoConfig.getId(), REPOSITORY_SCAN_GROUP, + RepositoryTaskJob.class ); JobDataMap dataMap = new JobDataMap(); - dataMap.put( RepositoryTaskJob.TASK_QUEUE, archivaTaskQueue ); + dataMap.put( RepositoryTaskJob.TASK_QUEUE, repositoryScanningQueue ); dataMap.put( RepositoryTaskJob.TASK_QUEUE_POLICY, ArchivaTask.QUEUE_POLICY_WAIT ); dataMap.put( RepositoryTaskJob.TASK_REPOSITORY, repoConfig.getId() ); repositoryJob.setJobDataMap( dataMap ); - - try + + try { - CronTrigger trigger = - new CronTrigger( REPOSITORY_JOB_TRIGGER + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP, cronString ); - + CronTrigger trigger = new CronTrigger( REPOSITORY_JOB_TRIGGER + ":" + repoConfig.getId(), + REPOSITORY_SCAN_GROUP, cronString ); + scheduler.scheduleJob( repositoryJob, trigger ); } catch ( ParseException e ) { - getLogger().error( "ParseException in repository scanning cron expression, disabling repository scanning for '" + repoConfig.getId() + "': " + e.getMessage() ); + getLogger().error( + "ParseException in repository scanning cron expression, disabling repository scanning for '" + + repoConfig.getId() + "': " + e.getMessage() ); } - + } - - private void scheduleDatabaseJobs( ) + + private void scheduleDatabaseJobs() throws SchedulerException - { + { String cronString = archivaConfiguration.getConfiguration().getDatabaseScanning().getCronExpression(); - + // setup the unprocessed artifact job - JobDetail databaseJob = - new JobDetail( DATABASE_JOB, DATABASE_SCAN_GROUP, DatabaseTaskJob.class ); + JobDetail databaseJob = new JobDetail( DATABASE_JOB, DATABASE_SCAN_GROUP, DatabaseTaskJob.class ); JobDataMap dataMap = new JobDataMap(); - dataMap.put( DatabaseTaskJob.TASK_QUEUE, archivaTaskQueue ); + dataMap.put( DatabaseTaskJob.TASK_QUEUE, databaseUpdateQueue ); databaseJob.setJobDataMap( dataMap ); - - try + + try { - CronTrigger trigger = - new CronTrigger( DATABASE_JOB_TRIGGER, DATABASE_SCAN_GROUP, cronString ); - + CronTrigger trigger = new CronTrigger( DATABASE_JOB_TRIGGER, DATABASE_SCAN_GROUP, cronString ); + scheduler.scheduleJob( databaseJob, trigger ); } catch ( ParseException e ) { - getLogger().error( "ParseException in database scanning cron expression, disabling database scanning: " + e.getMessage() ); + getLogger().error( + "ParseException in database scanning cron expression, disabling database scanning: " + + e.getMessage() ); } - + } public void stop() @@ -168,7 +181,7 @@ public class DefaultArchivaTaskScheduler { try { - scheduler.unscheduleJob( DATABASE_JOB, DATABASE_SCAN_GROUP ); + scheduler.unscheduleJob( DATABASE_JOB, DATABASE_SCAN_GROUP ); } catch ( SchedulerException e ) { @@ -176,7 +189,6 @@ public class DefaultArchivaTaskScheduler } } - public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue ) { // nothing to do @@ -191,11 +203,11 @@ public class DefaultArchivaTaskScheduler if ( "cronExpression".equals( propertyName ) ) { getLogger().debug( "Restarting the database scheduled task after property change: " + propertyName ); - + try { scheduler.unscheduleJob( DATABASE_JOB, DATABASE_SCAN_GROUP ); - + scheduleDatabaseJobs(); } catch ( SchedulerException e ) @@ -203,24 +215,24 @@ public class DefaultArchivaTaskScheduler getLogger().error( "Error restarting the database scanning job after property change." ); } } - + // refreshCronExpression comes from the repositories section // // currently we have to reschedule all repo jobs because we don't know where the changed one came from if ( "refreshCronExpression".equals( propertyName ) ) { List repositories = archivaConfiguration.getConfiguration().getRepositories(); - + for ( Iterator i = repositories.iterator(); i.hasNext(); ) { - RepositoryConfiguration repoConfig = (RepositoryConfiguration)i.next(); - + RepositoryConfiguration repoConfig = (RepositoryConfiguration) i.next(); + if ( repoConfig.getRefreshCronExpression() != null ) { try { // unschedule handles jobs that might not exist - scheduler.unscheduleJob( REPOSITORY_JOB + ":" + repoConfig.getId() , REPOSITORY_SCAN_GROUP ); + scheduler.unscheduleJob( REPOSITORY_JOB + ":" + repoConfig.getId(), REPOSITORY_SCAN_GROUP ); scheduleRepositoryJobs( repoConfig ); } catch ( SchedulerException e ) @@ -232,19 +244,20 @@ public class DefaultArchivaTaskScheduler } } - public void scheduleAllRepositoryTasks() throws TaskExecutionException + public void scheduleAllRepositoryTasks() + throws TaskExecutionException { try { List repositories = archivaConfiguration.getConfiguration().getRepositories(); - + for ( Iterator i = repositories.iterator(); i.hasNext(); ) { - RepositoryConfiguration repoConfig = (RepositoryConfiguration)i.next(); - - scheduleRepositoryJobs( repoConfig ); + RepositoryConfiguration repoConfig = (RepositoryConfiguration) i.next(); + + scheduleRepositoryJobs( repoConfig ); } - + } catch ( SchedulerException e ) { @@ -252,7 +265,8 @@ public class DefaultArchivaTaskScheduler } } - public void scheduleDatabaseTasks() throws TaskExecutionException + public void scheduleDatabaseTasks() + throws TaskExecutionException { try { @@ -265,22 +279,82 @@ public class DefaultArchivaTaskScheduler } } - public void scheduleRepositoryTask( String repositoryId ) throws TaskExecutionException + public void scheduleRepositoryTask( String repositoryId ) + throws TaskExecutionException { try { - RepositoryConfiguration repoConfig = archivaConfiguration.getConfiguration().findRepositoryById( repositoryId ); - - scheduleRepositoryJobs( repoConfig ); + RepositoryConfiguration repoConfig = archivaConfiguration.getConfiguration() + .findRepositoryById( repositoryId ); + + scheduleRepositoryJobs( repoConfig ); } catch ( SchedulerException e ) { throw new TaskExecutionException( "Unable to schedule repository jobs: " + e.getMessage(), e ); - } + } + } + + public boolean isProcessingAnyRepositoryTask() + throws ArchivaException + { + List queue = null; + + try + { + queue = repositoryScanningQueue.getQueueSnapshot(); + } + catch ( TaskQueueException e ) + { + throw new ArchivaException( "Unable to get repository scanning queue:" + e.getMessage(), e ); + } + + return !queue.isEmpty(); + } + + public boolean isProcessingRepositoryTask( String repositoryId ) + throws ArchivaException + { + List queue = null; + + try + { + queue = repositoryScanningQueue.getQueueSnapshot(); + } + catch ( TaskQueueException e ) + { + throw new ArchivaException( "Unable to get repository scanning queue:" + e.getMessage(), e ); + } + + return CollectionUtils.exists( queue, new RepositoryTaskSelectionPredicate( repositoryId ) ); + } + + public boolean isProcessingDatabaseTask() + throws ArchivaException + { + List queue = null; + + try + { + queue = databaseUpdateQueue.getQueueSnapshot(); + } + catch ( TaskQueueException e ) + { + throw new ArchivaException( "Unable to get database update queue:" + e.getMessage(), e ); + } + + return !queue.isEmpty(); + } + + public void queueRepositoryTask( RepositoryTask task ) + throws TaskQueueException + { + repositoryScanningQueue.put( task ); } - public ArchivaTaskQueue getTaskQueue() + public void queueDatabaseTask( DatabaseTask task ) + throws TaskQueueException { - return (ArchivaTaskQueue) archivaTaskQueue; + databaseUpdateQueue.put( task ); } } diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutor.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutor.java new file mode 100644 index 000000000..550354671 --- /dev/null +++ b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutor.java @@ -0,0 +1,89 @@ +package org.apache.maven.archiva.scheduled.executors; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.maven.archiva.database.ArchivaDatabaseException; +import org.apache.maven.archiva.database.updater.DatabaseUpdater; +import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; +import org.codehaus.plexus.taskqueue.Task; +import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; +import org.codehaus.plexus.taskqueue.execution.TaskExecutor; + +/** + * ArchivaDatabaseTaskExecutor + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component + * role="org.codehaus.plexus.taskqueue.execution.TaskExecutor" + * role-hint="database-update" + */ +public class ArchivaDatabaseUpdateTaskExecutor + extends AbstractLogEnabled + implements TaskExecutor, Initializable +{ + /** + * @plexus.requirement role-hint="jdo" + */ + private DatabaseUpdater databaseUpdater; + + public void initialize() + throws InitializationException + { + getLogger().info( "Initialized " + this.getClass().getName() ); + } + + public void executeTask( Task task ) + throws TaskExecutionException + { + DatabaseTask dbtask = (DatabaseTask) task; + + getLogger().info( "Executing task from queue with job name: " + dbtask.getName() ); + long time = System.currentTimeMillis(); + + try + { + getLogger().info( "Task: Updating unprocessed artifacts" ); + databaseUpdater.updateAllUnprocessed(); + } + catch ( ArchivaDatabaseException e ) + { + throw new TaskExecutionException( "Error running unprocessed updater", e ); + } + + try + { + getLogger().info( "Task: Updating processed artifacts" ); + databaseUpdater.updateAllProcessed(); + } + catch ( ArchivaDatabaseException e ) + { + throw new TaskExecutionException( "Error running processed updater", e ); + } + + time = System.currentTimeMillis() - time; + + getLogger().info( "Finished database task in " + time + "ms." ); + } +} diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java new file mode 100644 index 000000000..227f07346 --- /dev/null +++ b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java @@ -0,0 +1,113 @@ +package org.apache.maven.archiva.scheduled.executors; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.collections.CollectionUtils; +import org.apache.maven.archiva.database.ArchivaDAO; +import org.apache.maven.archiva.database.ArchivaDatabaseException; +import org.apache.maven.archiva.database.RepositoryDAO; +import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics; +import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.model.RepositoryContentStatistics; +import org.apache.maven.archiva.repository.RepositoryException; +import org.apache.maven.archiva.repository.scanner.RepositoryScanner; +import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; +import org.codehaus.plexus.logging.AbstractLogEnabled; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; +import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; +import org.codehaus.plexus.taskqueue.Task; +import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; +import org.codehaus.plexus.taskqueue.execution.TaskExecutor; + +import java.util.List; + +/** + * ArchivaRepositoryScanningTaskExecutor + * + * @author Joakim Erdfelt + * @version $Id$ + * + * @plexus.component + * role="org.codehaus.plexus.taskqueue.execution.TaskExecutor" + * role-hint="repository-scanning" + */ +public class ArchivaRepositoryScanningTaskExecutor + extends AbstractLogEnabled + implements TaskExecutor, Initializable +{ + /** + * @plexus.requirement role-hint="jdo" + */ + private ArchivaDAO dao; + + /** + * @plexus.requirement role-hint="jdo" + */ + private RepositoryDAO repositoryDAO; + + /** + * The repository scanner component. + * + * @plexus.requirement + */ + private RepositoryScanner repoScanner; + + public void initialize() + throws InitializationException + { + getLogger().info( "Initialized " + this.getClass().getName() ); + } + + public void executeTask( Task task ) + throws TaskExecutionException + { + RepositoryTask repoTask = (RepositoryTask) task; + getLogger().info( "Executing task from queue with job name: " + repoTask.getName() ); + + try + { + ArchivaRepository arepo = repositoryDAO.getRepository( repoTask.getRepositoryId() ); + + long sinceWhen = RepositoryScanner.FRESH_SCAN; + + List results = dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) ); + + if ( CollectionUtils.isNotEmpty( results ) ) + { + RepositoryContentStatistics lastStats = (RepositoryContentStatistics) results.get( 0 ); + sinceWhen = lastStats.getWhenGathered().getTime() + lastStats.getDuration(); + } + + RepositoryContentStatistics stats = repoScanner.scan( arepo, sinceWhen ); + + dao.save( stats ); + + getLogger().info( "Finished repository task: " + stats.toDump( arepo ) ); + } + catch ( ArchivaDatabaseException e ) + { + throw new TaskExecutionException( "Database error when executing repository job.", e ); + } + catch ( RepositoryException e ) + { + throw new TaskExecutionException( "Repository error when executing repository job.", e ); + } + } +} diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java deleted file mode 100644 index cf931977d..000000000 --- a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutor.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.apache.maven.archiva.scheduled.executors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import org.apache.commons.collections.CollectionUtils; -import org.apache.maven.archiva.common.utils.DateUtil; -import org.apache.maven.archiva.database.ArchivaDAO; -import org.apache.maven.archiva.database.ArchivaDatabaseException; -import org.apache.maven.archiva.database.RepositoryDAO; -import org.apache.maven.archiva.database.constraints.MostRecentRepositoryScanStatistics; -import org.apache.maven.archiva.database.updater.DatabaseUpdater; -import org.apache.maven.archiva.model.ArchivaRepository; -import org.apache.maven.archiva.model.RepositoryContentStatistics; -import org.apache.maven.archiva.repository.RepositoryException; -import org.apache.maven.archiva.repository.scanner.RepositoryScanner; -import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; -import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; -import org.codehaus.plexus.logging.AbstractLogEnabled; -import org.codehaus.plexus.taskqueue.Task; -import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; -import org.codehaus.plexus.taskqueue.execution.TaskExecutor; - -import java.util.List; - -/** - * - * @author Jesse McConnell - * @version $Id:$ - * - * @plexus.component role="org.codehaus.plexus.taskqueue.execution.TaskExecutor" - * role-hint="archiva-task-executor" - */ -public class ArchivaScheduledTaskExecutor - extends AbstractLogEnabled - implements TaskExecutor -{ - /** - * @plexus.requirement role-hint="jdo" - */ - private ArchivaDAO dao; - - /** - * @plexus.requirement role-hint="jdo" - */ - private DatabaseUpdater databaseUpdater; - - /** - * @plexus.requirement role-hint="jdo" - */ - private RepositoryDAO repositoryDAO; - - /** - * The repository scanner component. - * - * @plexus.requirement - */ - private RepositoryScanner repoScanner; - - public void executeTask( Task task ) - throws TaskExecutionException - { - - if ( task instanceof DatabaseTask ) - { - executeDatabaseTask( (DatabaseTask) task ); - } - else if ( task instanceof RepositoryTask ) - { - executeRepositoryTask( (RepositoryTask) task ); - } - else - { - throw new TaskExecutionException( "Unknown Task: " + task.toString() ); - } - - } - - private void executeDatabaseTask( DatabaseTask task ) - throws TaskExecutionException - { - getLogger().info( "Executing task from queue with job name: " + task.getName() ); - long time = System.currentTimeMillis(); - - try - { - getLogger().info( "Task: Updating unprocessed artifacts" ); - databaseUpdater.updateAllUnprocessed(); - } - catch ( ArchivaDatabaseException e ) - { - throw new TaskExecutionException( "Error running unprocessed updater", e ); - } - - try - { - getLogger().info( "Task: Updating processed artifacts" ); - databaseUpdater.updateAllProcessed(); - } - catch ( ArchivaDatabaseException e ) - { - throw new TaskExecutionException( "Error running processed updater", e ); - } - - time = System.currentTimeMillis() - time; - - getLogger().info( "Finished database task in " + time + "ms." ); - - } - - private void executeRepositoryTask( RepositoryTask task ) - throws TaskExecutionException - { - getLogger().info( "Executing task from queue with job name: " + task.getName() ); - - try - { - ArchivaRepository arepo = repositoryDAO.getRepository( task.getRepositoryId() ); - - long sinceWhen = RepositoryScanner.FRESH_SCAN; - - List results = dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) ); - - if ( CollectionUtils.isNotEmpty( results ) ) - { - RepositoryContentStatistics lastStats = (RepositoryContentStatistics) results.get( 0 ); - sinceWhen = lastStats.getWhenGathered().getTime() + lastStats.getDuration(); - } - - RepositoryContentStatistics stats = repoScanner.scan( arepo, sinceWhen ); - - dao.save( stats ); - - getLogger().info( "Finished repository task: " + DateUtil.getDuration( stats.getDuration() ) + "." ); - } - catch ( ArchivaDatabaseException e ) - { - throw new TaskExecutionException( "Database error when executing repository job.", e ); - } - catch ( RepositoryException e ) - { - throw new TaskExecutionException( "Repository error when executing repository job.", e ); - } - } -} diff --git a/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/RepositoryTaskSelectionPredicate.java b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/RepositoryTaskSelectionPredicate.java new file mode 100644 index 000000000..c9abed17f --- /dev/null +++ b/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/RepositoryTaskSelectionPredicate.java @@ -0,0 +1,54 @@ +package org.apache.maven.archiva.scheduled.tasks; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.collections.Predicate; +import org.apache.commons.lang.StringUtils; + +/** + * RepositoryTaskSelectionPredicate + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class RepositoryTaskSelectionPredicate + implements Predicate +{ + private String repoid; + + public RepositoryTaskSelectionPredicate( String repositoryId ) + { + this.repoid = repositoryId; + } + + public boolean evaluate( Object object ) + { + boolean satisfies = false; + + if ( object instanceof RepositoryTask ) + { + RepositoryTask task = (RepositoryTask) object; + return StringUtils.equals( repoid, task.getRepositoryId() ); + } + + return satisfies; + } + +} diff --git a/archiva-scheduled/src/main/resources/META-INF/plexus/components.xml b/archiva-scheduled/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 000000000..4d6d6370f --- /dev/null +++ b/archiva-scheduled/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,104 @@ + + + + + + + + org.codehaus.plexus.taskqueue.TaskQueue + database-update + org.codehaus.plexus.taskqueue.DefaultTaskQueue + plexus-configurable + + + + + + + + + + + + org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor + database-update + org.codehaus.plexus.taskqueue.execution.ThreadedTaskQueueExecutor + singleton + + + org.codehaus.plexus.taskqueue.execution.TaskExecutor + database-update + + + org.codehaus.plexus.taskqueue.TaskQueue + database-update + + + + database-update + + + + + + org.codehaus.plexus.taskqueue.TaskQueue + repository-scanning + org.codehaus.plexus.taskqueue.DefaultTaskQueue + plexus-configurable + + + + + + + + + + + + org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor + repository-scanning + org.codehaus.plexus.taskqueue.execution.ThreadedTaskQueueExecutor + singleton + + + org.codehaus.plexus.taskqueue.execution.TaskExecutor + repository-scanning + + + org.codehaus.plexus.taskqueue.TaskQueue + repository-scanning + + + + repository-scanning + + + + + diff --git a/archiva-scheduled/src/test/conf/repository-manager.xml b/archiva-scheduled/src/test/conf/repository-manager.xml index 9e3597358..15a5de672 100644 --- a/archiva-scheduled/src/test/conf/repository-manager.xml +++ b/archiva-scheduled/src/test/conf/repository-manager.xml @@ -147,19 +147,19 @@ - - update-db-artifact - create-missing-checksums - update-db-repository-metadata - validate-checksum - validate-signature - index-content - auto-remove - auto-rename - - - update-db-bad-content - + + update-db-artifact + create-missing-checksums + update-db-repository-metadata + validate-checksum + validate-signature + index-content + auto-remove + auto-rename + + + update-db-bad-content + @@ -167,11 +167,11 @@ update-db-artifact - - not-present-remove-db-artifact - not-present-remove-db-project - not-present-remove-indexed - + + not-present-remove-db-artifact + not-present-remove-db-project + not-present-remove-indexed + diff --git a/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java new file mode 100644 index 000000000..eba153320 --- /dev/null +++ b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.java @@ -0,0 +1,200 @@ +package org.apache.maven.archiva.scheduled.executors; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.database.ArchivaDAO; +import org.apache.maven.archiva.database.ArtifactDAO; +import org.apache.maven.archiva.database.RepositoryDAO; +import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint; +import org.apache.maven.archiva.model.ArchivaArtifact; +import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory; +import org.codehaus.plexus.jdo.JdoFactory; +import org.codehaus.plexus.taskqueue.execution.TaskExecutor; +import org.jpox.SchemaTool; + +import java.io.File; +import java.net.URL; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.jdo.JDOHelper; +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +/** + * ArchivaDatabaseUpdateTaskExecutorTest + * + * @author Joakim Erdfelt + * @version $Id:$ + */ +public class ArchivaDatabaseUpdateTaskExecutorTest + extends PlexusTestCase +{ + private TaskExecutor taskExecutor; + + protected ArchivaDAO dao; + + protected void setUp() + throws Exception + { + super.setUp(); + + DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" ); + assertEquals( DefaultConfigurableJdoFactory.class.getName(), jdoFactory.getClass().getName() ); + + jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" ); + + /* derby version + File derbyDbDir = new File( "target/plexus-home/testdb" ); + if ( derbyDbDir.exists() ) + { + FileUtils.deleteDirectory( derbyDbDir ); + } + + jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) ); + jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) ); + */ + + jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) ); + jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:hsqldb:mem:" + getName() ) ); + + jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) ); + + jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) ); + + jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" ); + + jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" ); + + jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" ); + + jdoFactory.setProperty( "javax.jdo.option.RetainValues", "true" ); + + jdoFactory.setProperty( "javax.jdo.option.RestoreValues", "true" ); + + // jdoFactory.setProperty( "org.jpox.autoCreateColumns", "true" ); + + jdoFactory.setProperty( "org.jpox.validateTables", "true" ); + + jdoFactory.setProperty( "org.jpox.validateColumns", "true" ); + + jdoFactory.setProperty( "org.jpox.validateConstraints", "true" ); + + Properties properties = jdoFactory.getProperties(); + + for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); ) + { + Map.Entry entry = (Map.Entry) it.next(); + + System.setProperty( (String) entry.getKey(), (String) entry.getValue() ); + } + + URL jdoFileUrls[] = new URL[] { getClass() + .getResource( "/org/apache/maven/archiva/model/package.jdo" ) }; + + if ( ( jdoFileUrls == null ) || ( jdoFileUrls[0] == null ) ) + { + fail( "Unable to process test " + getName() + " - missing package.jdo." ); + } + + File propsFile = null; // intentional + boolean verbose = true; + + SchemaTool.deleteSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose ); + SchemaTool.createSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose, null ); + + PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory(); + + assertNotNull( pmf ); + + PersistenceManager pm = pmf.getPersistenceManager(); + + pm.close(); + + this.dao = (ArchivaDAO) lookup( ArchivaDAO.class.getName(), "jdo" ); + + taskExecutor = (TaskExecutor) lookup( TaskExecutor.class, "test-database-update" ); + } + + public void testExecutor() throws Exception + { + RepositoryDAO repoDao = dao.getRepositoryDAO(); + + File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" ); + + assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() ); + + String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" ); + + // Create it + ArchivaRepository repo = + repoDao.createRepository( "testRepo", "Test Repository", repoUri ); + assertNotNull( repo ); + + // Set some mandatory values + repo.getModel().setCreationSource( "Test Case" ); + repo.getModel().setLayoutName( "default" ); + + // Save it. + ArchivaRepository repoSaved = repoDao.saveRepository( repo ); + assertNotNull( repoSaved ); + assertNotNull( repoSaved.getModel() ); + assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() ); + + ArtifactDAO adao = dao.getArtifactDAO(); + + ArchivaArtifact sqlArtifact = adao.createArtifact( "javax.sql", "jdbc", "2.0", "", "jar" ); + sqlArtifact.getModel().setLastModified( new Date() ); + sqlArtifact.getModel().setSize( 1234 ); + sqlArtifact.getModel().setOrigin( "testcase" ); + sqlArtifact.getModel().setWhenProcessed( null ); + + adao.saveArtifact( sqlArtifact ); + + ArchivaArtifact artifact = adao.getArtifact( "javax.sql", "jdbc", "2.0", null, "jar" ); + + assertNotNull( artifact ); + + List unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) ); + + assertNotNull( unprocessedResultList ); + assertEquals("Incorrect number of unprocessed artifacts detected.", 1, unprocessedResultList.size() ); + + DatabaseTask dataTask = new DatabaseTask(); + + dataTask.setName( "testDataTask" ); + + taskExecutor.executeTask( dataTask ); + + List processedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( true ) ); + + assertNotNull( processedResultList ); + assertEquals("Incorrect number of processed artifacts detected.", 1, processedResultList.size() ); + + } + +} diff --git a/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java new file mode 100644 index 000000000..499e7c4ff --- /dev/null +++ b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.java @@ -0,0 +1,180 @@ +package org.apache.maven.archiva.scheduled.executors; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.database.ArchivaDAO; +import org.apache.maven.archiva.database.ArtifactDAO; +import org.apache.maven.archiva.database.RepositoryDAO; +import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint; +import org.apache.maven.archiva.model.ArchivaRepository; +import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; +import org.codehaus.plexus.PlexusTestCase; +import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory; +import org.codehaus.plexus.jdo.JdoFactory; +import org.codehaus.plexus.taskqueue.execution.TaskExecutor; +import org.jpox.SchemaTool; + +import java.io.File; +import java.net.URL; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.jdo.JDOHelper; +import javax.jdo.PersistenceManager; +import javax.jdo.PersistenceManagerFactory; + +/** + * ArchivaRepositoryScanningTaskExecutorTest + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class ArchivaRepositoryScanningTaskExecutorTest + extends PlexusTestCase +{ + private TaskExecutor taskExecutor; + + protected ArchivaDAO dao; + + protected void setUp() + throws Exception + { + super.setUp(); + + DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" ); + assertEquals( DefaultConfigurableJdoFactory.class.getName(), jdoFactory.getClass().getName() ); + + jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" ); + + /* derby version + File derbyDbDir = new File( "target/plexus-home/testdb" ); + if ( derbyDbDir.exists() ) + { + FileUtils.deleteDirectory( derbyDbDir ); + } + + jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) ); + jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) ); + */ + + jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) ); + jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:hsqldb:mem:" + getName() ) ); + + jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) ); + + jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) ); + + jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" ); + + jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" ); + + jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" ); + + jdoFactory.setProperty( "javax.jdo.option.RetainValues", "true" ); + + jdoFactory.setProperty( "javax.jdo.option.RestoreValues", "true" ); + + // jdoFactory.setProperty( "org.jpox.autoCreateColumns", "true" ); + + jdoFactory.setProperty( "org.jpox.validateTables", "true" ); + + jdoFactory.setProperty( "org.jpox.validateColumns", "true" ); + + jdoFactory.setProperty( "org.jpox.validateConstraints", "true" ); + + Properties properties = jdoFactory.getProperties(); + + for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); ) + { + Map.Entry entry = (Map.Entry) it.next(); + + System.setProperty( (String) entry.getKey(), (String) entry.getValue() ); + } + + URL jdoFileUrls[] = new URL[] { getClass() + .getResource( "/org/apache/maven/archiva/model/package.jdo" ) }; + + if ( ( jdoFileUrls == null ) || ( jdoFileUrls[0] == null ) ) + { + fail( "Unable to process test " + getName() + " - missing package.jdo." ); + } + + File propsFile = null; // intentional + boolean verbose = true; + + SchemaTool.deleteSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose ); + SchemaTool.createSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose, null ); + + PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory(); + + assertNotNull( pmf ); + + PersistenceManager pm = pmf.getPersistenceManager(); + + pm.close(); + + this.dao = (ArchivaDAO) lookup( ArchivaDAO.class.getName(), "jdo" ); + + taskExecutor = (TaskExecutor) lookup( TaskExecutor.class, "test-repository-scanning" ); + } + + public void testExecutor() throws Exception + { + RepositoryDAO repoDao = dao.getRepositoryDAO(); + + File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" ); + + assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() ); + + String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" ); + + + // Create it + ArchivaRepository repo = + repoDao.createRepository( "testRepo", "Test Repository", repoUri ); + assertNotNull( repo ); + + // Set some mandatory values + repo.getModel().setCreationSource( "Test Case" ); + repo.getModel().setLayoutName( "default" ); + + // Save it. + ArchivaRepository repoSaved = repoDao.saveRepository( repo ); + assertNotNull( repoSaved ); + assertNotNull( repoSaved.getModel() ); + assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() ); + + RepositoryTask repoTask = new RepositoryTask(); + + repoTask.setName( "testRepoTask" ); + repoTask.setRepositoryId( "testRepo" ); + + taskExecutor.executeTask( repoTask ); + + ArtifactDAO adao = dao.getArtifactDAO(); + List unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) ); + + assertNotNull( unprocessedResultList ); + assertEquals("Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() ); + } +} diff --git a/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.java b/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.java deleted file mode 100644 index 71a4ff540..000000000 --- a/archiva-scheduled/src/test/java/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.java +++ /dev/null @@ -1,200 +0,0 @@ -package org.apache.maven.archiva.scheduled.executors; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import java.io.File; -import java.net.URL; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import javax.jdo.JDOHelper; -import javax.jdo.PersistenceManager; -import javax.jdo.PersistenceManagerFactory; - -import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.database.ArchivaDAO; -import org.apache.maven.archiva.database.ArtifactDAO; -import org.apache.maven.archiva.database.RepositoryDAO; -import org.apache.maven.archiva.database.constraints.ArtifactsProcessedConstraint; -import org.apache.maven.archiva.model.ArchivaArtifact; -import org.apache.maven.archiva.model.ArchivaRepository; -import org.apache.maven.archiva.scheduled.tasks.DatabaseTask; -import org.apache.maven.archiva.scheduled.tasks.RepositoryTask; -import org.codehaus.plexus.PlexusTestCase; -import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory; -import org.codehaus.plexus.jdo.JdoFactory; -import org.codehaus.plexus.taskqueue.execution.TaskExecutor; -import org.jpox.SchemaTool; - -/** - * IndexerTaskExecutorTest - * - * @author Joakim Erdfelt - * @version $Id:$ - */ -public class ArchivaScheduledTaskExecutorTest - extends PlexusTestCase -{ - private TaskExecutor taskExecutor; - - protected ArchivaDAO dao; - - protected void setUp() - throws Exception - { - super.setUp(); - - DefaultConfigurableJdoFactory jdoFactory = (DefaultConfigurableJdoFactory) lookup( JdoFactory.ROLE, "archiva" ); - assertEquals( DefaultConfigurableJdoFactory.class.getName(), jdoFactory.getClass().getName() ); - - jdoFactory.setPersistenceManagerFactoryClass( "org.jpox.PersistenceManagerFactoryImpl" ); - - /* derby version - File derbyDbDir = new File( "target/plexus-home/testdb" ); - if ( derbyDbDir.exists() ) - { - FileUtils.deleteDirectory( derbyDbDir ); - } - - jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.apache.derby.jdbc.EmbeddedDriver" ) ); - jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:derby:" + derbyDbDir.getAbsolutePath() + ";create=true" ) ); - */ - - jdoFactory.setDriverName( System.getProperty( "jdo.test.driver", "org.hsqldb.jdbcDriver" ) ); - jdoFactory.setUrl( System.getProperty( "jdo.test.url", "jdbc:hsqldb:mem:" + getName() ) ); - - jdoFactory.setUserName( System.getProperty( "jdo.test.user", "sa" ) ); - - jdoFactory.setPassword( System.getProperty( "jdo.test.pass", "" ) ); - - jdoFactory.setProperty( "org.jpox.transactionIsolation", "READ_COMMITTED" ); - - jdoFactory.setProperty( "org.jpox.poid.transactionIsolation", "READ_COMMITTED" ); - - jdoFactory.setProperty( "org.jpox.autoCreateSchema", "true" ); - - jdoFactory.setProperty( "javax.jdo.option.RetainValues", "true" ); - - jdoFactory.setProperty( "javax.jdo.option.RestoreValues", "true" ); - - // jdoFactory.setProperty( "org.jpox.autoCreateColumns", "true" ); - - jdoFactory.setProperty( "org.jpox.validateTables", "true" ); - - jdoFactory.setProperty( "org.jpox.validateColumns", "true" ); - - jdoFactory.setProperty( "org.jpox.validateConstraints", "true" ); - - Properties properties = jdoFactory.getProperties(); - - for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); ) - { - Map.Entry entry = (Map.Entry) it.next(); - - System.setProperty( (String) entry.getKey(), (String) entry.getValue() ); - } - - URL jdoFileUrls[] = new URL[] { getClass() - .getResource( "/org/apache/maven/archiva/model/package.jdo" ) }; - - if ( ( jdoFileUrls == null ) || ( jdoFileUrls[0] == null ) ) - { - fail( "Unable to process test " + getName() + " - missing package.jdo." ); - } - - File propsFile = null; // intentional - boolean verbose = true; - - SchemaTool.deleteSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose ); - SchemaTool.createSchemaTables( jdoFileUrls, new URL[] {}, propsFile, verbose, null ); - - PersistenceManagerFactory pmf = jdoFactory.getPersistenceManagerFactory(); - - assertNotNull( pmf ); - - PersistenceManager pm = pmf.getPersistenceManager(); - - pm.close(); - - this.dao = (ArchivaDAO) lookup( ArchivaDAO.class.getName(), "jdo" ); - - taskExecutor = (TaskExecutor) lookup( TaskExecutor.class.getName(), "test-archiva-task-executor" ); - } - - public void testExecutor() throws Exception - { - RepositoryDAO repoDao = dao.getRepositoryDAO(); - - File repoDir = new File( getBasedir(), "src/test/repositories/default-repository" ); - - assertTrue( "Default Test Repository should exist.", repoDir.exists() && repoDir.isDirectory() ); - - String repoUri = "file://" + StringUtils.replace( repoDir.getAbsolutePath(), "\\", "/" ); - - - // Create it - ArchivaRepository repo = - repoDao.createRepository( "testRepo", "Test Repository", repoUri ); - assertNotNull( repo ); - - // Set some mandatory values - repo.getModel().setCreationSource( "Test Case" ); - repo.getModel().setLayoutName( "default" ); - - // Save it. - ArchivaRepository repoSaved = repoDao.saveRepository( repo ); - assertNotNull( repoSaved ); - assertNotNull( repoSaved.getModel() ); - assertEquals( "testRepo", JDOHelper.getObjectId( repoSaved.getModel() ).toString() ); - - RepositoryTask repoTask = new RepositoryTask(); - - repoTask.setName( "testRepoTask" ); - repoTask.setRepositoryId( "testRepo" ); - - taskExecutor.executeTask( repoTask ); - - ArtifactDAO adao = dao.getArtifactDAO(); - - ArchivaArtifact artifact = adao.getArtifact( "javax.sql", "jdbc", "2.0", null, "jar" ); - - assertNotNull( artifact ); - - List unprocessedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( false ) ); - - assertNotNull( unprocessedResultList ); - assertEquals("Incorrect number of unprocessed artifacts detected.", 8, unprocessedResultList.size() ); - - DatabaseTask dataTask = new DatabaseTask(); - - dataTask.setName( "testDataTask" ); - - taskExecutor.executeTask( dataTask ); - - List processedResultList = adao.queryArtifacts( new ArtifactsProcessedConstraint( true ) ); - - assertNotNull( processedResultList ); - assertEquals("Incorrect number of processed artifacts detected.", 8, processedResultList.size() ); - - } - -} diff --git a/archiva-scheduled/src/test/repositories/default-repository/javax/sql/jdbc/2.0/jdbc-2.0.jar.md5 b/archiva-scheduled/src/test/repositories/default-repository/javax/sql/jdbc/2.0/jdbc-2.0.jar.md5 new file mode 100644 index 000000000..ef7483fad --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/javax/sql/jdbc/2.0/jdbc-2.0.jar.md5 @@ -0,0 +1 @@ +d41d8cd98f00b204e9800998ecf8427e jdbc-2.0.jar \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/javax/sql/jdbc/2.0/jdbc-2.0.jar.sha1 b/archiva-scheduled/src/test/repositories/default-repository/javax/sql/jdbc/2.0/jdbc-2.0.jar.sha1 new file mode 100644 index 000000000..4bc014766 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/javax/sql/jdbc/2.0/jdbc-2.0.jar.sha1 @@ -0,0 +1 @@ +da39a3ee5e6b4b0d3255bfef95601890afd80709 jdbc-2.0.jar \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.pom.md5 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.pom.md5 new file mode 100644 index 000000000..78a953bc5 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.pom.md5 @@ -0,0 +1 @@ +bc479af1df809dbabb92e29548776b84 A-1.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.pom.sha1 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.pom.sha1 new file mode 100644 index 000000000..71d6233aa --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.pom.sha1 @@ -0,0 +1 @@ +fbb4c97603c64f3915c88243e1ea49f1a238afa7 A-1.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.war.md5 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.war.md5 new file mode 100644 index 000000000..665059bc7 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.war.md5 @@ -0,0 +1 @@ +fd4275a6811332d67075ffd879d13d4a A-1.0.war \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.war.sha1 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.war.sha1 new file mode 100644 index 000000000..c8494eb9d --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/A/1.0/A-1.0.war.sha1 @@ -0,0 +1 @@ +754133cd9c36adef86d35b96c0e96e11a9c6bfc9 A-1.0.war \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/1.0/B-1.0.pom.md5 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/1.0/B-1.0.pom.md5 new file mode 100644 index 000000000..2324bce0c --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/1.0/B-1.0.pom.md5 @@ -0,0 +1 @@ +c543ad342d1de7a4352fc9b0f42067b8 B-1.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/1.0/B-1.0.pom.sha1 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/1.0/B-1.0.pom.sha1 new file mode 100644 index 000000000..d8d5abce7 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/1.0/B-1.0.pom.sha1 @@ -0,0 +1 @@ +be06d04d5824859253abf423394dc85d24971ba8 B-1.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/2.0/B-2.0.pom.md5 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/2.0/B-2.0.pom.md5 new file mode 100644 index 000000000..4ddd22b82 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/2.0/B-2.0.pom.md5 @@ -0,0 +1 @@ +1af6c812f02f24e1ba287647a6856cd5 B-2.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/2.0/B-2.0.pom.sha1 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/2.0/B-2.0.pom.sha1 new file mode 100644 index 000000000..95912764c --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/B/2.0/B-2.0.pom.sha1 @@ -0,0 +1 @@ +5d49f821499ab061c97457b3e6512fd1624a3033 B-2.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.pom.md5 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.pom.md5 new file mode 100644 index 000000000..d08745961 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.pom.md5 @@ -0,0 +1 @@ +90f5c062bded5f794cd4ea9479b35173 C-1.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.pom.sha1 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.pom.sha1 new file mode 100644 index 000000000..fbe7bd338 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.pom.sha1 @@ -0,0 +1 @@ +fcefa8220d30b7aa72a1b7422cc06336ca14bb6f C-1.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.war.md5 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.war.md5 new file mode 100644 index 000000000..4eb175498 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.war.md5 @@ -0,0 +1 @@ +fd4275a6811332d67075ffd879d13d4a C-1.0.war \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.war.sha1 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.war.sha1 new file mode 100644 index 000000000..78e0b6eb7 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/maven/C/1.0/C-1.0.war.sha1 @@ -0,0 +1 @@ +754133cd9c36adef86d35b96c0e96e11a9c6bfc9 C-1.0.war \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom.md5 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom.md5 new file mode 100644 index 000000000..b163670f2 --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom.md5 @@ -0,0 +1 @@ +764dd493029133aff4c0f7cb4be2d9b7 discovery-1.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/repositories/default-repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom.sha1 b/archiva-scheduled/src/test/repositories/default-repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom.sha1 new file mode 100644 index 000000000..dedf18ade --- /dev/null +++ b/archiva-scheduled/src/test/repositories/default-repository/org/apache/testgroup/discovery/1.0/discovery-1.0.pom.sha1 @@ -0,0 +1 @@ +a7aaf680caaf5bb971753e047c439f3fd4efa473 discovery-1.0.pom \ No newline at end of file diff --git a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.xml b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.xml new file mode 100644 index 000000000..a97332c1e --- /dev/null +++ b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaDatabaseUpdateTaskExecutorTest.xml @@ -0,0 +1,78 @@ + + + + + + + org.codehaus.plexus.taskqueue.execution.TaskExecutor + test-database-update + org.apache.maven.archiva.scheduled.executors.ArchivaDatabaseUpdateTaskExecutor + + + + org.apache.maven.archiva.database.updater.DatabaseUpdater + jdo + databaseUpdater + + + + + + org.apache.maven.archiva.configuration.ArchivaConfiguration + test-configuration + org.apache.maven.archiva.configuration.DefaultArchivaConfiguration + + + org.codehaus.plexus.registry.Registry + configured + + + + + + org.codehaus.plexus.registry.Registry + configured + org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry + + + + + + + + + + org.codehaus.plexus.jdo.JdoFactory + archiva + org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory + + org.jpox.PersistenceManagerFactoryImpl + + + javax.jdo.PersistenceManagerFactoryClass + org.jpox.PersistenceManagerFactoryImpl + + + + + + + diff --git a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml new file mode 100644 index 000000000..1b51eb582 --- /dev/null +++ b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutorTest.xml @@ -0,0 +1,86 @@ + + + + + + + org.codehaus.plexus.taskqueue.execution.TaskExecutor + test-repository-scanning + org.apache.maven.archiva.scheduled.executors.ArchivaRepositoryScanningTaskExecutor + + + + org.apache.maven.archiva.database.ArchivaDAO + jdo + dao + + + org.apache.maven.archiva.database.RepositoryDAO + jdo + repositoryDAO + + + org.apache.maven.archiva.repository.scanner.RepositoryScanner + repoScanner + + + + + + org.apache.maven.archiva.configuration.ArchivaConfiguration + org.apache.maven.archiva.configuration.DefaultArchivaConfiguration + + + org.codehaus.plexus.registry.Registry + configured + + + + + + org.codehaus.plexus.registry.Registry + configured + org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry + + + + + + + + + + org.codehaus.plexus.jdo.JdoFactory + archiva + org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory + + org.jpox.PersistenceManagerFactoryImpl + + + javax.jdo.PersistenceManagerFactoryClass + org.jpox.PersistenceManagerFactoryImpl + + + + + + + diff --git a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.xml b/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.xml deleted file mode 100644 index 17d200f5c..000000000 --- a/archiva-scheduled/src/test/resources/org/apache/maven/archiva/scheduled/executors/ArchivaScheduledTaskExecutorTest.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - org.codehaus.plexus.taskqueue.execution.TaskExecutor - test-archiva-task-executor - org.apache.maven.archiva.scheduled.executors.ArchivaScheduledTaskExecutor - - - - org.apache.maven.archiva.configuration.ArchivaConfiguration - archivaConfiguration - test-configuration - - - org.apache.maven.archiva.database.updater.DatabaseUpdater - jdo - databaseUpdater - - - org.apache.maven.archiva.database.RepositoryDAO - jdo - repositoryDAO - - - org.apache.maven.archiva.consumers.ArchivaArtifactConsumer - availableDBConsumers - - - org.apache.maven.archiva.consumers.RepositoryContentConsumer - availableRepositoryConsumers - - - - - - org.apache.maven.archiva.configuration.ArchivaConfiguration - test-configuration - org.apache.maven.archiva.configuration.DefaultArchivaConfiguration - - - org.codehaus.plexus.registry.Registry - configured - - - - - - org.codehaus.plexus.registry.Registry - configured - org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry - - - - - - - - - - org.codehaus.plexus.jdo.JdoFactory - archiva - org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory - - org.jpox.PersistenceManagerFactoryImpl - - - javax.jdo.PersistenceManagerFactoryClass - org.jpox.PersistenceManagerFactoryImpl - - - - - - - diff --git a/archiva-web/archiva-webapp/src/appserver-base/conf/archiva.xml b/archiva-web/archiva-webapp/src/appserver-base/conf/archiva.xml deleted file mode 100644 index 9afb83352..000000000 --- a/archiva-web/archiva-webapp/src/appserver-base/conf/archiva.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java index ffdbeb6eb..fcb345892 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/IndexRepositoryAction.java @@ -20,6 +20,7 @@ package org.apache.maven.archiva.web.action.admin; */ import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.common.ArchivaException; import org.apache.maven.archiva.scheduled.ArchivaTaskScheduler; import org.apache.maven.archiva.scheduled.DefaultArchivaTaskScheduler; import org.apache.maven.archiva.scheduled.tasks.ArchivaTask; @@ -63,27 +64,35 @@ public class IndexRepositoryAction boolean scheduleTask = false; - if ( taskScheduler.getTaskQueue().hasFilesystemTaskInQueue() ) + try { - if ( taskScheduler.getTaskQueue().hasRepositoryTaskInQueue( repoid ) ) + if ( taskScheduler.isProcessingAnyRepositoryTask() ) { - addActionError( "Repository [" + repoid + "] task was already queued." ); + if ( taskScheduler.isProcessingRepositoryTask( repoid ) ) + { + addActionError( "Repository [" + repoid + "] task was already queued." ); + } + else + { + scheduleTask = true; + } } else { scheduleTask = true; } } - else + catch ( ArchivaException e ) { - scheduleTask = true; + scheduleTask = false; + addActionError( e.getMessage() ); } if ( scheduleTask ) { try { - taskScheduler.getTaskQueue().put( task ); + taskScheduler.queueRepositoryTask( task ); addActionMessage( "Your request to have repository [" + repoid + "] be indexed has been queued." ); } catch ( TaskQueueException e ) @@ -97,6 +106,18 @@ public class IndexRepositoryAction return SUCCESS; } + public void addActionMessage( String aMessage ) + { + super.addActionMessage( aMessage ); + getLogger().info( "[ActionMessage] " + aMessage ); + } + + public void addActionError( String anErrorMessage ) + { + super.addActionError( anErrorMessage ); + getLogger().warn( "[ActionError] " + anErrorMessage ); + } + public SecureActionBundle getSecureActionBundle() throws SecureActionException { diff --git a/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml b/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml index b884efce6..13b9ddee7 100644 --- a/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml +++ b/archiva-web/archiva-webapp/src/main/resources/META-INF/plexus/application.xml @@ -19,8 +19,30 @@ --> - + + + org.apache.maven.archiva.configuration.ConfigurationUpgrade + default + + + org.apache.maven.archiva.web.startup.ConfigurationSynchronization + default + + + org.apache.maven.archiva.scheduled.ArchivaTaskScheduler + default + + + org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor + database-update + + + org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor + repository-scanning + + + org.codehaus.plexus.registry.Registry org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry @@ -194,29 +216,6 @@ - - - org.apache.maven.archiva.configuration.ConfigurationUpgrade - default - - - org.apache.maven.archiva.web.startup.ConfigurationSynchronization - default - - - org.apache.maven.archiva.web.startup.ConfigurationSynchronization - default - - - org.apache.maven.archiva.scheduled.ArchivaTaskScheduler - default - - - org.codehaus.plexus.taskqueue.execution.TaskExecutor - archiva-task-executor - - - plexus -- cgit v1.2.3