X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fclamp%2Fclds%2Fconfig%2Fsdc%2FSdcSingleControllerConfiguration.java;h=ca756aa09cb1d68ec93851c707a486a96c437fcb;hb=86848b8bf5182be52fff9346412743f92e3d9e6a;hp=d8bd992e9f17069bf50f6b33491922a7f338a21c;hpb=d486538e15afcc6c747ccb8284f0e2d4174dd758;p=clamp.git diff --git a/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java b/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java index d8bd992e..ca756aa0 100644 --- a/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfiguration.java @@ -18,7 +18,7 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * */ package org.onap.clamp.clds.config.sdc; @@ -28,6 +28,7 @@ import com.att.eelf.configuration.EELFManager; import com.fasterxml.jackson.databind.JsonNode; import java.security.GeneralSecurityException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -35,7 +36,7 @@ import java.util.List; import org.apache.commons.codec.DecoderException; import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException; import org.onap.clamp.clds.util.CryptoUtils; -import org.openecomp.sdc.api.consumer.IConfiguration; +import org.onap.sdc.api.consumer.IConfiguration; /** * This class maps the SDC config JSON for one controller. @@ -65,6 +66,7 @@ public class SdcSingleControllerConfiguration implements IConfiguration { public static final String ACTIVATE_SERVER_TLS_AUTH = "activateServerTLSAuth"; public static final String KEY_STORE_KEY = "keyStorePassword"; public static final String KEY_STORE_PATH = "keyStorePath"; + public static final String MESSAGE_BUS_ADDRESSES = "messageBusAddresses"; private String errorMessageKeyNotFound; /** * Supported artifact types. @@ -79,7 +81,7 @@ public class SdcSingleControllerConfiguration implements IConfiguration { public static final String TOSCA_CSAR = "TOSCA_CSAR"; public static final String VF_MODULES_METADATA = "VF_MODULES_METADATA"; private static final String[] SUPPORTED_ARTIFACT_TYPES = { - HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA + TOSCA_CSAR, VF_MODULES_METADATA }; public static final List SUPPORTED_ARTIFACT_TYPES_LIST = Collections .unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); @@ -127,8 +129,8 @@ public class SdcSingleControllerConfiguration implements IConfiguration { private String getEncryptedStringConfig(String key) throws GeneralSecurityException, DecoderException { if (jsonRootNode != null && jsonRootNode.get(key) != null) { - String config = CryptoUtils.decrypt(jsonRootNode.get(key).asText()); - return config.isEmpty() ? null : config; + return jsonRootNode.get(key).asText().isEmpty() ? null + : CryptoUtils.decrypt(jsonRootNode.get(key).asText()); } return null; } @@ -241,6 +243,9 @@ public class SdcSingleControllerConfiguration implements IConfiguration { if (this.getAsdcAddress() == null || this.getAsdcAddress().isEmpty()) { throw new SdcParametersException(SDC_ADDRESS_ATTRIBUTE_NAME + errorMessageKeyNotFound); } + if (this.getMsgBusAddress() == null || this.getMsgBusAddress().isEmpty()) { + throw new SdcParametersException(MESSAGE_BUS_ADDRESSES + errorMessageKeyNotFound); + } if (this.getPassword() == null || this.getPassword().isEmpty()) { throw new SdcParametersException(SDC_KEY_ATTRIBUTE_NAME + errorMessageKeyNotFound); } @@ -265,11 +270,17 @@ public class SdcSingleControllerConfiguration implements IConfiguration { */ @Override public boolean isFilterInEmptyResources() { - return true; + return false; } @Override public List getMsgBusAddress() { - return null; + List addressesList = new ArrayList<>(); + if (jsonRootNode != null && jsonRootNode.get(MESSAGE_BUS_ADDRESSES) != null) { + jsonRootNode.get(MESSAGE_BUS_ADDRESSES).forEach(k -> addressesList.add(k.asText())); + return addressesList; + } else { + return addressesList; + } } }