import net.sf.json.JSONArray;\r
import net.sf.json.JSONObject;\r
import org.glassfish.jersey.client.ClientConfig;\r
-import org.onap.holmes.common.api.stat.Alarm;\r
import org.onap.holmes.common.constant.AlarmConst;\r
\r
@Slf4j\r
public static String getConfigBindingServiceAddrInfo() {\r
String ret = null;\r
String queryString = getConsulAddrInfo() + CONFIG_BINDING_SERVICE;\r
+ log.info("Query the CBS address using the URL: " + queryString);\r
try {\r
JSONObject addrJson = (JSONObject) JSONArray.fromObject(execQuery(queryString)).get(0);\r
if (addrJson.has("ServiceAddress") && addrJson.has("ServicePort")) {\r
} catch (Exception e) {\r
log.warn(e.getMessage(), e);\r
}\r
+ log.info("The CBS address is " + ret);\r
return ret;\r
}\r
\r
String url = getConfigBindingServiceAddrInfo() + "/service_component/" +serviceName;\r
try {\r
JSONObject jsonObject = JSONObject.fromObject(execQuery(url));\r
+ log.info("The origin configurations (" + url + ") returned by DCAE is: " + jsonObject.toString());\r
if (jsonObject.has(serviceName)) {\r
ret = (String) jsonObject.getJSONArray(serviceName).get(0);\r
}\r
public static String[] getMsbAddrInfo() {\r
String[] msbServerInfo = null;\r
\r
- String info = getServiceAddrInfoFromCBS(MSB_ADDR);\r
+ //String info = getServiceAddrInfoFromCBS(MSB_ADDR);\r
+ String info = getServiceAddrInfoFromCBS(getEnv(HOSTNAME));\r
+ log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from CBS. The response is " + info + ".");\r
+\r
if (info != null){\r
- msbServerInfo = split(info);\r
+ JSONObject infoObj = JSONObject.fromObject(info);\r
+ String msbInfoTmp = infoObj.has("msb.hostname") ? infoObj.getString("msb.hostname") : null;\r
+ if (msbInfoTmp != null) {\r
+ msbServerInfo = split(msbInfoTmp);\r
+ } else {\r
+ msbServerInfo = split(getEnv(MSB_ADDR));\r
+ }\r
} else {\r
msbServerInfo = split(getEnv(MSB_ADDR));\r
}\r
public static String[] getServiceAddrInfo() {\r
String[] serviceAddrInfo = null;\r
String info = getServiceAddrInfoFromCBS(getEnv(HOSTNAME));\r
+ log.info("Got the service information of \"" + getEnv(HOSTNAME) + "\" from CBS. The response is " + info + ".");\r
if (info != null){\r
serviceAddrInfo = split(info);\r
} else {\r