diff options
Diffstat (limited to 'src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java')
-rw-r--r-- | src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java index f123e62..ed39de7 100644 --- a/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java +++ b/src/main/java/org/onap/pomba/contextbuilder/networkdiscovery/NdctxbConfiguration.java @@ -18,29 +18,17 @@ package org.onap.pomba.contextbuilder.networkdiscovery; -import java.util.Arrays; import java.util.Base64; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.StreamSupport; import org.eclipse.jetty.util.security.Password; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; -import org.springframework.core.env.AbstractEnvironment; -import org.springframework.core.env.EnumerablePropertySource; import org.springframework.core.env.Environment; -import org.springframework.core.env.MutablePropertySources; import org.springframework.stereotype.Component; @Component public class NdctxbConfiguration { - private static Logger log = LoggerFactory.getLogger(NdctxbConfiguration.class); - private static final String PREFIX_RESOURCE_TYPE = "networkDiscoveryCtxBuilder.resourceTypeMapping."; - private static final String WHITE_SPACE = "\\s"; // Network Discovery Context Builder Configuration values @@ -59,10 +47,6 @@ public class NdctxbConfiguration { @Value("${networkDiscoveryCtxBuilder.password:OBF:1u2a1toa1w8v1tok1u30}") private String networkDiscoveryCtxBuilderPassword; - @Value("${networkDiscoveryCtxBuilder.resourceList:vnfcs}") - private String networkDiscoveryCtxBuilderResourceList; - - // Service Decomposition Configuration values @Value("${serviceDecomposition.host:127.0.0.1}") @@ -134,12 +118,6 @@ public class NdctxbConfiguration { + this.networkDiscoveryCtxBuilderPort; } - @Bean(name = "networkDiscoveryCtxBuilderResources") - public String getNetworkDiscoveryCtxBuilderResourcs() { - return this.networkDiscoveryCtxBuilderResourceList; - } - - @Bean(name = "networkDiscoveryMicroServiceBaseUrl") public String getNetworkDiscoveryURL() { return this.httpNetworkDiscoveryMicroServiceProtocol + "://" + this.networkDiscoveryMicroServiceHost + ":" @@ -166,31 +144,4 @@ public class NdctxbConfiguration { @Autowired private Environment env; - // This method builds a map between Service Decomposition resource type and Network Discovery - // Context Builder resource type using dynamic mapping technique. - // It scans the contents of the configuration file "application.properties", - // searching for the string "networkDiscoveryCtxBuilder.resourceTypeMapping.", and if found, - // anything from the remaining string will be used as the key (Service Decomposition resource Type) - // to match to the value of assignment (network discovery context builder resource type). - // For example,"networkDiscoveryCtxBuilder.resourceTypeMapping.BBB = bbb", - // Service Decomposition resource type BBB matches to context builder resource type bbb - @Bean(name = "networkDiscoveryCtxBuilderResourceTypeMapping") - public Map<String, String> getResourceTypeMapping() { - Map<String, String> props = new HashMap<>(); - MutablePropertySources propSrcs = ((AbstractEnvironment) this.env).getPropertySources(); - StreamSupport.stream(propSrcs.spliterator(), false) - .filter(ps -> ps instanceof EnumerablePropertySource) - .map(ps -> ((EnumerablePropertySource<?>) ps).getPropertyNames()) - .flatMap(Arrays::<String>stream) - .forEach(propName -> { - if (propName.startsWith(PREFIX_RESOURCE_TYPE)) { - String myKey = propName.substring(PREFIX_RESOURCE_TYPE.length()).replaceAll(WHITE_SPACE,""); - String myValue = this.env.getProperty(propName).replaceAll(WHITE_SPACE, ""); - props.put( myKey , myValue); - } - }); - - log.info(props.toString()); - return props; - } } |