...
Code Block |
---|
public class CourseServiceImpl
extends AbstractSiteService
implements CourseService, ConfigurationNotificationListener, ConfigurationProperties {
// ...
private SitePagesAndTools sitePagesAndTools;
private DynamicServerConfigurationService dynamicServerConfigurationService;
// Spring DSCS injection
public void setDynamicServerConfigurationService(DynamicServerConfigurationService dynamicServerConfigurationService) {
this.dynamicServerConfigurationService = dynamicServerConfigurationService;
}
// Spring Bean Init
public void init() {
dynamicServerConfigurationService.addNotificationListener(this, SITE_MANAGEMENT_PAGES_AND_TOOLS);
try {
sitePagesAndTools = (SitePagesAndTools) dynamicServerConfigurationService.getDynamicObject(SITE_MANAGEMENT_PAGES_AND_TOOLS);
} catch (ConfigurationObjectNotFound e) {
LOG.error("Was not able to find configuration property");
} catch (InvalidConfigurationKey e) {
LOG.error("Provided invalid configuration key");
}
}
// Implementing ConfigurationNotificationListener API: handleNotification
public void handleNotification(String configurationItemKey) {
try {
if(SITE_MANAGEMENT_PAGES_AND_TOOLS.equals(configurationItemKey)) {
sitePagesAndTools = (SitePagesAndTools) dynamicServerConfigurationService.getDynamicObject(SITE_MANAGEMENT_PAGES_AND_TOOLS);
}
} catch (ConfigurationObjectNotFound e) {
LOG.error("Was not able to find configuration property for key = " + configurationItemKey);
} catch (InvalidConfigurationKey e) {
LOG.error("Provided invalid configuration key = " + configurationItemKey);
}
}
}
|