summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java12
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java25
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmManager.java15
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java5
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java4
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java95
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/NorthMessageMgr.java56
7 files changed, 120 insertions, 92 deletions
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java
index 6c41b65..c8ba21c 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java
@@ -15,13 +15,17 @@
*/
package org.onap.vfc.nfvo.emsdriver.collector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.onap.vfc.nfvo.emsdriver.commons.constant.Constant;
import org.onap.vfc.nfvo.emsdriver.commons.model.CollectMsg;
import org.onap.vfc.nfvo.emsdriver.commons.utils.DriverThread;
+import org.onap.vfc.nfvo.emsdriver.configmgr.ConfigurationManager;
import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannel;
import org.onap.vfc.nfvo.emsdriver.messagemgr.MessageChannelFactory;
public class CollectMsgReceiverThread extends DriverThread {
+ protected static final Log logger = LogFactory.getLog(CollectMsgReceiverThread.class);
private long timeStamp = System.currentTimeMillis();
@@ -43,7 +47,7 @@ public class CollectMsgReceiverThread extends DriverThread {
try {
if (System.currentTimeMillis() - timeStamp > Constant.ONEMINUTE) {
timeStamp = System.currentTimeMillis();
- log.debug("COLLECT_CHANNEL Msg size :"
+ logger.debug("COLLECT_CHANNEL Msg size :"
+ collectChannel.size());
}
Object obj = collectChannel.poll();
@@ -54,13 +58,13 @@ public class CollectMsgReceiverThread extends DriverThread {
if (obj instanceof CollectMsg) {
CollectMsg collectMsg = (CollectMsg) obj;
taskService.add(collectMsg);
- log.debug("receive a CollectMsg id = " + collectMsg.getId());
+ logger.debug("receive a CollectMsg id = " + collectMsg.getId());
} else {
- log.error("receive Objcet not CollectMsg " + obj);
+ logger.error("receive Objcet not CollectMsg " + obj);
}
} catch (Exception e) {
- log.error("dispatch alarm exception", e);
+ logger.error("dispatch alarm exception", e);
}
}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java
index 1ac304e..9b38c9c 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/TaskThread.java
@@ -140,14 +140,15 @@ public class TaskThread implements Runnable {
int event = -1;
while (reader.hasNext()) {
try {
+ String fileHeaderConstant = "FileHeader";
event = reader.next();
switch (event) {
case XMLStreamConstants.START_ELEMENT:
localName = reader.getLocalName();
- if ("FileHeader".equalsIgnoreCase(localName)) {
+ if (fileHeaderConstant.equalsIgnoreCase(localName)) {
fileHeaderStart = true;
}
- if (fileHeaderStart&& !"FileHeader".equalsIgnoreCase(localName)) {
+ if (fileHeaderStart&& !fileHeaderConstant.equalsIgnoreCase(localName)) {
commonNameAndValue.put(localName, reader.getElementText().trim());
}
if ("Measurements".equalsIgnoreCase(localName)) {
@@ -162,7 +163,7 @@ public class TaskThread implements Runnable {
}
if ("PmName".equalsIgnoreCase(localName)) {
pmNameFlag = true;
- pmNames = new LinkedHashMap<Integer, String>();
+ pmNames = new LinkedHashMap<>();
}
if (pmNameFlag && "N".equalsIgnoreCase(localName)) {
@@ -173,7 +174,7 @@ public class TaskThread implements Runnable {
}
if ("PmData".equalsIgnoreCase(localName)) {
pmDataFlag = true;
- pmDatas = new LinkedHashMap<String, String>();
+ pmDatas = new LinkedHashMap<>();
}
if (pmDataFlag) {
@@ -262,7 +263,7 @@ public class TaskThread implements Runnable {
measurementStart = false;
}
- if ("FileHeader".equalsIgnoreCase(endLocalName)) {
+ if (fileHeaderConstant.equalsIgnoreCase(endLocalName)) {
fileHeaderStart = false;
}
break;
@@ -555,19 +556,19 @@ public class TaskThread implements Runnable {
}
private void ftpStore(String[] fileKeys, String ip, String port,
- String ftp_user, String ftp_password, String ftp_passive,
- String ftp_type, String remoteFile) {
+ String ftpUser, String ftpPassword, String ftpPassive,
+ String ftpType, String remoteFile) {
String zipFilePath = fileKeys[0];
FTPInterface ftpClient;
ftpClient = new FTPSrv();
// login
try {
- ftpClient.login(ip, Integer.parseInt(port), ftp_user, ftp_password,
- "GBK", Boolean.parseBoolean(ftp_passive), 5 * 60 * 1000);
+ ftpClient.login(ip, Integer.parseInt(port), ftpUser, ftpPassword,
+ "GBK", Boolean.parseBoolean(ftpPassive), 5 * 60 * 1000);
} catch (Exception e) {
log.error("login fail,ip=[" + ip + "] port=[" + port + "] user=["
- + ftp_user + /* "]pwd=[" + ftp_password + */"]"
+ + ftpUser + "]pwd=[" + ftpPassword + "]"
+ StringUtil.getStackTrace(e));
return;
}
@@ -674,7 +675,7 @@ public class TaskThread implements Runnable {
public List<File> decompressed(String fileName) {
List<File> filelist = new ArrayList<>();
- if (fileName.indexOf(".gz") > 1) {
+ if (fileName.indexOf(".gz") > -1) {
try {
File decompressFile = deGz(fileName);
filelist.add(decompressFile);
@@ -682,7 +683,7 @@ public class TaskThread implements Runnable {
} catch (IOException e) {
log.error("decompressed is fail " + StringUtil.getStackTrace(e));
}
- } else if (fileName.indexOf(".zip") > 1) {
+ } else if (fileName.indexOf(".zip") > -1) {
try {
File[] files = deZip(new File(fileName));
new File(fileName).delete();
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmManager.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmManager.java
index 6de72be..de0da91 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmManager.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/AlarmManager.java
@@ -15,6 +15,9 @@
*/
package org.onap.vfc.nfvo.emsdriver.collector.alarm;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.onap.vfc.nfvo.emsdriver.collector.CollectMsgReceiverThread;
import org.onap.vfc.nfvo.emsdriver.commons.constant.Constant;
import org.onap.vfc.nfvo.emsdriver.commons.model.CollectVo;
import org.onap.vfc.nfvo.emsdriver.commons.model.EMSInfo;
@@ -26,12 +29,12 @@ import java.util.ArrayList;
import java.util.List;
public class AlarmManager extends DriverThread {
-
+ protected static final Log logger = LogFactory.getLog(AlarmManager.class);
private ConfigurationInterface configurationInterface;
@Override
public void dispose() {
- log.debug("AlarmManager is start");
+ logger.debug("AlarmManager is start");
// get alarm CONFIG_PROPERTIES_LOCATION
List<EMSInfo> emsInfos = configurationInterface.getAllEMSInfo();
while (isRun() && emsInfos.isEmpty()) {
@@ -39,11 +42,11 @@ public class AlarmManager extends DriverThread {
if (emsInfos.isEmpty()) {
try {
Thread.sleep(1000);
- log.debug("The configuration properties from "
+ logger.debug("The configuration properties from "
+ ConfigurationManager.CONFIG_PROPERTIES_LOCATION
+ " is not load");
} catch (Exception e) {
- log.error("Exception", e);
+ logger.error("Exception", e);
}
}
}
@@ -55,7 +58,7 @@ public class AlarmManager extends DriverThread {
collectVo.setEmsName(emsInfo.getName());
collectVos.add(collectVo);
} else {
- log.error("emsInfo.getCollectVoByType(EMS_RESOUCE) result CollectVo = null emsInfo ="
+ logger.error("emsInfo.getCollectVoByType(EMS_RESOUCE) result CollectVo = null emsInfo ="
+ emsInfo);
}
}
@@ -64,7 +67,7 @@ public class AlarmManager extends DriverThread {
AlarmTaskThread alarm = new AlarmTaskThread(collectVo);
alarm.setName(collectVo.getIP() + collectVo.getPort());
alarm.start();
- log.info("AlarmTaskThread is start");
+ logger.info("AlarmTaskThread is start");
}
}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java
index 313ce63..f59b633 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java
@@ -21,7 +21,10 @@ import java.io.*;
public class MessageUtil {
public static final String MSG_BODY_ENCODE_CHARSET = "UTF-8";
public static final int MSG_BUF_SIZE = 8096;
-
+
+ private MessageUtil(){
+
+ }
public static Msg putLoginMsg(String user, String passwd) {
String body = String.format(Msg.REQ_LOGIN_ALARM, user, passwd, "msg");
return new Msg(body, MsgType.REQ_LOGIN_ALARM);
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java
index 820b88f..62ca8b8 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/constant/Constant.java
@@ -37,5 +37,9 @@ public class Constant {
public static final String COLLECT_TYPE_ALARM = "EMS_ALARM";
public static final String ENCODING_UTF8 = "UTF-8";
public static final String ENCODING_GBK = "GBK";
+
+ private Constant(){
+
+ }
}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java
index 320d33c..f775d92 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java
@@ -34,6 +34,7 @@ import org.onap.vfc.nfvo.emsdriver.northbound.client.HttpClientUtil;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@@ -41,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap;
public class ConfigurationManager extends DriverThread {
public static final String CONFIG_PROPERTIES_LOCATION = Constant.SYS_CFG + "config.properties";
- protected static final Log log = LogFactory.getLog(ConfigurationManager.class);
+ protected static final Log logger = LogFactory.getLog(ConfigurationManager.class);
/**
* ESM Cache
*/
@@ -52,6 +53,23 @@ public class ConfigurationManager extends DriverThread {
private static Map<String, CrontabVo> emsCrontab = new ConcurrentHashMap<>();
private static List<String> emsIdList = new ArrayList<>();
+ static{
+ File file = new File(CONFIG_PROPERTIES_LOCATION);
+ if (!file.exists() || !file.isFile()) {
+ logger.error("cacheFilePath " + CONFIG_PROPERTIES_LOCATION + " not exist or is not File");
+ }else{
+ try {
+ InputStream in = new FileInputStream(file);
+ properties = new Properties();
+ properties.load(in);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ logger.error("read [" + file.getAbsolutePath() + "]Exception :", e);
+ }
+
+ }
+ }
+
public static synchronized List<EMSInfo> getAllEMSInfos() {
List<EMSInfo> list = new ArrayList<>();
for (EMSInfo emsinfo : emsInfoCache.values()) {
@@ -70,31 +88,18 @@ public class ConfigurationManager extends DriverThread {
@Override
public void dispose() {
-
- File file = new File(CONFIG_PROPERTIES_LOCATION);
- if (!file.exists() || !file.isFile()) {
- log.error("cacheFilePath " + CONFIG_PROPERTIES_LOCATION + " not exist or is not File");
- return;
- }
- try(InputStream in = new FileInputStream(file)){
- properties = new Properties();
- properties.load(in);
- Map<String, CrontabVo> emsMap = readCorntab();
-
- emsCrontab.putAll(emsMap);
-
- new ReceiveSource().start();
- } catch (Exception e) {
- log.error("read [" + file.getAbsolutePath() + "]Exception :", e);
- }
+ Map<String, CrontabVo> emsMap = readCorntab();
+ emsCrontab.putAll(emsMap);
+ new ReceiveSource().start();
+
}
public Map<String, CrontabVo> readCorntab() {
String path = Constant.SYS_CFG + "crontab.xml";
File cfg = new File(path);
- log.debug("start loading " + path);
+ logger.debug("start loading " + path);
if (!cfg.exists() || !cfg.isFile()) {
- log.debug("not exists " + path);
+ logger.debug("not exists " + path);
return null;
}
Map<String, CrontabVo> tmpcache = new HashMap<>();
@@ -139,7 +144,7 @@ public class ConfigurationManager extends DriverThread {
}
} catch (Exception e) {
- log.error("load crontab.xml is error " + StringUtil.getStackTrace(e));
+ logger.error("load crontab.xml is error " + StringUtil.getStackTrace(e));
}
return tmpcache;
}
@@ -154,11 +159,11 @@ public class ConfigurationManager extends DriverThread {
try {
if (System.currentTimeMillis() - timeStamp > Constant.ONEMINUTE) {
timeStamp = System.currentTimeMillis();
- log.debug("ReceiveSource run");
+ logger.debug("ReceiveSource run");
}
//get emsId list
List<String> emsIds = this.getEmsIdList();
- if (emsIds.size() > 0) {
+ if (!emsIds.isEmpty()) {
emsIdList.clear();
emsIdList.addAll(emsIds);
}
@@ -178,9 +183,9 @@ public class ConfigurationManager extends DriverThread {
try {
Thread.sleep(60 * 1000L);
} catch (Exception e1) {
- log.error("InterruptedException :" + StringUtil.getStackTrace(e1));
+ logger.error("InterruptedException :" + StringUtil.getStackTrace(e1));
}
- log.error("ReceiveSource exception", e);
+ logger.error("ReceiveSource exception", e);
}
}
}
@@ -193,7 +198,7 @@ public class ConfigurationManager extends DriverThread {
emstUrl = String.format(emstUrl, emsId);
String getemstUrl = "http://" + msbAddress + emstUrl;
String emsResult = HttpClientUtil.doGet(getemstUrl, Constant.ENCODING_UTF8);
- log.debug(getemstUrl + " result=" + emsResult);
+ logger.debug(getemstUrl + " result=" + emsResult);
JSONObject reagobj = JSONObject.parseObject(emsResult);
JSONObject esrSystemInfoList = reagobj.getJSONObject("esr-system-info-list");
@@ -202,6 +207,10 @@ public class ConfigurationManager extends DriverThread {
EMSInfo emsInfo = new EMSInfo();
emsInfo.setName(emsId);
tmpcache.put(emsId, emsInfo);
+ String ipAddressConstant = "ip-address";
+ String userNameConstant = "user-name";
+ String passwordConstant = "password";
+ String portConstant = "port";
while (it.hasNext()) {
Object obj = it.next();
JSONObject collect = (JSONObject) obj;
@@ -212,17 +221,17 @@ public class ConfigurationManager extends DriverThread {
if (crontabVo != null) {
collectVo.setType(systemType);
collectVo.setCrontab(crontabVo.getCrontab());
- collectVo.setIP(collect.getString("ip-address"));
- collectVo.setPort(collect.getString("port"));
- collectVo.setUser(collect.getString("user-name"));
- collectVo.setPassword(collect.getString("password"));
+ collectVo.setIP(collect.getString(ipAddressConstant));
+ collectVo.setPort(collect.getString(portConstant));
+ collectVo.setUser(collect.getString(userNameConstant));
+ collectVo.setPassword(collect.getString(passwordConstant));
collectVo.setRemotepath(collect.getString("remote-path"));
collectVo.setMatch(crontabVo.getMatch());
collectVo.setPassive(collect.getString("passive"));
collectVo.setGranularity(crontabVo.getGranularity());
} else {
- log.error("emsCrontab.get(systemType) result crontabVo is null systemType=[" + systemType + "] emsCrontabMap=" + emsCrontab);
+ logger.error("emsCrontab.get(systemType) result crontabVo is null systemType=[" + systemType + "] emsCrontabMap=" + emsCrontab);
}
@@ -231,35 +240,35 @@ public class ConfigurationManager extends DriverThread {
if (crontabVo != null) {
collectVo.setType(systemType);
collectVo.setCrontab(crontabVo.getCrontab());
- collectVo.setIP(collect.getString("ip-address"));
- collectVo.setPort(collect.getString("port"));
- collectVo.setUser(collect.getString("user-name"));
- collectVo.setPassword(collect.getString("password"));
+ collectVo.setIP(collect.getString(ipAddressConstant));
+ collectVo.setPort(collect.getString(portConstant));
+ collectVo.setUser(collect.getString(userNameConstant));
+ collectVo.setPassword(collect.getString(passwordConstant));
collectVo.setRemotepath(collect.getString("remote-path"));
collectVo.setMatch(crontabVo.getMatch());
collectVo.setPassive(collect.getString("passive"));
collectVo.setGranularity(crontabVo.getGranularity());
} else {
- log.error("emsCrontab.get(systemType) result crontabVo is null systemType=[" + systemType + "]");
+ logger.error("emsCrontab.get(systemType) result crontabVo is null systemType=[" + systemType + "]");
}
} else if (Constant.COLLECT_TYPE_ALARM.equalsIgnoreCase(systemType)) {
CrontabVo crontabVo = emsCrontab.get(systemType);
if (crontabVo != null) {
collectVo.setIscollect(crontabVo.isIscollect());
collectVo.setType(systemType);
- collectVo.setIP(collect.getString("ip-address"));
- collectVo.setPort(collect.getString("port"));
- collectVo.setUser(collect.getString("user-name"));
- collectVo.setPassword(collect.getString("password"));
+ collectVo.setIP(collect.getString(ipAddressConstant));
+ collectVo.setPort(collect.getString(portConstant));
+ collectVo.setUser(collect.getString(userNameConstant));
+ collectVo.setPassword(collect.getString(passwordConstant));
collectVo.setReadTimeout(crontabVo.getReadTimeout());
} else {
- log.error("emsCrontab.get(systemType) result crontabVo is null systemType=[" + systemType + "]");
+ logger.error("emsCrontab.get(systemType) result crontabVo is null systemType=[" + systemType + "]");
}
} else {
- log.error("ems system-type =" + systemType + " ");
+ logger.error("ems system-type =" + systemType + " ");
}
emsInfo.putCollectMap(systemType, collectVo);
@@ -275,7 +284,7 @@ public class ConfigurationManager extends DriverThread {
String getemsListUrl = "http://" + msbAddress + url;
String result = HttpClientUtil.doGet(getemsListUrl, Constant.ENCODING_UTF8);
- log.debug(getemsListUrl + " result=" + result);
+ logger.debug(getemsListUrl + " result=" + result);
JSONObject reagobj = JSONObject.parseObject(result);
JSONArray esrEmsIds = reagobj.getJSONArray("esr-ems");
Iterator<Object> it = esrEmsIds.iterator();
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/NorthMessageMgr.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/NorthMessageMgr.java
index 1d618e5..967447b 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/NorthMessageMgr.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/NorthMessageMgr.java
@@ -24,7 +24,11 @@ import evel_javalibrary.att.com.EvelFault.EVEL_SOURCE_TYPES;
import evel_javalibrary.att.com.EvelFault.EVEL_VF_STATUSES;
import evel_javalibrary.att.com.EvelHeader;
import evel_javalibrary.att.com.EvelScalingMeasurement;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Level;
+import org.onap.vfc.nfvo.emsdriver.collector.alarm.AlarmManager;
import org.onap.vfc.nfvo.emsdriver.commons.constant.Constant;
import org.onap.vfc.nfvo.emsdriver.commons.utils.DriverThread;
import org.onap.vfc.nfvo.emsdriver.configmgr.ConfigurationInterface;
@@ -38,7 +42,7 @@ import java.util.Map;
import java.util.Properties;
public class NorthMessageMgr extends DriverThread {
-
+ protected static final Log logger = LogFactory.getLog(NorthMessageMgr.class);
private MessageChannel alarmChannel = MessageChannelFactory.getMessageChannel(Constant.RESULT_CHANNEL_KEY);
private MessageChannel collectResultPMChannel = MessageChannelFactory.getMessageChannel(Constant.COLLECT_RESULT_PM_CHANNEL_KEY);
private MessageChannel collectResultChannel = MessageChannelFactory.getMessageChannel(Constant.COLLECT_RESULT_CHANNEL_KEY);
@@ -49,7 +53,7 @@ public class NorthMessageMgr extends DriverThread {
@Override
public void dispose() {
- log.info("NorthMessageMgr Thread start threadStop=" + threadStop);
+ logger.info("NorthMessageMgr Thread start threadStop=" + threadStop);
try {
Properties properties = configurationInterface.getProperties();
String eventApiUrl = properties.getProperty("event_api_url");
@@ -67,7 +71,7 @@ public class NorthMessageMgr extends DriverThread {
//login north
eventApiUrl = "http://" + eventApiUrl;
- log.info("AgentMain.evel_initialize start event_api_url=[" + eventApiUrl + "]port=[" + port + "]path=[" + path + "]"
+ logger.info("AgentMain.evel_initialize start event_api_url=[" + eventApiUrl + "]port=[" + port + "]path=[" + path + "]"
+ "topic=[" + topic + "]username=[" + username + /*"]password=[" + password +*/ "]level=[" + level + "]");
try {
EVEL_ERR_CODES evecode = AgentMain.evel_initialize(eventApiUrl, Integer.parseInt(port),
@@ -75,12 +79,12 @@ public class NorthMessageMgr extends DriverThread {
username,
password,
level);
- log.info("AgentMain.evel_initialize sucess EVEL_ERR_CODES=" + evecode);
+ logger.info("AgentMain.evel_initialize sucess EVEL_ERR_CODES=" + evecode);
} catch (Exception e) {
- log.error("AgentMain.evel_initialize fail ", e);
+ logger.error("AgentMain.evel_initialize fail ", e);
}
} catch (Exception e2) {
- log.error("NorthMessageMgr start fail ", e2);
+ logger.error("NorthMessageMgr start fail ", e2);
}
new HeatBeatTread().start();
@@ -91,7 +95,7 @@ public class NorthMessageMgr extends DriverThread {
new CollectMessageRecv().start();
- log.info("NorthMessageMgr start sucess ");
+ logger.info("NorthMessageMgr start sucess ");
}
/**
@@ -120,14 +124,14 @@ public class NorthMessageMgr extends DriverThread {
header.evel_nfnamingcode_set("EMS-driver");
header.evel_nfcnamingcode_set("EMS-driver");
AgentMain.evel_post_event(header);
- log.info("HeatBeat send!");
+ logger.info("HeatBeat send!");
try {
Thread.sleep(60 * 1000L);//60 secs
} catch (Exception e) {
- log.error("Unable to sleep the HB thread ", e);
+ logger.error("Unable to sleep the HB thread ", e);
}
} catch (Exception e) {
- log.error("HeatBeatTread exception", e);
+ logger.error("HeatBeatTread exception", e);
}
}
}
@@ -144,7 +148,7 @@ public class NorthMessageMgr extends DriverThread {
if (System.currentTimeMillis() - timeStamp > Constant.ONEMINUTE) {
timeStamp = System.currentTimeMillis();
- log.info("ALARM_CHANNEL Msg size :" + alarmChannel.size());
+ logger.info("ALARM_CHANNEL Msg size :" + alarmChannel.size());
}
Object obj = alarmChannel.poll();
@@ -158,15 +162,15 @@ public class NorthMessageMgr extends DriverThread {
EvelFault evelFault = this.resultEvelFault(reagobj);
//send
- log.info("AgentMain.evel_post_event alarm start");
+ logger.info("AgentMain.evel_post_event alarm start");
AgentMain.evel_post_event(evelFault);
- log.info("AgentMain.evel_post_event alarm sucess");
+ logger.info("AgentMain.evel_post_event alarm sucess");
} else {
- log.error("AlarmMessageRecv receive Object = " + obj);
+ logger.error("AlarmMessageRecv receive Object = " + obj);
}
} catch (Exception e) {
- log.error("AlarmMessageRecv exception", e);
+ logger.error("AlarmMessageRecv exception", e);
}
}
}
@@ -222,7 +226,7 @@ public class NorthMessageMgr extends DriverThread {
try {
eventTimeD = format.parse(eventTime);
} catch (ParseException e) {
- log.error("ParseException ", e);
+ logger.error("ParseException ", e);
}
flt.evel_start_epoch_set(eventTimeD.getTime());
flt.evel_last_epoch_set(eventTimeD.getTime());
@@ -255,7 +259,7 @@ public class NorthMessageMgr extends DriverThread {
if (System.currentTimeMillis() - timeStamp > Constant.ONEMINUTE) {
timeStamp = System.currentTimeMillis();
- log.debug("COLLECT_RESULT_CHANNEL Msg size :" + collectResultChannel.size());
+ logger.debug("COLLECT_RESULT_CHANNEL Msg size :" + collectResultChannel.size());
}
Object obj = collectResultChannel.poll();
@@ -272,7 +276,7 @@ public class NorthMessageMgr extends DriverThread {
}
} catch (Exception e) {
- log.error("ResultMessageRecv exception", e);
+ logger.error("ResultMessageRecv exception", e);
}
}
}
@@ -283,14 +287,14 @@ public class NorthMessageMgr extends DriverThread {
@Override
public void run() {
- log.info("CollectMessageRecv Thread is start threadStop=" + threadStop);
+ logger.info("CollectMessageRecv Thread is start threadStop=" + threadStop);
while (!threadStop) {
try {
if (System.currentTimeMillis() - timeStamp > Constant.ONEMINUTE) {
timeStamp = System.currentTimeMillis();
- log.debug(Constant.COLLECT_RESULT_PM_CHANNEL_KEY + " Msg size :" + collectResultPMChannel.size());
+ logger.debug(Constant.COLLECT_RESULT_PM_CHANNEL_KEY + " Msg size :" + collectResultPMChannel.size());
}
Object obj = collectResultPMChannel.poll();
@@ -300,20 +304,20 @@ public class NorthMessageMgr extends DriverThread {
if (obj instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, String> reMap = (Map<String, String>) obj;
- log.debug("reMap =" + reMap);
+ logger.debug("reMap =" + reMap);
EvelScalingMeasurement evelScalingMeasurement = this.resultEvelScalingMeasurement(reMap);
- log.debug("evelScalingMeasurement=" + evelScalingMeasurement);
+ logger.debug("evelScalingMeasurement=" + evelScalingMeasurement);
//send
- log.info("AgentMain.evel_post_event start");
+ logger.info("AgentMain.evel_post_event start");
AgentMain.evel_post_event(evelScalingMeasurement);
- log.info("AgentMain.evel_post_event sucess");
+ logger.info("AgentMain.evel_post_event sucess");
} else {
- log.error("CollectMessageRecv receive Object = " + obj);
+ logger.error("CollectMessageRecv receive Object = " + obj);
}
} catch (Exception e) {
- log.error("CollectMessageRecv exception", e);
+ logger.error("CollectMessageRecv exception", e);
}
}
}