From 2074ab2e8b4416126542c09205d3ca6646ed6718 Mon Sep 17 00:00:00 2001 From: vempo Date: Sun, 28 Oct 2018 14:45:46 +0200 Subject: Removed support of dynamic configuration Configuration framework will not poll configuration for changes, and will not notify client code of them. Also minor cleanup, added unit tests. Change-Id: I428b23f7acb13c6610390f46aae6e011d6b0ee80 Issue-ID: SDC-1867 Signed-off-by: vempo --- .../org/onap/config/impl/ConfigurationImpl.java | 59 ++-------------------- 1 file changed, 3 insertions(+), 56 deletions(-) (limited to 'common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java') diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java index 58720fc76d..af5ae04104 100644 --- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java +++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java @@ -34,7 +34,6 @@ import org.onap.config.ConfigurationUtils; import org.onap.config.Constants; import org.onap.config.NonConfigResource; import org.onap.config.api.Config; -import org.onap.config.api.ConfigurationChangeListener; import org.onap.config.api.Hint; public class ConfigurationImpl implements org.onap.config.api.Configuration { @@ -44,8 +43,6 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration { private static boolean instantiated = false; - ConfigurationChangeNotifier changeNotifier; - public ConfigurationImpl() throws Exception { if (instantiated || !CliConfigurationImpl.class.isAssignableFrom(this.getClass())) { throw new RuntimeException("Illegal access to configuration."); @@ -126,15 +123,14 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration { } } instantiated = true; - changeNotifier = new ConfigurationChangeNotifier(moduleConfigStore); } private void populateFinalConfigurationIncrementally(Map configs) { - if (configs.get(Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMETER + Constants.DB_NAMESPACE) != null) { + if (configs.get(Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMITER + Constants.DB_NAMESPACE) != null) { ConfigurationRepository.lookup().populateConfiguration( - Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMETER + Constants.DB_NAMESPACE, - configs.remove(Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMETER + Constants.DB_NAMESPACE) + Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMITER + Constants.DB_NAMESPACE, + configs.remove(Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMITER + Constants.DB_NAMESPACE) .getFinalConfiguration()); } @@ -188,43 +184,6 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration { } } - @Override - public void addConfigurationChangeListener(String tenant, String namespace, String key, - ConfigurationChangeListener myself) { - tenant = ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() - : Constants.DEFAULT_TENANT; - namespace = ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() - : Constants.DEFAULT_NAMESPACE; - if (key == null || key.trim().length() == 0) { - throw new IllegalArgumentException(KEY_CANNOT_BE_NULL); - } - if (myself == null) { - throw new IllegalArgumentException("ConfigurationChangeListener instance is null."); - } - try { - changeNotifier.notifyChangesTowards(tenant, namespace, key, myself); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - @Override - public void removeConfigurationChangeListener(String tenant, String namespace, String key, - ConfigurationChangeListener myself) { - tenant = ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() - : Constants.DEFAULT_TENANT; - namespace = ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() - : Constants.DEFAULT_NAMESPACE; - if (key == null || key.trim().length() == 0) { - throw new IllegalArgumentException(KEY_CANNOT_BE_NULL); - } - try { - changeNotifier.stopNotificationTowards(tenant, namespace, key, myself); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - @Override public Map populateMap(String tenantId, String namespace, String key, Class clazz) { if (tenantId == null || tenantId.trim().length() == 0) { @@ -574,16 +533,4 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration { } return collection; } - - public void shutdown() { - if (changeNotifier != null) { - try { - changeNotifier.shutdown(); - } catch (Exception exception) { - exception.printStackTrace(); - } - } - } - - } -- cgit 1.2.3-korg