diff options
Diffstat (limited to 'nokia/vnfmdriver/vfcadaptorservice')
-rw-r--r-- | nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java index 74fb4395..cd4c7e31 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java @@ -115,42 +115,43 @@ public class MsbMgmrImpl implements IMsbMgmr { } - public String getServiceUrlInMsbBySeriveNameAndVersion(String serviceName, String version) throws ClientProtocolException, IOException { - String url = adaptorEnv.getMsbApiUriFront() + String.format(CommonConstants.MSB_QUERY_SERVICE_PATH, serviceName, version); - - HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.GET, null, null); - - String responseStr = httpResult.getContent(); - logger.info("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion, responseStr is " + responseStr); - String serviceUrl = ""; - if(httpResult.getStatusCode() == 200) - { - MsbServiceInfo serviceInfo = gson.fromJson(responseStr, MsbServiceInfo.class); - if (null == serviceInfo) { - logger.error("There is no service in MSB for serviceName = {} and version = {}", serviceName, version); + public String getServiceUrlInMsbBySeriveNameAndVersion(String serviceName, String version) throws IOException { + try{ + String url = adaptorEnv.getMsbApiUriFront() + String.format(CommonConstants.MSB_QUERY_SERVICE_PATH, serviceName, version); + + HttpResult httpResult = httpClientProcessor.process(url, RequestMethod.GET, null, null); + + String responseStr = httpResult.getContent(); + logger.info("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion, responseStr is " + responseStr); + String serviceUrl = ""; + if(httpResult.getStatusCode() == 200) + { + MsbServiceInfo serviceInfo = gson.fromJson(responseStr, MsbServiceInfo.class); + if (null == serviceInfo) { + logger.error("There is no service in MSB for serviceName = {} and version = {}", serviceName, version); + } + else{ + serviceUrl = serviceInfo.getUrl(); + logger.info("Service Url in MSB for serviceName = {} and version = {} is {}", serviceName, version, serviceUrl); + } } - - serviceUrl = serviceInfo.getUrl(); - logger.info("Service Url in MSB for serviceName = {} and version = {} is {}", serviceName, version, serviceUrl); - } - else - { - logger.error("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion Error, statusCode = " + httpResult.getStatusCode()); - } + else + { + logger.error("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion Error, statusCode = " + httpResult.getStatusCode()); + } + + return serviceUrl; + }catch(Exception e){ + logger.error("MsbMgmrImpl -> getServiceUrlInMsbBySeriveNameAndVersion Error", e); + throw new IOException("getServiceUrlInMsbBySeriveNameAndVersion", e); - return serviceUrl; + } + } public void setAdaptorEnv(AdaptorEnv env) { this.adaptorEnv = env; } -// public static final void main(String[] args) { -//// MsbMgmrImpl impl = new MsbMgmrImpl(); -//// impl.register(); -// System.setProperty("catalina.base", "D:\\Install\\apache-tomcat-9.0.0.M26"); -// System.out.println(System.getProperty("catalina.base")); -// } - } |