mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -22,7 +22,7 @@
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="webClientConfigService" class="org.alfresco.config.xml.XMLConfigService" init-method="init">
|
||||
<bean id="webClientConfigService" class="org.alfresco.config.xml.XMLConfigService">
|
||||
<constructor-arg>
|
||||
<ref bean="webClientConfigSource" />
|
||||
</constructor-arg>
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user