/** * This intializes a new jersey restclient for http call with elasticenter */ public static ElastiCenterClient getElastistorRestClient() { ElastiCenterClient restclient = null; try { String ip = getConfigurationDao().getValue("cloudbyte.management.ip"); String apikey = getConfigurationDao().getValue("cloudbyte.management.apikey"); if (ip == null) { throw new CloudRuntimeException("set the value of cloudbyte.management.ip in global settings"); } if (apikey == null) { throw new CloudRuntimeException("set the value of cloudbyte.management.apikey in global settings"); } restclient = new ElastiCenterClient(ip, apikey); } catch (InvalidCredentialsException e) { throw new CloudRuntimeException("InvalidCredentialsException:" + e.getMessage(), e); } catch (InvalidParameterException e) { throw new CloudRuntimeException("InvalidParameterException:" + e.getMessage(), e); } catch (SSLHandshakeException e) { throw new CloudRuntimeException("SSLHandshakeException:" + e.getMessage(), e); } catch (ServiceUnavailableException e) { throw new CloudRuntimeException("ServiceUnavailableException:" + e.getMessage(), e); } return restclient; }