E&R handling in juju-vnfmadapter 99/38899/1
authorajay priyadarshi <ajay.priyadarshi@ril.com>
Tue, 27 Mar 2018 06:35:09 +0000 (12:05 +0530)
committerajay priyadarshi <ajay.priyadarshi@ril.com>
Tue, 27 Mar 2018 06:35:09 +0000 (12:05 +0530)
common/SwitchController.java
file name:ExceptionArgs.java

Change-Id: Ide5c57a792798240b8121739071300a0e238b51d
Issue-ID: VFC-852
Signed-off-by: ajay priyadarshi <ajay.priyadarshi@ril.com>
juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/EntityUtils.java
juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/LocalComandUtils.java
juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/SwitchController.java
juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/common/restclient/ExceptionArgs.java
juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/process/VnfMgr.java
juju/juju-vnfmadapter/Juju-vnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/gvnfm/jujuvnfmadapter/service/rest/VnfRoa.java

index 1cb803c..4056dd7 100644 (file)
@@ -288,7 +288,8 @@ public class EntityUtils {
         public void run() {
             try {
                 exitValue = process.waitFor();
-            } catch(InterruptedException e) {
+            } catch(Exception e) {
+               LOG.error("process.waitFor(): ",e);
                 return;
             }
         }
index 7cf6418..7dc980d 100644 (file)
@@ -196,7 +196,8 @@ public class LocalComandUtils {
         public void run() {
             try {
                 exitValue = process.waitFor();
-            } catch(InterruptedException e) {
+            } catch(Exception e) {
+               log.error("process.waitFor(): ",e);
                 return;
             }
         }
index 325be7a..bf43464 100644 (file)
@@ -31,7 +31,7 @@ public class SwitchController {
      * turn debug model
      */
     private static boolean debugModel = false;
-    public static String vnfmServiceUrl = null;
+    private static String vnfmServiceUrl = null;
 
     public SwitchController() { //NOSONAR
         //Constructor
@@ -52,4 +52,10 @@ public class SwitchController {
         SwitchController.debugModel = debugModel;
     }
     
+    public static void setVnfmServiceUrl(String inVnfmServiceUrl) {
+        SwitchController.vnfmServiceUrl = inVnfmServiceUrl;
+    }
+    public static String getVnfmServiceUrl() {
+       return SwitchController.vnfmServiceUrl;
+    }
 }
index 403f89b..a0500de 100644 (file)
@@ -15,6 +15,7 @@
  */
 
 package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.restclient;
+import java.io.Serializable;
 
 /**
  * ROA exception handling parameters.
@@ -25,7 +26,7 @@ package org.onap.vfc.nfvo.vnfm.gvnfm.jujuvnfmadapter.common.restclient;
  * @author
  * @version 28-May-2016
  */
-public class ExceptionArgs {
+public class ExceptionArgs implements Serializable{
 
     /**
      * Exception descriptions.
index 0fceb1e..9c2e981 100644 (file)
@@ -103,7 +103,7 @@ public class VnfMgr {
                 LOG.warn("the value 'vnfmServiceUrl' not exist."+e.getMessage());
             }
             if (StringUtils.isBlank(url)) {
-                url = SwitchController.vnfmServiceUrl;
+                url = SwitchController.getVnfmServiceUrl();
             }
             if (StringUtils.isBlank(url)) {
                 JSONObject vnfmObject = VnfmUtil.getVnfmById(vnfmId);
@@ -242,7 +242,7 @@ public class VnfMgr {
         JSONObject restJson = new JSONObject();
         restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL);
         try {
-            String url = SwitchController.vnfmServiceUrl;
+            String url = SwitchController.getVnfmServiceUrl();
 
             if (StringUtils.isBlank(url)) {
                 JSONObject vnfmObject = VnfmUtil.getVnfmById(vnfmId);
@@ -305,7 +305,7 @@ public class VnfMgr {
         JSONObject restJson = new JSONObject();
         restJson.put(EntityUtils.RESULT_CODE_KEY, Constant.REST_FAIL);
         try {
-            String url = SwitchController.vnfmServiceUrl;
+            String url = SwitchController.getVnfmServiceUrl();
             JSONObject vnfmObject = null;
             if (StringUtils.isBlank(url)) {
                 // call the ESR to get jujuvnfm server url
index 1f2a97c..98e8a4a 100644 (file)
@@ -95,7 +95,7 @@ public class VnfRoa {
         result.put("retCode", Constant.REST_SUCCESS);
         JSONObject reqJsonObject = StringUtil.getJsonFromContexts(context);
         String vnfmServiceUrl = reqJsonObject.getString("url");
-        SwitchController.vnfmServiceUrl = vnfmServiceUrl;
+        SwitchController.setVnfmServiceUrl(vnfmServiceUrl);
         LOG.info(reqJsonObject + ":setVNFMInfo success!");
         return result.toString();
     }