]> source.dussan.org Git - archiva.git/commitdiff
reload field in case of configuration change
authorOlivier Lamy <olamy@apache.org>
Wed, 13 Feb 2013 23:53:27 +0000 (23:53 +0000)
committerOlivier Lamy <olamy@apache.org>
Wed, 13 Feb 2013 23:53:27 +0000 (23:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1445993 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
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java

index cf12b6877ccc7ede8b915571b42017cb0f22eb9d..52a97753db3539cb98d9a497717a93d2b4ed2bd9 100644 (file)
@@ -26,6 +26,8 @@ import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
 import org.apache.archiva.admin.model.runtime.RedbackRuntimeConfigurationAdmin;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.configuration.Configuration;
+import org.apache.archiva.configuration.ConfigurationEvent;
+import org.apache.archiva.configuration.ConfigurationListener;
 import org.apache.archiva.configuration.IndeterminateConfigurationException;
 import org.apache.archiva.redback.components.cache.Cache;
 import org.apache.archiva.redback.components.registry.RegistryException;
@@ -53,7 +55,7 @@ import java.util.Set;
  */
 @Service( "userConfiguration#archiva" )
 public class DefaultRedbackRuntimeConfigurationAdmin
-    implements RedbackRuntimeConfigurationAdmin, UserConfiguration
+    implements RedbackRuntimeConfigurationAdmin, UserConfiguration, ConfigurationListener
 {
 
     protected Logger log = LoggerFactory.getLogger( getClass() );
@@ -230,7 +232,7 @@ public class DefaultRedbackRuntimeConfigurationAdmin
 
     public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
     {
-        return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration() );
+        return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration(), false );
     }
 
     public void updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
@@ -256,9 +258,9 @@ public class DefaultRedbackRuntimeConfigurationAdmin
     }
 
     private RedbackRuntimeConfiguration build(
-        org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration )
+        org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration, boolean force )
     {
-        if ( this.currentRedbackRuntimeConfiguration != null )
+        if ( this.currentRedbackRuntimeConfiguration != null && !force )
         {
             return this.currentRedbackRuntimeConfiguration;
         }
@@ -626,4 +628,9 @@ public class DefaultRedbackRuntimeConfigurationAdmin
 
         return keysSet;
     }
+
+    public void configurationEvent( ConfigurationEvent event )
+    {
+        build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration(), true );
+    }
 }
index a4e9fd304fa577f37a5eb2f1be84b9fdafdea406..9a6df42378f865ae0237e3529c7f376a0f70b737 100644 (file)
@@ -37,6 +37,7 @@ import org.apache.archiva.redback.users.UserManager;
 import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.RedbackRuntimeConfigurationService;
+
 import org.apache.commons.lang.StringUtils;
 import org.springframework.context.ApplicationContext;
 import org.springframework.stereotype.Service;
@@ -288,6 +289,7 @@ public class DefaultRedbackRuntimeConfigurationService
         }
         return properties;
     }
+
 }