Merge "Reorder modifiers"
[so.git] / adapters / mso-vnf-adapter / src / main / java / org / openecomp / mso / adapters / vnf / MsoVnfPluginAdapterImpl.java
index a817a6b..a6d0a00 100644 (file)
@@ -58,7 +58,6 @@ import org.openecomp.mso.adapters.vdu.VduStatus;
 import org.openecomp.mso.adapters.vdu.mapper.VfModuleCustomizationToVduMapper;
 import org.openecomp.mso.adapters.vnf.exceptions.VnfAlreadyExists;
 import org.openecomp.mso.adapters.vnf.exceptions.VnfException;
-import org.openecomp.mso.cloud.CloudConfig;
 import org.openecomp.mso.cloud.CloudConfigFactory;
 import org.openecomp.mso.cloud.CloudSite;
 import org.openecomp.mso.cloudify.utils.MsoCloudifyUtils;
@@ -92,7 +91,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
        CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
-       protected CloudConfig cloudConfig = cloudConfigFactory.getCloudConfig();
        protected MsoHeatUtils heatUtils;
        protected VfModuleCustomizationToVduMapper vduMapper;
        protected MsoCloudifyUtils cloudifyUtils;
@@ -381,7 +379,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                                return Integer.valueOf(inputValue);
                        }
                        catch (Exception e) {
-                               LOGGER.debug("Unable to convert " + inputValue + " to an integer!");
+                               LOGGER.debug("Unable to convert " + inputValue + " to an integer!" , e);
                                return null;
                        }
                } else if (type.equalsIgnoreCase("json")) {
@@ -390,7 +388,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                                return jsonNode;
                        }
                        catch (Exception e) {
-                               LOGGER.debug("Unable to convert " + inputValue + " to a JsonNode!");
+                               LOGGER.debug("Unable to convert " + inputValue + " to a JsonNode!", e);
                                return null;
                        }
                } else if (type.equalsIgnoreCase("boolean")) {
@@ -411,28 +409,28 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                        String str = "" + stackOutputs.get(key);
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs");
+                       LOGGER.debug("Unable to add " + key + " to outputs", e);
                }
             } else if (stackOutputs.get(key) instanceof JsonNode) {
                try {
                        String str = this.convertNode((JsonNode) stackOutputs.get(key));
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - exception converting JsonNode");
+                       LOGGER.debug("Unable to add " + key + " to outputs - exception converting JsonNode", e);
                }
             } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
                try {
                                        String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap");
+                       LOGGER.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap", e);
                }
             } else {
                try {
                        String str = stackOutputs.get(key).toString();
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage());
+                       LOGGER.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage(), e);
                }
             }
         }
@@ -510,7 +508,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                         String str = this.convertNode((JsonNode) obj);
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key);
+                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key, e);
                         //okay in this instance - only string values (fqdn) are expected to be needed
                     }
                 } else if (obj instanceof java.util.LinkedHashMap) {
@@ -519,21 +517,21 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                         String str = JSON_MAPPER.writeValueAsString(obj);
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key);
+                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key, e);
                                        }
                                }  else if (obj instanceof Integer) {
                                        try {
                                                String str = "" + obj;
                                                stringMap.put(key, str);
                                        } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key);
+                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key, e);
                     }
                 } else {
                     try {
                                                String str = obj.toString();
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")");
+                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")", e);
                     }
                 }
             }
@@ -632,7 +630,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
         if (inputs == null) {
                // Create an empty set of inputs
-               inputs = new HashMap<String,String>();
+               inputs = new HashMap<>();
                LOGGER.debug("inputs == null - setting to empty");
         } else {
                this.sendMapToDebug(inputs);
@@ -694,7 +692,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
         //  Perform a version check against cloudSite
         // Obtain the cloud site information where we will create the VF Module
-        Optional<CloudSite> cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+        Optional<CloudSite> cloudSite = cloudConfigFactory.getCloudConfig().getCloudSite (cloudSiteId);
         if (!cloudSite.isPresent()) {
             throw new VnfException (new MsoCloudSiteNotFound (cloudSiteId));
         }
@@ -1223,7 +1221,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
      * but we don't currently have access to that in Query and Delete cases.
      */
     private VduPlugin getVduPlugin (String cloudSiteId) {
-       Optional<CloudSite> cloudSite = cloudConfig.getCloudSite(cloudSiteId);
+       Optional<CloudSite> cloudSite = cloudConfigFactory.getCloudConfig().getCloudSite(cloudSiteId);
        if (cloudSite.isPresent()) {
                String orchestrator = cloudSite.get().getOrchestrator();