From: Maria Odea B. Ching Date: Tue, 28 Jul 2009 05:04:44 +0000 (+0000) Subject: [MRM-1212]/[MRM-1197] do not execute create-missing-checksum and metadata-updater... X-Git-Tag: archiva-1.2.2~30 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5e5fa749a240662560a74a983e2f6eae3fed9ff9;p=archiva.git [MRM-1212]/[MRM-1197] do not execute create-missing-checksum and metadata-updater consumers during webdav deployment git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@798403 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java index a59448208..41fbafa60 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -585,7 +585,7 @@ public class DefaultRepositoryProxyConnectors private void queueRepositoryTask( String repositoryId, File localFile ) { - RepositoryTask task = TaskCreator.createRepositoryTask( repositoryId, localFile.getName(), localFile ); + RepositoryTask task = TaskCreator.createRepositoryTask( repositoryId, localFile.getName(), localFile, true ); try { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java index e8e4ee521..ec54b041e 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumers.java @@ -58,7 +58,7 @@ public class RepositoryContentConsumers private List selectedKnownConsumers; private List selectedInvalidConsumers; - + public RepositoryContentConsumers( ArchivaConfiguration archivaConfiguration ) { this.archivaConfiguration = archivaConfiguration; @@ -229,8 +229,9 @@ public class RepositoryContentConsumers * * @param repository the repository configuration to use. * @param localFile the local file to execute the consumers against. + * @param updateRelatedArtifacts TODO */ - public void executeConsumers( ManagedRepositoryConfiguration repository, File localFile ) + public void executeConsumers( ManagedRepositoryConfiguration repository, File localFile, boolean updateRelatedArtifacts ) { // Run the repository consumers try @@ -238,6 +239,24 @@ public class RepositoryContentConsumers Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime() ); List selectedKnownConsumers = getSelectedKnownConsumers(); + + // MRM-1212/MRM-1197 + // - do not create missing/fix invalid checksums and update metadata when deploying from webdav since these are uploaded by maven + if( updateRelatedArtifacts == false ) + { + List clone = new ArrayList(); + clone.addAll( selectedKnownConsumers ); + + for( KnownRepositoryContentConsumer consumer : clone ) + { + if( consumer.getId().equals( "create-missing-checksums" ) || + consumer.getId().equals( "metadata-updater" ) ) + { + selectedKnownConsumers.remove( consumer ); + } + } + } + List selectedInvalidConsumers = getSelectedInvalidConsumers(); CollectionUtils.forAllDo( selectedKnownConsumers, triggerBeginScan ); CollectionUtils.forAllDo( selectedInvalidConsumers, triggerBeginScan ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java index 5906c7641..86c4b5370 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/scanner/RepositoryContentConsumersTest.java @@ -254,7 +254,7 @@ public class RepositoryContentConsumersTest // invalidConsumer.completeScan(); invalidControl.replay(); - consumers.executeConsumers( repo, testFile ); + consumers.executeConsumers( repo, testFile, true ); knownControl.verify(); invalidControl.verify(); @@ -279,7 +279,7 @@ public class RepositoryContentConsumersTest // invalidConsumer.completeScan(); invalidControl.replay(); - consumers.executeConsumers( repo, notIncludedTestFile ); + consumers.executeConsumers( repo, notIncludedTestFile, true ); knownControl.verify(); invalidControl.verify(); @@ -302,12 +302,12 @@ public class RepositoryContentConsumersTest // invalidConsumer.completeScan(); invalidControl.replay(); - consumers.executeConsumers( repo, excludedTestFile ); + consumers.executeConsumers( repo, excludedTestFile, true ); knownControl.verify(); invalidControl.verify(); } - + /** * Create an OS specific version of the filepath. * Provide path in unix "/" format. diff --git a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java index 98c376930..99ef2fece 100644 --- a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java +++ b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/executors/ArchivaRepositoryScanningTaskExecutor.java @@ -113,7 +113,7 @@ public class ArchivaRepositoryScanningTaskExecutor if( repoTask.getResourceFile() != null ) { log.debug( "Executing task from queue with job name: " + repoTask.getName() ); - consumers.executeConsumers( arepo, repoTask.getResourceFile() ); + consumers.executeConsumers( arepo, repoTask.getResourceFile(), repoTask.isUpdateRelatedArtifacts() ); } else { diff --git a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/RepositoryTask.java b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/RepositoryTask.java index d18afcf61..f20445135 100644 --- a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/RepositoryTask.java +++ b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/RepositoryTask.java @@ -40,6 +40,8 @@ public class RepositoryTask File resourceFile; + boolean updateRelatedArtifacts; + public String getRepositoryId() { return repositoryId; @@ -89,4 +91,14 @@ public class RepositoryTask { this.resourceFile = resourceFile; } + + public boolean isUpdateRelatedArtifacts() + { + return updateRelatedArtifacts; + } + + public void setUpdateRelatedArtifacts( boolean updateRelatedArtifacts ) + { + this.updateRelatedArtifacts = updateRelatedArtifacts; + } } diff --git a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/TaskCreator.java b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/TaskCreator.java index 1a7692761..60e4c8814 100644 --- a/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/TaskCreator.java +++ b/archiva-modules/archiva-scheduled/src/main/java/org/apache/maven/archiva/scheduled/tasks/TaskCreator.java @@ -47,11 +47,13 @@ public class TaskCreator return task; } - public static RepositoryTask createRepositoryTask( String repositoryId, String taskNameSuffix, File resourceFile ) + public static RepositoryTask createRepositoryTask( String repositoryId, String taskNameSuffix, File resourceFile, + boolean updateRelatedArtifacts ) { RepositoryTask task = createRepositoryTask( repositoryId, taskNameSuffix ); task.setResourceFile( resourceFile ); - + task.setUpdateRelatedArtifacts( updateRelatedArtifacts ); + return task; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java index 349f4eab9..e64a46d0c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java @@ -617,7 +617,7 @@ public class UploadAction private void queueRepositoryTask( String repositoryId, File localFile ) { - RepositoryTask task = TaskCreator.createRepositoryTask( repositoryId, localFile.getName(), localFile ); + RepositoryTask task = TaskCreator.createRepositoryTask( repositoryId, localFile.getName(), localFile, true ); try { diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java index e5a9daa5b..524de1be6 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java @@ -322,7 +322,7 @@ public class ArchivaDavResource triggerAuditEvent( resource, AuditEvent.CREATE_DIR ); } else - { + { throw new DavException( HttpServletResponse.SC_BAD_REQUEST, "Could not write member " + resource.getResourcePath() + " at " + getResourcePath() ); } @@ -632,8 +632,8 @@ public class ArchivaDavResource } private void queueRepositoryTask( File localFile ) - { - RepositoryTask task = TaskCreator.createRepositoryTask( repository.getId(), localFile.getName(), localFile ); + { + RepositoryTask task = TaskCreator.createRepositoryTask( repository.getId(), localFile.getName(), localFile, false ); try {