From: vasraz Date: Thu, 13 Jul 2023 12:59:35 +0000 (+0100) Subject: Replace outdated dependency - org.apache.commons:commons-jci-core:jar:1.1 X-Git-Tag: 1.13.2~4 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=sdc.git;a=commitdiff_plain;h=669052a080343c36e565638d13275074f630db2a Replace outdated dependency - org.apache.commons:commons-jci-core:jar:1.1 Signed-off-by: Vasyl Razinkov Change-Id: I5b34fff0600f1343a4ca9e00cf737946e3737214 Issue-ID: SDC-4569 --- diff --git a/asdctool/pom.xml b/asdctool/pom.xml index d84a22ac11..3b7376d600 100644 --- a/asdctool/pom.xml +++ b/asdctool/pom.xml @@ -207,20 +207,6 @@ compile - - - org.apache.commons - commons-jci-core - ${commons-jci-core.version} - compile - - - commons-io - commons-io - - - - commons-cli commons-cli diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml index 484544fce7..93e70252c5 100644 --- a/catalog-be/pom.xml +++ b/catalog-be/pom.xml @@ -252,20 +252,6 @@ compile - - - org.apache.commons - commons-jci-core - ${commons-jci-core.version} - compile - - - commons-io - commons-io - - - - com.google.code.gson diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml index c145b683be..8061800da2 100644 --- a/catalog-dao/pom.xml +++ b/catalog-dao/pom.xml @@ -299,19 +299,6 @@ Modifications copyright (c) 2018 Nokia test - - org.apache.commons - commons-jci-core - ${commons-jci-core.version} - test - - - commons-io - commons-io - - - - org.springframework spring-expression diff --git a/catalog-fe/pom.xml b/catalog-fe/pom.xml index d1d1404f2e..1e3009a753 100644 --- a/catalog-fe/pom.xml +++ b/catalog-fe/pom.xml @@ -96,19 +96,6 @@ compile - - org.apache.commons - commons-jci-core - ${commons-jci-core.version} - compile - - - commons-io - commons-io - - - - com.google.code.gson gson diff --git a/catalog-model/pom.xml b/catalog-model/pom.xml index 5a30598f09..f8e2ef763a 100644 --- a/catalog-model/pom.xml +++ b/catalog-model/pom.xml @@ -449,19 +449,6 @@ ${spring.version} - - org.apache.commons - commons-jci-core - ${commons-jci-core.version} - test - - - commons-io - commons-io - - - - org.awaitility awaitility diff --git a/common-app-api/pom.xml b/common-app-api/pom.xml index eb61d72d11..cb28cb0327 100644 --- a/common-app-api/pom.xml +++ b/common-app-api/pom.xml @@ -110,20 +110,6 @@ provided - - - org.apache.commons - commons-jci-core - ${commons-jci-core.version} - provided - - - commons-io - commons-io - - - - com.google.code.gson diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java index 4efc43d675..ca923b53cd 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java @@ -25,7 +25,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.jci.listeners.FileChangeListener; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; import org.openecomp.sdc.common.api.BasicConfiguration; import org.openecomp.sdc.common.api.ConfigurationListener; import org.openecomp.sdc.common.log.enums.EcompLoggerErrorCode; @@ -33,7 +33,8 @@ import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.util.YamlToObjectConverter; import org.openecomp.sdc.exception.YamlConversionException; -public class ConfigFileChangeListener extends FileChangeListener { + +public class ConfigFileChangeListener extends FileAlterationListenerAdaptor { private static final Logger LOGGER = Logger.getLogger(ConfigFileChangeListener.class.getName()); private Map> fileChangeToCallBack = new HashMap<>(); @@ -42,7 +43,6 @@ public class ConfigFileChangeListener extends FileChangeListener { @Override public void onFileChange(File pFile) { - super.onFileChange(pFile); if (pFile == null) { LOGGER.debug("Invalid file '{}'.", pFile); return; @@ -68,7 +68,7 @@ public class ConfigFileChangeListener extends FileChangeListener { basicConfiguration = yamlToObjectConverter.convert(pFile.getAbsolutePath(), configClass); } catch (final YamlConversionException e) { LOGGER.warn(EcompLoggerErrorCode.SCHEMA_ERROR, "Configuration", "Configuration", - "Cannot update the listeners for file Change since the file content is invalid: {}", e.getLocalizedMessage()); + "Cannot update the listeners for file Change since the file content is invalid: {}", e.getLocalizedMessage()); continue; } LOGGER.debug("Loaded configuration after converting is {}", basicConfiguration); diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java index 7c665c61cd..def72b7d56 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java @@ -20,9 +20,11 @@ package org.openecomp.sdc.common.impl; import java.io.File; -import org.apache.commons.jci.monitor.FilesystemAlterationMonitor; +import org.apache.commons.io.monitor.FileAlterationMonitor; +import org.apache.commons.io.monitor.FileAlterationObserver; import org.openecomp.sdc.common.api.ConfigurationSource; + /** * Save the * @@ -34,7 +36,7 @@ public class ExternalConfiguration { private static String appVersion; private static String configDir; private static ConfigurationSource configurationSource; - private static FilesystemAlterationMonitor fam = null; + private static FileAlterationMonitor monitor; private static ConfigFileChangeListener changeListener = new ConfigFileChangeListener(); private static boolean enableReconfigure = true; @@ -75,23 +77,28 @@ public class ExternalConfiguration { } public static void listenForChanges() { - String watchingDir = configDir + File.separator + appName; if (enableReconfigure) { - if (fam == null) { - fam = new FilesystemAlterationMonitor(); - fam.setInterval(1000); - fam.addListener(new File(watchingDir), changeListener); - fam.start(); + monitor = new FileAlterationMonitor(); + final String watchingDir = configDir + File.separator + appName; + final FileAlterationObserver observer = new FileAlterationObserver(watchingDir); + observer.addListener(changeListener); + monitor.addObserver(observer); + try { + monitor.start(); + } catch (final Exception e) { + throw new RuntimeException(e); } } } public static void stopListenForFileChanges() { - if (enableReconfigure) { - if (fam != null) { - fam.stop(); - fam = null; + if (enableReconfigure && monitor != null) { + try { + monitor.stop(); + } catch (Exception e) { + throw new RuntimeException(e); } + monitor = null; } } } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java b/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java index 70a94fd460..a4e615690b 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java @@ -39,6 +39,7 @@ public class AppContextListener implements ServletContextListener { private static Logger log = Logger.getLogger(AppContextListener.class.getName()); + @Override public void contextInitialized(ServletContextEvent context) { log.debug("ServletContextListener initialized "); log.debug("After read values from Manifest {}", getManifestInfo(context.getServletContext())); @@ -50,13 +51,13 @@ public class AppContextListener implements ServletContextListener { String configHome = System.getProperty(Constants.CONFIG_HOME); ExternalConfiguration.setConfigDir(configHome); String appConfigDir = configHome + File.separator + appName; - // ChangeListener changeListener = new ChangeListener(); ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); context.getServletContext().setAttribute(Constants.CONFIGURATION_SOURCE_ATTR, configurationSource); ExternalConfiguration.setConfigurationSource(configurationSource); ExternalConfiguration.listenForChanges(); } + @Override public void contextDestroyed(ServletContextEvent context) { log.debug("ServletContextListener destroyed"); ExternalConfiguration.stopListenForFileChanges(); diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java index 0d5cf62cb1..38d1e65b67 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java @@ -102,26 +102,5 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura } public void reconfigure(BasicConfiguration obj) { - // - - // if (obj != null) { - - // - - // if (obj instanceof Configuration) { - - // configurations.put(getKey(Configuration.class), obj); - - // } - - // - - // if (obj instanceof EcompErrorConfiguration) { - - // configurations.put(getKey(EcompErrorConfiguration.class), obj); - - // } - - // } } } diff --git a/pom.xml b/pom.xml index 185858a08e..c80fec4086 100644 --- a/pom.xml +++ b/pom.xml @@ -127,9 +127,6 @@ Modifications copyright (c) 2018-2019 Nokia 2.10.1 - - 1.1 - 4.10.0 ${mockito.version}