Replaced all tabs with spaces in java and pom.xml
[so.git] / adapters / mso-adapter-utils / src / main / java / org / onap / so / openstack / utils / MsoYamlEditorWithEnvt.java
index 5f26449..0541a8f 100644 (file)
@@ -40,39 +40,40 @@ import org.yaml.snakeyaml.Yaml;
 public class MsoYamlEditorWithEnvt {
 
     private static final Logger logger = LoggerFactory.getLogger(MsoYamlEditorWithEnvt.class);
-    
-    private Map <String, Object> yml;
-    private Yaml yaml = new Yaml ();
+
+    private Map<String, Object> yml;
+    private Yaml yaml = new Yaml();
     private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
 
-       public MsoYamlEditorWithEnvt() {
-               super();
-       }
-       public MsoYamlEditorWithEnvt(byte[] b) {
-               init(b);
-       }
+    public MsoYamlEditorWithEnvt() {
+        super();
+    }
+
+    public MsoYamlEditorWithEnvt(byte[] b) {
+        init(b);
+    }
 
     @SuppressWarnings("unchecked")
-    private synchronized void init (byte[] body) {
-        InputStream input = new ByteArrayInputStream (body);
-        yml = (Map <String, Object>) yaml.load (input);
-    }  
+    private synchronized void init(byte[] body) {
+        InputStream input = new ByteArrayInputStream(body);
+        yml = (Map<String, Object>) yaml.load(input);
+    }
 
     @SuppressWarnings("unchecked")
-       public synchronized Set <MsoHeatEnvironmentParameter> getParameterListFromEnvt() {
-       // In an environment entry, the parameters section can only contain the name:value - 
-       // not other attributes.
-       Set <MsoHeatEnvironmentParameter> paramSet = new HashSet<>();
-       Map<String, Object> resourceMap = null;
-       try {
-               resourceMap = (Map<String,Object>) yml.get("parameters");
-       } catch (Exception e) {
-          logger.debug("Exception:", e);
-          return paramSet;
-       }
-       if (resourceMap == null) {
-               return paramSet;
-       }
+    public synchronized Set<MsoHeatEnvironmentParameter> getParameterListFromEnvt() {
+        // In an environment entry, the parameters section can only contain the name:value -
+        // not other attributes.
+        Set<MsoHeatEnvironmentParameter> paramSet = new HashSet<>();
+        Map<String, Object> resourceMap = null;
+        try {
+            resourceMap = (Map<String, Object>) yml.get("parameters");
+        } catch (Exception e) {
+            logger.debug("Exception:", e);
+            return paramSet;
+        }
+        if (resourceMap == null) {
+            return paramSet;
+        }
 
         for (Entry<String, Object> stringObjectEntry : resourceMap.entrySet()) {
             MsoHeatEnvironmentParameter hep = new MsoHeatEnvironmentParameter();
@@ -84,7 +85,7 @@ public class MsoYamlEditorWithEnvt {
                 // but this adds an extra '\n' at the end - which won't hurt - but we don't need it
                 value = value.substring(0, value.length() - 1);
             } else if (obj instanceof LinkedHashMap) {
-                //Handle that it's json
+                // Handle that it's json
                 try {
                     value = JSON_MAPPER.writeValueAsString(obj);
                 } catch (Exception e) {
@@ -92,20 +93,21 @@ public class MsoYamlEditorWithEnvt {
                     value = "_BAD_JSON_MAPPING";
                 }
             } else {
-                //this handles integers/longs/floats/etc.
+                // this handles integers/longs/floats/etc.
                 value = String.valueOf(obj);
             }
             hep.setName((String) pair.getKey());
             hep.setValue(value);
             paramSet.add(hep);
         }
-       return paramSet;
+        return paramSet;
     }
-    public synchronized Set <MsoHeatEnvironmentResource> getResourceListFromEnvt() {
-       try {
-               Set<MsoHeatEnvironmentResource> resourceList = new HashSet<>();
-               @SuppressWarnings("unchecked")
-               Map<String, Object> resourceMap = (Map<String,Object>) yml.get("resource_registry");
+
+    public synchronized Set<MsoHeatEnvironmentResource> getResourceListFromEnvt() {
+        try {
+            Set<MsoHeatEnvironmentResource> resourceList = new HashSet<>();
+            @SuppressWarnings("unchecked")
+            Map<String, Object> resourceMap = (Map<String, Object>) yml.get("resource_registry");
 
             for (Entry<String, Object> stringObjectEntry : resourceMap.entrySet()) {
                 MsoHeatEnvironmentResource her = new MsoHeatEnvironmentResource();
@@ -114,16 +116,17 @@ public class MsoYamlEditorWithEnvt {
                 her.setValue((String) pair.getValue());
                 resourceList.add(her);
             }
-               return resourceList;
-       } catch (Exception e) {
-          logger.debug("Exception:", e);
-      }
-       return null;
+            return resourceList;
+        } catch (Exception e) {
+            logger.debug("Exception:", e);
+        }
+        return null;
     }
-    public synchronized Set <HeatTemplateParam> getParameterList () {
-        Set <HeatTemplateParam> paramSet = new HashSet <> ();
+
+    public synchronized Set<HeatTemplateParam> getParameterList() {
+        Set<HeatTemplateParam> paramSet = new HashSet<>();
         @SuppressWarnings("unchecked")
-        Map <String, Object> resourceMap = (Map <String, Object>) yml.get ("parameters");
+        Map<String, Object> resourceMap = (Map<String, Object>) yml.get("parameters");
 
         for (Entry<String, Object> stringObjectEntry : resourceMap.entrySet()) {
             HeatTemplateParam param = new HeatTemplateParam();
@@ -138,7 +141,7 @@ public class MsoYamlEditorWithEnvt {
                 // This exception only - the value is an integer. For what we're doing
                 // here - we don't care - so set value to something - and it will
                 // get marked as not being required - which is correct.
-                //System.out.println("cce exception!");
+                // System.out.println("cce exception!");
                 value = "300";
                 // okay
             }