[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
This commit is contained in:
Maria Odea B. Ching 2009-07-28 05:04:44 +00:00
parent 8053590db6
commit 5e5fa749a2
8 changed files with 47 additions and 14 deletions

View File

@ -585,7 +585,7 @@ public class DefaultRepositoryProxyConnectors
private void queueRepositoryTask( String repositoryId, File localFile ) 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 try
{ {

View File

@ -58,7 +58,7 @@ public class RepositoryContentConsumers
private List<KnownRepositoryContentConsumer> selectedKnownConsumers; private List<KnownRepositoryContentConsumer> selectedKnownConsumers;
private List<InvalidRepositoryContentConsumer> selectedInvalidConsumers; private List<InvalidRepositoryContentConsumer> selectedInvalidConsumers;
public RepositoryContentConsumers( ArchivaConfiguration archivaConfiguration ) public RepositoryContentConsumers( ArchivaConfiguration archivaConfiguration )
{ {
this.archivaConfiguration = archivaConfiguration; this.archivaConfiguration = archivaConfiguration;
@ -229,8 +229,9 @@ public class RepositoryContentConsumers
* *
* @param repository the repository configuration to use. * @param repository the repository configuration to use.
* @param localFile the local file to execute the consumers against. * @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 // Run the repository consumers
try try
@ -238,6 +239,24 @@ public class RepositoryContentConsumers
Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime() ); Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime() );
List<KnownRepositoryContentConsumer> selectedKnownConsumers = getSelectedKnownConsumers(); List<KnownRepositoryContentConsumer> 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<KnownRepositoryContentConsumer> clone = new ArrayList<KnownRepositoryContentConsumer>();
clone.addAll( selectedKnownConsumers );
for( KnownRepositoryContentConsumer consumer : clone )
{
if( consumer.getId().equals( "create-missing-checksums" ) ||
consumer.getId().equals( "metadata-updater" ) )
{
selectedKnownConsumers.remove( consumer );
}
}
}
List<InvalidRepositoryContentConsumer> selectedInvalidConsumers = getSelectedInvalidConsumers(); List<InvalidRepositoryContentConsumer> selectedInvalidConsumers = getSelectedInvalidConsumers();
CollectionUtils.forAllDo( selectedKnownConsumers, triggerBeginScan ); CollectionUtils.forAllDo( selectedKnownConsumers, triggerBeginScan );
CollectionUtils.forAllDo( selectedInvalidConsumers, triggerBeginScan ); CollectionUtils.forAllDo( selectedInvalidConsumers, triggerBeginScan );

View File

@ -254,7 +254,7 @@ public class RepositoryContentConsumersTest
// invalidConsumer.completeScan(); // invalidConsumer.completeScan();
invalidControl.replay(); invalidControl.replay();
consumers.executeConsumers( repo, testFile ); consumers.executeConsumers( repo, testFile, true );
knownControl.verify(); knownControl.verify();
invalidControl.verify(); invalidControl.verify();
@ -279,7 +279,7 @@ public class RepositoryContentConsumersTest
// invalidConsumer.completeScan(); // invalidConsumer.completeScan();
invalidControl.replay(); invalidControl.replay();
consumers.executeConsumers( repo, notIncludedTestFile ); consumers.executeConsumers( repo, notIncludedTestFile, true );
knownControl.verify(); knownControl.verify();
invalidControl.verify(); invalidControl.verify();
@ -302,12 +302,12 @@ public class RepositoryContentConsumersTest
// invalidConsumer.completeScan(); // invalidConsumer.completeScan();
invalidControl.replay(); invalidControl.replay();
consumers.executeConsumers( repo, excludedTestFile ); consumers.executeConsumers( repo, excludedTestFile, true );
knownControl.verify(); knownControl.verify();
invalidControl.verify(); invalidControl.verify();
} }
/** /**
* Create an OS specific version of the filepath. * Create an OS specific version of the filepath.
* Provide path in unix "/" format. * Provide path in unix "/" format.

View File

@ -113,7 +113,7 @@ public class ArchivaRepositoryScanningTaskExecutor
if( repoTask.getResourceFile() != null ) if( repoTask.getResourceFile() != null )
{ {
log.debug( "Executing task from queue with job name: " + repoTask.getName() ); log.debug( "Executing task from queue with job name: " + repoTask.getName() );
consumers.executeConsumers( arepo, repoTask.getResourceFile() ); consumers.executeConsumers( arepo, repoTask.getResourceFile(), repoTask.isUpdateRelatedArtifacts() );
} }
else else
{ {

View File

@ -40,6 +40,8 @@ public class RepositoryTask
File resourceFile; File resourceFile;
boolean updateRelatedArtifacts;
public String getRepositoryId() public String getRepositoryId()
{ {
return repositoryId; return repositoryId;
@ -89,4 +91,14 @@ public class RepositoryTask
{ {
this.resourceFile = resourceFile; this.resourceFile = resourceFile;
} }
public boolean isUpdateRelatedArtifacts()
{
return updateRelatedArtifacts;
}
public void setUpdateRelatedArtifacts( boolean updateRelatedArtifacts )
{
this.updateRelatedArtifacts = updateRelatedArtifacts;
}
} }

View File

@ -47,11 +47,13 @@ public class TaskCreator
return task; 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 ); RepositoryTask task = createRepositoryTask( repositoryId, taskNameSuffix );
task.setResourceFile( resourceFile ); task.setResourceFile( resourceFile );
task.setUpdateRelatedArtifacts( updateRelatedArtifacts );
return task; return task;
} }

View File

@ -617,7 +617,7 @@ public class UploadAction
private void queueRepositoryTask( String repositoryId, File localFile ) 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 try
{ {

View File

@ -322,7 +322,7 @@ public class ArchivaDavResource
triggerAuditEvent( resource, AuditEvent.CREATE_DIR ); triggerAuditEvent( resource, AuditEvent.CREATE_DIR );
} }
else else
{ {
throw new DavException( HttpServletResponse.SC_BAD_REQUEST, "Could not write member " + throw new DavException( HttpServletResponse.SC_BAD_REQUEST, "Could not write member " +
resource.getResourcePath() + " at " + getResourcePath() ); resource.getResourcePath() + " at " + getResourcePath() );
} }
@ -632,8 +632,8 @@ public class ArchivaDavResource
} }
private void queueRepositoryTask( File localFile ) 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 try
{ {