reload field in case of configuration change

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1445993 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-02-13 23:53:27 +00:00
parent f5f2a56e53
commit 7711abea0d
2 changed files with 13 additions and 4 deletions

View 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 );
}
}

View 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;
}
}