diff options
author | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-03-26 13:38:40 +0000 |
---|---|---|
committer | mark.j.leonard <mark.j.leonard@gmail.com> | 2019-03-28 13:19:09 +0000 |
commit | bfde3ef00beb3c6f31cebfd12e90b9b9cdcc492e (patch) | |
tree | be8321d3f3216b152d186f0bd23a2694bf0c7183 /src/main/java | |
parent | 8a7d9a0d7782b9339810b02208620bdd2f0a12b2 (diff) |
Remove all references to artifactgenerator config
Delete the artifact-generator.properties file. Remove all related
functionality from the code.
Change-Id: I652d99b6424bb60af5820f5afb97ef139e3f9511
Issue-ID: AAI-2284
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
Diffstat (limited to 'src/main/java')
3 files changed, 2 insertions, 58 deletions
diff --git a/src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java b/src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java index 9b66e58..c2d34c9 100644 --- a/src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java +++ b/src/main/java/org/onap/aai/babel/parser/ArtifactGeneratorToscaParser.java @@ -25,7 +25,6 @@ import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; import java.io.BufferedReader; import java.io.File; -import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; @@ -33,7 +32,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Properties; import java.util.stream.Collectors; import java.util.stream.Stream; import org.onap.aai.babel.logging.LogHelper; @@ -60,7 +58,6 @@ public class ArtifactGeneratorToscaParser { private static Logger log = LogHelper.INSTANCE; - public static final String PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE = "artifactgenerator.config"; public static final String PROPERTY_TOSCA_MAPPING_FILE = "tosca.mappings.config"; public static final String GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND = @@ -94,30 +91,6 @@ public class ArtifactGeneratorToscaParser { } /** - * Initializes the Widget to UUID mapping configuration. - * - * @throws IOException - * if an error occurs reading the configuration properties - */ - public static void initWidgetConfiguration() throws IOException { - log.debug("Getting Widget Configuration"); - String configLocation = System.getProperty(PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE); - if (configLocation != null) { - File file = new File(configLocation); - if (file.exists()) { - Properties properties = new Properties(); - properties.load(new FileInputStream(file)); - WidgetConfigurationUtil.setConfig(properties); - } else { - throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGFILE_NOT_FOUND, configLocation)); - } - } else { - throw new IllegalArgumentException( - String.format(GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND, PROPERTY_ARTIFACT_GENERATOR_CONFIG_FILE)); - } - } - - /** * Initializes the group filtering and TOSCA to Widget mapping configuration. * * @param configLocation diff --git a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java index 2b8b128..11c1471 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/api/AaiArtifactGenerator.java @@ -82,7 +82,6 @@ public class AaiArtifactGenerator implements ArtifactGenerator { } try { - ArtifactGeneratorToscaParser.initWidgetConfiguration(); ArtifactGeneratorToscaParser.initToscaMappingsConfiguration(configLocation); } catch (IOException e) { log.error(ApplicationMsgs.LOAD_PROPERTIES, e, configLocation); diff --git a/src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java b/src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java index 620f792..8f774c9 100644 --- a/src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java +++ b/src/main/java/org/onap/aai/babel/xml/generator/data/WidgetConfigurationUtil.java @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Properties; import org.onap.aai.babel.xml.generator.XmlArtifactGenerationException; import org.onap.aai.babel.xml.generator.model.Resource; import org.onap.aai.babel.xml.generator.model.Widget; @@ -40,7 +39,6 @@ public class WidgetConfigurationUtil { public static final String GENERATOR_AAI_CONFIGLPROP_NOT_FOUND = "Cannot generate artifacts. Widget configuration not found for %s"; - private static Properties config; private static List<String> instanceGroups = Collections.emptyList(); private static Map<String, Resource> typeToResource = new HashMap<>(); private static Map<String, Widget> typeToWidget = new HashMap<>(); @@ -52,10 +50,6 @@ public class WidgetConfigurationUtil { throw new UnsupportedOperationException("This static class should not be instantiated!"); } - public static void setConfig(Properties config) { - WidgetConfigurationUtil.config = config; - } - public static void setSupportedInstanceGroups(List<String> supportedInstanceGroups) { instanceGroups = supportedInstanceGroups; } @@ -94,15 +88,10 @@ public class WidgetConfigurationUtil { public static void setWidgetTypes(List<WidgetTypeConfig> types) { WidgetType.clearElements(); for (WidgetTypeConfig type : types) { - if (type.type == null || type.name == null) { + if (type.type == null || type.name == null || type.modelInvariantId == null + || type.modelVersionId == null) { throw new IllegalArgumentException("Incomplete widget type specified: " + type); } - if (type.modelInvariantId == null) { - type.modelInvariantId = WidgetConfigurationUtil.getModelInvariantId(type.name); - } - if (type.modelVersionId == null) { - type.modelVersionId = WidgetConfigurationUtil.getModelVersionId(type.name); - } Widget widget = new Widget(new WidgetType(type.type), type.name, type.deleteFlag, // type.modelInvariantId, type.modelVersionId); typeToWidget.put(type.type, widget); @@ -123,21 +112,4 @@ public class WidgetConfigurationUtil { } } - public static String getModelInvariantId(String name) { - String id = config.getProperty(ArtifactType.AAI.name() + ".model-invariant-id." + name); - if (id == null) { - throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGLPROP_NOT_FOUND, - ArtifactType.AAI.name() + ".model-invariant-id." + name)); - } - return id; - } - - public static String getModelVersionId(String name) { - String id = config.getProperty(ArtifactType.AAI.name() + ".model-version-id." + name); - if (id == null) { - throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGLPROP_NOT_FOUND, - ArtifactType.AAI.name() + ".model-version-id." + name)); - } - return id; - } } |