]> source.dussan.org Git - archiva.git/commitdiff
during ManagedRepository update save only once as it cause some issues on RegistryLis...
authorOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 12:02:18 +0000 (12:02 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 13 Sep 2011 12:02:18 +0000 (12:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1170130 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java

index 42568b21631c38db7198063eaf4e8db15b9cc080..e525c3bc954c63daf29f3f64dd3c085b8d219920 100644 (file)
@@ -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<String> repos = new ArrayList<String>( 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();