diff options
Diffstat (limited to 'huawei/vnfmadapter/VnfmadapterService/service/src/main')
2 files changed, 16 insertions, 6 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapter2DriverMgrService.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapter2DriverMgrService.java index 83652b70..b3ba1760 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapter2DriverMgrService.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapter2DriverMgrService.java @@ -82,12 +82,16 @@ public class VnfmAdapter2DriverMgrService implements IVnfmAdapter2DriverMgrServi * @throws IOException */ public static String readVnfmAdapterInfoFromJson() throws IOException { - String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + "adapterInfo" + System.getProperty(Constant.FILE_SEPARATOR) + VNFMADAPTER2DRIVERMGR; + return readJson(fileName); + } + + public static String readJson(String fileName) throws IOException { + String fileContent = ""; + try (InputStream ins = new FileInputStream(fileName)){ try(BufferedInputStream bins = new BufferedInputStream(ins)){ diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapterMgrService.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapterMgrService.java index dabaf380..8df2c796 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapterMgrService.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/api/internalsvc/impl/VnfmAdapterMgrService.java @@ -81,14 +81,19 @@ public class VnfmAdapterMgrService implements IVnfmAdapterMgrService { * @throws IOException */ public String readVnfmAdapterInfoFromJson() throws IOException { - String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + "adapterInfo" + System.getProperty(Constant.FILE_SEPARATOR) + VNFMADAPTERINFO; - try (InputStream ins = new FileInputStream(fileName)) { - try (BufferedInputStream bins = new BufferedInputStream(ins)){ + + return readJson(fileName); + } + + public static String readJson(String fileName) throws IOException { + String fileContent = ""; + + try (InputStream ins = new FileInputStream(fileName)){ + try(BufferedInputStream bins = new BufferedInputStream(ins)){ byte[] contentByte = new byte[ins.available()]; int num = bins.read(contentByte); @@ -104,6 +109,7 @@ public class VnfmAdapterMgrService implements IVnfmAdapterMgrService { return fileContent; } + private static class RegisterVnfmAdapterThread implements Runnable { private IDriver2MSBManager adapter2MSBMgr = new Driver2MSBManager(); |