Fix for AMP init/bootstrap issue found by RW. Also, WebClientConfigBootstrap is now a ConfigDeployer to ensure AMP config is not lost in case of cache invalidation/reset (in preparation for dynamic WebClient config).

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6630 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2007-08-29 14:48:48 +00:00
parent cac4f143bd
commit 7c238af116
2 changed files with 43 additions and 9 deletions

View File

@@ -26,11 +26,11 @@ package org.alfresco.web.config;
import java.util.List;
import org.alfresco.config.ConfigDeployer;
import org.alfresco.config.ConfigService;
import org.alfresco.config.ConfigSource;
import org.alfresco.config.source.UrlConfigSource;
import org.alfresco.error.AlfrescoRuntimeException;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -40,11 +40,14 @@ import org.springframework.context.ApplicationContextAware;
*
* @author Roy Wetherall
*/
public class WebClientConfigBootstrap implements ApplicationContextAware
public class WebClientConfigBootstrap implements ApplicationContextAware, ConfigDeployer
{
/** The application context */
private ApplicationContext applicationContext;
/** Dependency */
private ConfigService configService;
/** List of configs */
private List<String> configs;
@@ -59,17 +62,21 @@ public class WebClientConfigBootstrap implements ApplicationContextAware
}
/**
* Initialisation method
*
* @deprecated
*/
public void init()
{
// TODO - see JIRA Task AR-1715 - refactor calling modules to inject webClientConfigService, and use init-method="register" directly
// (instead of init-method="init"). Can then remove applicationContext and no longer implement ApplicationContextAware
if (this.applicationContext.containsBean("webClientConfigService") == true)
{
ConfigService configService = (ConfigService)this.applicationContext.getBean("webClientConfigService");
if (configService != null && this.configs != null && this.configs.size() != 0)
if (configService != null)
{
UrlConfigSource configSource = new UrlConfigSource(this.configs);
configService.appendConfig(configSource);
setConfigService(configService);
register();
}
}
}
@@ -78,4 +85,31 @@ public class WebClientConfigBootstrap implements ApplicationContextAware
{
this.applicationContext = applicationContext;
}
public void setConfigService(ConfigService configService)
{
this.configService = configService;
}
public void register()
{
if (configService == null)
{
throw new AlfrescoRuntimeException("Config service must be provided");
}
configService.addDeployer(this);
}
/**
* Initialisation method
*/
public void initConfig()
{
if (configService != null && this.configs != null && this.configs.size() != 0)
{
UrlConfigSource configSource = new UrlConfigSource(this.configs);
configService.appendConfig(configSource);
}
}
}