From: Olivier Lamy Date: Tue, 13 Sep 2011 12:02:18 +0000 (+0000) Subject: during ManagedRepository update save only once as it cause some issues on RegistryLis... X-Git-Tag: archiva-1.4-M1~327 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b4959a42f5873905e7306c1365044896e722e3f5;p=archiva.git during ManagedRepository update save only once as it cause some issues on RegistryListener (repo not found at the first save after removing the updated repo) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170130 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java index 42568b216..e525c3bc9 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java @@ -152,7 +152,8 @@ public class DefaultManagedRepositoryAdmin managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo, managedRepository.getCronExpression(), managedRepository.getIndexDirectory(), managedRepository.getDaysOlder(), managedRepository.getRetentionCount(), - managedRepository.isDeleteReleasedSnapshots(), auditInformation ) != null; + managedRepository.isDeleteReleasedSnapshots(), auditInformation, + getArchivaConfiguration().getConfiguration() ) != null; } @@ -162,12 +163,11 @@ public class DefaultManagedRepositoryAdmin boolean stageRepoNeeded, String cronExpression, String indexDir, int daysOlder, int retentionCount, boolean deteleReleasedSnapshots, - AuditInformation auditInformation ) + AuditInformation auditInformation, + Configuration config ) throws RepositoryAdminException { - Configuration config = getArchivaConfiguration().getConfiguration(); - // FIXME : olamy can be empty to avoid scheduled scan ? if ( StringUtils.isNotBlank( cronExpression ) ) { @@ -349,7 +349,8 @@ public class DefaultManagedRepositoryAdmin for ( String repoGroup : repoGroups ) { // copy to prevent UnsupportedOperationException - RepositoryGroupConfiguration repositoryGroupConfiguration = config.findRepositoryGroupById( repoGroup ); + RepositoryGroupConfiguration repositoryGroupConfiguration = + config.findRepositoryGroupById( repoGroup ); List repos = new ArrayList( repositoryGroupConfiguration.getRepositories() ); config.removeRepositoryGroup( repositoryGroupConfiguration ); repos.remove( repository.getId() ); @@ -405,18 +406,14 @@ public class DefaultManagedRepositoryAdmin configuration.removeManagedRepository( stagingRepository ); } - if ( toremove != null && stagingRepository != null ) - { - saveConfiguration( configuration ); - } - ManagedRepositoryConfiguration managedRepositoryConfiguration = addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(), managedRepository.getLocation(), managedRepository.isBlockRedeployments(), managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo, managedRepository.getCronExpression(), managedRepository.getIndexDirectory(), managedRepository.getDaysOlder(), managedRepository.getRetentionCount(), - managedRepository.isDeleteReleasedSnapshots(), auditInformation ); + managedRepository.isDeleteReleasedSnapshots(), auditInformation, + getArchivaConfiguration().getConfiguration() ); // Save the repository configuration. RepositorySession repositorySession = getRepositorySessionFactory().createSession();