]> source.dussan.org Git - archiva.git/commitdiff
optimize a bit: no need to fully rebuild the bean if no change
authorOlivier Lamy <olamy@apache.org>
Wed, 13 Feb 2013 20:21:54 +0000 (20:21 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 13 Feb 2013 20:21:54 +0000 (20:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1445900 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java

index c4c59dd448ec909267f9d5bdbf43cfd7c8a8a44e..cf12b6877ccc7ede8b915571b42017cb0f22eb9d 100644 (file)
@@ -69,6 +69,8 @@ public class DefaultRedbackRuntimeConfigurationAdmin
     @Named( value = "cache#users" )
     private Cache usersCache;
 
+    private RedbackRuntimeConfiguration currentRedbackRuntimeConfiguration;
+
     @PostConstruct
     public void initialize()
         throws UserConfigurationException
@@ -217,6 +219,8 @@ public class DefaultRedbackRuntimeConfigurationAdmin
                 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
             }
 
+            this.currentRedbackRuntimeConfiguration = redbackRuntimeConfiguration;
+
         }
         catch ( RepositoryAdminException e )
         {
@@ -239,6 +243,7 @@ public class DefaultRedbackRuntimeConfigurationAdmin
         try
         {
             archivaConfiguration.save( configuration );
+            this.currentRedbackRuntimeConfiguration = redbackRuntimeConfiguration;
         }
         catch ( RegistryException e )
         {
@@ -253,6 +258,10 @@ public class DefaultRedbackRuntimeConfigurationAdmin
     private RedbackRuntimeConfiguration build(
         org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration )
     {
+        if ( this.currentRedbackRuntimeConfiguration != null )
+        {
+            return this.currentRedbackRuntimeConfiguration;
+        }
         RedbackRuntimeConfiguration redbackRuntimeConfiguration =
             new BeanReplicator().replicateBean( runtimeConfiguration, RedbackRuntimeConfiguration.class );
 
@@ -283,7 +292,9 @@ public class DefaultRedbackRuntimeConfigurationAdmin
 
         cleanupProperties( redbackRuntimeConfiguration );
 
-t         return redbackRuntimeConfiguration;
+        this.currentRedbackRuntimeConfiguration = redbackRuntimeConfiguration;
+
+        return redbackRuntimeConfiguration;
     }
 
     /**
@@ -307,13 +318,13 @@ t         return redbackRuntimeConfiguration;
         properties.remove( UserConfigurationKeys.LDAP_WRITABLE );
         properties.remove( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME );
         // cleanup groups <-> role mapping
-        for ( Map.Entry<String, String> entry : new HashMap<String, String>( properties ).entrySet() )
-        {
-            if ( entry.getKey().startsWith( UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
-            {
-                properties.remove( entry.getKey() );
-            }
-        }
+        /**for ( Map.Entry<String, String> entry : new HashMap<String, String>( properties ).entrySet() )
+         {
+         if ( entry.getKey().startsWith( UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
+         {
+         properties.remove( entry.getKey() );
+         }
+         }*/
     }
 
     private org.apache.archiva.configuration.RedbackRuntimeConfiguration build(