summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2023-07-13 13:59:35 +0100
committerMichael Morris <michael.morris@est.tech>2023-07-13 15:01:24 +0000
commit669052a080343c36e565638d13275074f630db2a (patch)
treed63c76367d02eb10d7358150e5b54528a98a48c8
parent0278649141c9247b2ec56bb76998c3b9aa412874 (diff)
Replace outdated dependency - org.apache.commons:commons-jci-core:jar:1.1
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: I5b34fff0600f1343a4ca9e00cf737946e3737214 Issue-ID: SDC-4569
-rw-r--r--asdctool/pom.xml14
-rw-r--r--catalog-be/pom.xml14
-rw-r--r--catalog-dao/pom.xml13
-rw-r--r--catalog-fe/pom.xml13
-rw-r--r--catalog-model/pom.xml13
-rw-r--r--common-app-api/pom.xml14
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/ConfigFileChangeListener.java8
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/impl/ExternalConfiguration.java31
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/common/listener/AppContextListener.java3
-rw-r--r--common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java21
-rw-r--r--pom.xml3
11 files changed, 25 insertions, 122 deletions
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 @@
<scope>compile</scope>
</dependency>
- <!-- listen to file changes -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-core</artifactId>
- <version>${commons-jci-core.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
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 @@
<scope>compile</scope>
</dependency>
- <!-- File changes listener -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-core</artifactId>
- <version>${commons-jci-core.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<!-- Gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
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
@@ -300,19 +300,6 @@ Modifications copyright (c) 2018 Nokia
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-core</artifactId>
- <version>${commons-jci-core.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
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
@@ -97,19 +97,6 @@
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-core</artifactId>
- <version>${commons-jci-core.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
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
@@ -450,19 +450,6 @@
</dependency>
<dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-core</artifactId>
- <version>${commons-jci-core.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
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 @@
<scope>provided</scope>
</dependency>
- <!-- listen to file changes -->
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-jci-core</artifactId>
- <version>${commons-jci-core.version}</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<!-- Gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
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<String, List<ConfigurationListener>> 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
<!--GSON-->
<gson.version>2.10.1</gson.version>
- <!--listen to file changes-->
- <commons-jci-core.version>1.1</commons-jci-core.version>
-
<!--TESTING-->
<mockito.version>4.10.0</mockito.version>
<mockitoJupiter.version>${mockito.version}</mockitoJupiter.version>