Fix Checkstyle issues
[clamp.git] / src / main / java / org / onap / clamp / clds / config / spring / CldsSdcControllerConfiguration.java
index 46c483f..92b0272 100644 (file)
@@ -5,20 +5,21 @@
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
+ * 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. 
- * See the License for the specific language governing permissions and 
+ *
+ * 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.
+ * See the License for the specific language governing permissions and
  * limitations under the License.
  * ============LICENSE_END============================================
+ *  * Modifications copyright (c) 2019 Nokia
  * ===================================================================
- * 
+ *
  */
 
 package org.onap.clamp.clds.config.spring;
@@ -56,21 +57,22 @@ public class CldsSdcControllerConfiguration {
     @Autowired
     protected CsarInstaller csarInstaller;
 
+    /**
+     * Loads SDC controllers configuration.
+     */
     @PostConstruct
     public void loadSdcControllers() {
         SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration();
         sdcControllersConfig.getAllDefinedControllers().forEach((k, v) -> {
-            logger.info("Instantiating controller :" + k);
-            SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, v, true);
-            try {
-                sdcController.initSdc();
-            } catch (SdcControllerException e) {
-                logger.error("Exception caught when starting sdc controller", e);
-            }
+            logger.info("Creating controller instance:" + k);
+            SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, v, null);
             sdcControllersList.add(sdcController);
         });
     }
 
+    /**
+     * Checks whether all SDC controllers defined are up and running.
+     */
     @Scheduled(fixedRate = 120000)
     public void checkAllSdcControllers() {
         logger.info("Checking that all SDC Controllers defined are up and running");
@@ -80,12 +82,15 @@ public class CldsSdcControllerConfiguration {
                     controller.initSdc();
                 }
             } catch (SdcControllerException e) {
-                logger.error("Exception caught when rebooting sdc controller", e);
+                logger.error("Exception caught when booting sdc controller", e);
             }
         }
         logger.info("SDC Controllers check completed");
     }
 
+    /**
+     * Closes all SDC Controller and the SDC Client.
+     */
     @PreDestroy
     public void killSdcControllers() {
         sdcControllersList.forEach(e -> {
@@ -97,11 +102,6 @@ public class CldsSdcControllerConfiguration {
         });
     }
 
-    @Bean(name = "csarInstaller")
-    public CsarInstaller getCsarInstaller() {
-        return new CsarInstallerImpl();
-    }
-
     @Bean(name = "sdcControllersConfiguration")
     public SdcControllersConfiguration getSdcControllersConfiguration() {
         return new SdcControllersConfiguration();