[SDC-DIST] Upgrade asdc-controller to use client version 2.0.0
[so.git] / asdc-controller / src / main / java / org / onap / so / asdc / client / ASDCConfiguration.java
index 7d92c63..8351552 100644 (file)
@@ -9,9 +9,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
 package org.onap.so.asdc.client;
 
-
 import java.security.GeneralSecurityException;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import org.onap.sdc.api.consumer.IConfiguration;
 import org.onap.so.utils.CryptoUtils;
@@ -40,31 +38,13 @@ import org.springframework.stereotype.Component;
 public class ASDCConfiguration implements IConfiguration {
 
     // SHell command to obtain the same encryption, 128 bits key, key must be HEX
-    // echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973 -nosalt | xxd
-
-    private static Logger logger = LoggerFactory.getLogger(ASDCConfiguration.class);
+    // echo -n "This is a test string" | openssl aes-128-ecb -e -K 546573746F736973546573746F736973
+    // -nosalt | xxd
 
+    private static final Logger logger = LoggerFactory.getLogger(ASDCConfiguration.class);
 
     private String asdcControllerName;
 
-    public static final String MSO_PROP_ASDC = "MSO_PROP_ASDC";
-    public static final String PARAMETER_PATTERN = "asdc-connections";
-    public static final String MSG_BUS_ADDRESS_ATTRIBUTE_NAME = "messageBusAddress";
-    public static final String WATCHDOG_TIMEOUT_NAME = "watchDogTimeout";
-
-    public static final String CONSUMER_GROUP_ATTRIBUTE_NAME = "consumerGroup";
-    public static final String CONSUMER_ID_ATTRIBUTE_NAME = "consumerId";
-    public static final String ENVIRONMENT_NAME_ATTRIBUTE_NAME = "environmentName";
-    public static final String PASSWORD_ATTRIBUTE_NAME = "password";
-    public static final String POLLING_INTERVAL_ATTRIBUTE_NAME = "pollingInterval";
-    public static final String RELEVANT_ARTIFACT_TYPES_ATTRIBUTE_NAME = "relevantArtifactTypes";
-    public static final String USER_ATTRIBUTE_NAME = "user";
-    public static final String ASDC_ADDRESS_ATTRIBUTE_NAME = "asdcAddress";
-    public static final String POLLING_TIMEOUT_ATTRIBUTE_NAME = "pollingTimeout";
-    public static final String ACTIVATE_SERVER_TLS_AUTH = "activateServerTLSAuth";
-    public static final String KEY_STORE_PASSWORD = "keyStorePassword";
-    public static final String KEY_STORE_PATH = "keyStorePath";
-
     public static final String HEAT = "HEAT";
     public static final String HEAT_ARTIFACT = "HEAT_ARTIFACT";
     public static final String HEAT_ENV = "HEAT_ENV";
@@ -73,14 +53,17 @@ public class ASDCConfiguration implements IConfiguration {
     public static final String HEAT_VOL = "HEAT_VOL";
     public static final String OTHER = "OTHER";
     public static final String TOSCA_CSAR = "TOSCA_CSAR";
-    public static final String WORKFLOWS = "Workflows";
+    public static final String WORKFLOW = "WORKFLOW";
     public static final String VF_MODULES_METADATA = "VF_MODULES_METADATA";
+    public static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT";
+    public static final String HELM = "HELM";
+
 
-    private static final String[] SUPPORTED_ARTIFACT_TYPES =
-            {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, HEAT_VOL, OTHER, TOSCA_CSAR, 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, WORKFLOW, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT, HELM};
 
-    public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST =
-            Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES));
+
+    public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST = List.of(SUPPORTED_ARTIFACT_TYPES);
 
     @Autowired
     private Environment env;
@@ -88,17 +71,13 @@ public class ASDCConfiguration implements IConfiguration {
     @Value("${mso.asdc.config.key}")
     private String configKey;
 
-    @Value("${mso.asdc-connections.asdc-controller1.messageBusAddress}")
-    private String[] messageBusAddress;
-
-
     public void setAsdcControllerName(String asdcControllerName) {
         this.asdcControllerName = asdcControllerName;
     }
 
     @Override
-    public java.lang.Boolean isUseHttpsWithDmaap() {
-        return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.useHttpsWithDmaap", true);
+    public Boolean isUseHttpsWithSDC() {
+        return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.useHttpsWithSdc", true);
     }
 
     @Override
@@ -106,22 +85,10 @@ public class ASDCConfiguration implements IConfiguration {
         return true;
     }
 
-    @Override
-    public List<String> getMsgBusAddress() {
-        if (messageBusAddress.length > 0) {
-            return Arrays.asList(messageBusAddress);
-        } else {
-            return Collections.emptyList();
-        }
-
-
-    }
-
     public String getAsdcControllerName() {
         return asdcControllerName;
     }
 
-
     @Override
     public String getConsumerGroup() {
         return getPropertyOrNull("mso.asdc-connections.asdc-controller1.consumerGroup");
@@ -187,8 +154,9 @@ public class ASDCConfiguration implements IConfiguration {
             return defaultValue;
         } else {
             try {
-                return Boolean.valueOf(config);
+                return Boolean.parseBoolean(config);
             } catch (Exception e) {
+                logger.warn("Exception while getting boolean property with default property", e);
                 return defaultValue;
             }
         }
@@ -211,7 +179,8 @@ public class ASDCConfiguration implements IConfiguration {
 
     @Override
     public List<String> getRelevantArtifactTypes() {
-        // DO not return the Static List SUPPORTED_ARTIFACT_TYPES_LIST because the ASDC Client will try to modify it !!!
+        // DO not return the Static List SUPPORTED_ARTIFACT_TYPES_LIST because the ASDC Client will
+        // try to modify it !!!
         return Arrays.asList(SUPPORTED_ARTIFACT_TYPES);
     }
 
@@ -221,8 +190,8 @@ public class ASDCConfiguration implements IConfiguration {
     }
 
     @Override
-    public String getAsdcAddress() {
-        return getPropertyOrNull("mso.asdc-connections.asdc-controller1.asdcAddress");
+    public String getSdcAddress() {
+        return getPropertyOrNull("mso.asdc-connections.asdc-controller1.sdcAddress");
     }
 
     @Override
@@ -254,4 +223,24 @@ public class ASDCConfiguration implements IConfiguration {
         return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.isFilterInEmptyResources", true);
     }
 
+    @Override
+    public String getHttpProxyHost() {
+        return getPropertyOrNull("mso.asdc-connections.asdc-controller1.httpProxyHost");
+    }
+
+    @Override
+    public int getHttpProxyPort() {
+        return getIntegerPropertyOrZero("mso.asdc-connections.asdc-controller1.httpProxyPort");
+    }
+
+    @Override
+    public String getHttpsProxyHost() {
+        return getPropertyOrNull("mso.asdc-connections.asdc-controller1.httpsProxyHost");
+    }
+
+    @Override
+    public int getHttpsProxyPort() {
+        return getIntegerPropertyOrZero("mso.asdc-connections.asdc-controller1.httpsProxyPort");
+    }
+
 }