From 73edaecd636ca73657aeef7bcc4b0c6e13d03068 Mon Sep 17 00:00:00 2001 From: luxin Date: Wed, 20 Sep 2017 17:27:20 +0800 Subject: Define a constant instead of file.separator Change-Id: Ib37c70afaa9f41c95039571d2327b00592eb40fd Issue-Id:VFC-375 Signed-off-by: luxin --- .../service/adapter/impl/AdapterResourceManager.java | 16 ++++++++-------- .../internalsvc/impl/VnfmAdapter2DriverMgrService.java | 6 +++--- .../api/internalsvc/impl/VnfmAdapterMgrService.java | 6 +++--- .../svnfm/vnfmadapter/service/constant/Constant.java | 2 ++ .../service/csm/connect/AbstractSslContext.java | 7 ++++--- 5 files changed, 20 insertions(+), 17 deletions(-) (limited to 'huawei/vnfmadapter/VnfmadapterService') diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java index 13765a88..5e386376 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/adapter/impl/AdapterResourceManager.java @@ -111,7 +111,7 @@ public class AdapterResourceManager implements IResourceManager { // download csar package and save in location. JSONObject downloadObject = - downloadCsar(downloadUri, csarfilepath + System.getProperty("file.separator") + csarfilename); + downloadCsar(downloadUri, csarfilepath + System.getProperty(Constant.FILE_SEPARATOR) + csarfilename); if(Integer.valueOf(downloadObject.get("retCode").toString()) != Constant.REST_SUCCESS) { LOG.error("download CSAR fail.", downloadObject.get("retCode")); @@ -123,7 +123,7 @@ public class AdapterResourceManager implements IResourceManager { // unzip csar package to location. JSONObject unzipObject = - unzipCSAR(csarfilepath + System.getProperty("file.separator") + csarfilename, csarfilepath); + unzipCSAR(csarfilepath + System.getProperty(Constant.FILE_SEPARATOR) + csarfilename, csarfilepath); if(Integer.valueOf(unzipObject.get("retCode").toString()) != Constant.REST_SUCCESS) { LOG.error("unzip CSAR fail.", unzipObject.get("retCode")); @@ -545,9 +545,9 @@ public class AdapterResourceManager implements IResourceManager { BufferedInputStream bins = null; String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator") - + "etc" + System.getProperty("file.separator") + "vnfpkginfo" + System.getProperty("file.separator") - + Constant.VNFPKGINFO; + String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + + "vnfpkginfo" + System.getProperty(Constant.FILE_SEPARATOR) + Constant.VNFPKGINFO; try { ins = new FileInputStream(fileName); @@ -579,9 +579,9 @@ public class AdapterResourceManager implements IResourceManager { BufferedInputStream bins = null; String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator") - + "etc" + System.getProperty("file.separator") + "vnfpkginfo" + System.getProperty("file.separator") - + "vnfd_ids.json"; + String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + + "vnfpkginfo" + System.getProperty(Constant.FILE_SEPARATOR) + "vnfd_ids.json"; try { ins = new FileInputStream(fileName); 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 f2a244ba..a13d57c1 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 @@ -86,9 +86,9 @@ public class VnfmAdapter2DriverMgrService implements IVnfmAdapter2DriverMgrServi BufferedInputStream bins = null; String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator") - + "etc" + System.getProperty("file.separator") + "adapterInfo" + System.getProperty("file.separator") - + VNFMADAPTER2DRIVERMGR; + String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + + "adapterInfo" + System.getProperty(Constant.FILE_SEPARATOR) + VNFMADAPTER2DRIVERMGR; try { ins = new FileInputStream(fileName); 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 f497eaf2..30f71b0b 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 @@ -85,9 +85,9 @@ public class VnfmAdapterMgrService implements IVnfmAdapterMgrService { BufferedInputStream bins = null; String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator") - + "etc" + System.getProperty("file.separator") + "adapterInfo" + System.getProperty("file.separator") - + VNFMADAPTERINFO; + String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + + "adapterInfo" + System.getProperty(Constant.FILE_SEPARATOR) + VNFMADAPTERINFO; try { ins = new FileInputStream(fileName); diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java index 45662faf..36a2c7dc 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java @@ -146,6 +146,8 @@ public class Constant { public static final String JOBID = "jobId"; + public static final String FILE_SEPARATOR = "file.separator"; + private Constant() { // private constructor } diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/AbstractSslContext.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/AbstractSslContext.java index 42f022b5..61c1f8fa 100644 --- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/AbstractSslContext.java +++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/AbstractSslContext.java @@ -35,6 +35,7 @@ import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.common.restclient.SystemEnvVariablesFactory; +import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.constant.Constant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -147,9 +148,9 @@ public class AbstractSslContext { BufferedInputStream bins = null; String fileContent = ""; - String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + System.getProperty("file.separator") - + "etc" + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator") - + "sslconf.json"; + String fileName = SystemEnvVariablesFactory.getInstance().getAppRoot() + + System.getProperty(Constant.FILE_SEPARATOR) + "etc" + System.getProperty(Constant.FILE_SEPARATOR) + + "conf" + System.getProperty(Constant.FILE_SEPARATOR) + "sslconf.json"; try { ins = new FileInputStream(fileName); -- cgit 1.2.3-korg