From 2c285722c35d8ee7fd6c9085c8e60f0fa87d5761 Mon Sep 17 00:00:00 2001 From: Idan Amit Date: Fri, 29 Dec 2017 09:40:43 +0200 Subject: SDC Designers Integration - Part 1 Finished first part of designers integration Added templated configuration file Added tests Change-Id: I76e8b413063b939e1eb58da4a5502c4b526168f2 Issue-ID: SDC-687 Signed-off-by: Idan Amit --- .../org/openecomp/sdc/common/api/Constants.java | 3 + .../sdc/fe/config/ConfigurationManager.java | 17 +++++ .../sdc/fe/config/DesignersConfiguration.java | 77 ++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java (limited to 'common-app-api/src') diff --git a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java index 8e15b96e0c..839dc0bdd2 100644 --- a/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java +++ b/common-app-api/src/main/java/org/openecomp/sdc/common/api/Constants.java @@ -140,4 +140,7 @@ public interface Constants { //external HealthCheck components public static final String HC_COMPONENT_ON_BOARDING = "ON_BOARDING"; public static final String HC_COMPONENT_DCAE = "DCAE"; + + //Designer BL + public static final String DESIGNER_BL_COMPONENT = "designerStatusBL"; } 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 b3164fd283..0e1aabcccf 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 @@ -30,11 +30,14 @@ import org.openecomp.sdc.common.api.FileChangeCallback; import org.openecomp.sdc.common.config.EcompErrorConfiguration; import org.openecomp.sdc.common.config.IEcompConfigurationManager; import org.openecomp.sdc.common.rest.api.RestConfigurationInfo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ConfigurationManager implements FileChangeCallback, IEcompConfigurationManager { ConfigurationSource configurationSource = null; private static ConfigurationManager instance; + private static Logger log = LoggerFactory.getLogger(ConfigurationManager.class.getName()); public ConfigurationManager(ConfigurationSource configurationSource) { super(); @@ -50,11 +53,14 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura loadConfigurationClass(Configuration.class); loadConfigurationClass(RestConfigurationInfo.class); loadConfigurationClass(EcompErrorConfiguration.class); + loadConfigurationClass(DesignersConfiguration.class); } private void loadConfigurationClass(Class clazz) { ConfigurationListener configurationListener = new ConfigurationListener(clazz, this); + + log.info("created listener for class {}: {}", clazz.getName(), configurationListener); T object = configurationSource.getAndWatchConfiguration(clazz, configurationListener); @@ -85,6 +91,13 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura return (EcompErrorConfiguration) configurations.get(getKey(EcompErrorConfiguration.class)); } + + public DesignersConfiguration getDesignersConfiguration() { + + log.info("requested designers configuration and got this:{}", (DesignersConfiguration) configurations.get(getKey(DesignersConfiguration.class))); + + return (DesignersConfiguration) configurations.get(getKey(DesignersConfiguration.class)); + } public Configuration getConfigurationAndWatch(ConfigurationListener configurationListener) { @@ -114,4 +127,8 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura public static ConfigurationManager getConfigurationManager() { return instance; } + + public static void setTestInstance(ConfigurationManager configurationManagerInstance) { + instance = configurationManagerInstance; + } } diff --git a/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java new file mode 100644 index 0000000000..1b89ba02fd --- /dev/null +++ b/common-app-api/src/main/java/org/openecomp/sdc/fe/config/DesignersConfiguration.java @@ -0,0 +1,77 @@ +package org.openecomp.sdc.fe.config; + +import java.util.HashMap; +import java.util.Map; + +import org.openecomp.sdc.common.api.BasicConfiguration; + +public class DesignersConfiguration extends BasicConfiguration { + + private Map designersList; + + public Map getDesignersList() { + return designersList; + } + + public void setDesignersList(Map designersList) { + this.designersList = designersList; + } + + public DesignersConfiguration() { + this.designersList = new HashMap(); + } + + public static class Designer { + + private String displayName; + private String designerHost; + private Integer designerPort; + private String designerPath; + private String designerProtocol; + + + public String getDesignerProtocol() { + return designerProtocol; + } + + public void setDesignerProtocol(String designerProtocol) { + this.designerProtocol = designerProtocol; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getDesignerHost() { + return designerHost; + } + + public void setDesignerHost(String designerHost) { + this.designerHost = designerHost; + } + + public Integer getDesignerPort() { + return designerPort; + } + + public void setDesignerPort(Integer designerPort) { + this.designerPort = designerPort; + } + + public String getDesignerPath() { + return designerPath; + } + + public void setDesignerPath(String designerPath) { + this.designerPath = designerPath; + } + + } + +} + + -- cgit 1.2.3-korg