aboutsummaryrefslogtreecommitdiffstats
path: root/common-be/src
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2020-10-19 16:33:00 +0100
committerS�bastien Determe <sebastien.determe@intl.att.com>2020-10-23 14:26:12 +0000
commit9714961d2950d00ae66be01e20c1ebb8552a82e9 (patch)
treef9c46bd321f7ef72614d5e5cfbcb42e0bbb49ac5 /common-be/src
parent290420e92809093050a493f34be3cc214459162f (diff)
Remove sdc-tosca-parser dependency
Change-Id: I762b7a1098505312486d690902f2f10108a601ff Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3317
Diffstat (limited to 'common-be/src')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java b/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java
index 12813f231d..640c95bf65 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java
@@ -19,13 +19,12 @@
package org.openecomp.sdc.be.config;
-import org.apache.commons.io.IOUtils;
-import org.onap.sdc.tosca.parser.utils.YamlToObjectConverter;
-import org.openecomp.sdc.be.config.exception.LoadConfigurationException;
-
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
+import org.apache.commons.io.IOUtils;
+import org.openecomp.sdc.be.config.exception.LoadConfigurationException;
+import org.yaml.snakeyaml.Yaml;
/**
* Singleton that loads and stores the Non Mano configuration
@@ -52,7 +51,7 @@ public class NonManoConfigurationManager {
} catch (final IOException e) {
throw new LoadConfigurationException("Could not parse non-mano configuration file 'config/nonManoConfig.yaml' to string", e);
}
- nonManoConfiguration = new YamlToObjectConverter().convertFromString(data, NonManoConfiguration.class);
+ nonManoConfiguration = convertFromString(data, NonManoConfiguration.class);
}
public static NonManoConfigurationManager getInstance() {
@@ -66,4 +65,14 @@ public class NonManoConfigurationManager {
public NonManoConfiguration getNonManoConfiguration() {
return nonManoConfiguration;
}
+
+ private <T> T convertFromString(final String yamlContents, final Class<T> className) {
+ try {
+ return (new Yaml()).loadAs(yamlContents, className);
+ } catch (final Exception e) {
+ throw new
+ LoadConfigurationException(String.format("Failed to convert YAML %s to object.", yamlContents), e);
+ }
+ }
+
}