From: Olivier Lamy Date: Wed, 13 Feb 2013 23:53:27 +0000 (+0000) Subject: reload field in case of configuration change X-Git-Tag: archiva-1.4-M4~193 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7711abea0d4ae0659353eda78b47b6ec49c207eb;p=archiva.git reload field in case of configuration change git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1445993 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java index cf12b6877..52a97753d 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java @@ -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 ); + } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java index a4e9fd304..9a6df4237 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java @@ -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; } + }