diff options
author | vasraz <vasyl.razinkov@est.tech> | 2020-10-19 16:33:00 +0100 |
---|---|---|
committer | S�bastien Determe <sebastien.determe@intl.att.com> | 2020-10-23 14:26:12 +0000 |
commit | 9714961d2950d00ae66be01e20c1ebb8552a82e9 (patch) | |
tree | f9c46bd321f7ef72614d5e5cfbcb42e0bbb49ac5 /common-be | |
parent | 290420e92809093050a493f34be3cc214459162f (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')
-rw-r--r-- | common-be/pom.xml | 5 | ||||
-rw-r--r-- | common-be/src/main/java/org/openecomp/sdc/be/config/NonManoConfigurationManager.java | 19 |
2 files changed, 14 insertions, 10 deletions
diff --git a/common-be/pom.xml b/common-be/pom.xml index 248edb30f9..f45c25f37b 100644 --- a/common-be/pom.xml +++ b/common-be/pom.xml @@ -109,11 +109,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.onap.sdc.sdc-tosca</groupId> - <artifactId>sdc-tosca</artifactId> - <version>${sdc-tosca-parser.version}</version> - </dependency> - <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> 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); + } + } + } |