summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ems/boco/.classpath2
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThread.java16
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/collector/alarm/MessageUtil.java4
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPInterface.java2
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPSrv.java7
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java3
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java22
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java3
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java24
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/configmgr/ConfigurationManager.java3
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/northbound/client/NorthMessageMgr.java16
-rw-r--r--ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThreadTest.java8
12 files changed, 60 insertions, 50 deletions
diff --git a/ems/boco/.classpath b/ems/boco/.classpath
index 68d3e86..8019572 100644
--- a/ems/boco/.classpath
+++ b/ems/boco/.classpath
@@ -22,7 +22,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_144">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
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 f53a5ed..d3ced48 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
@@ -29,14 +29,14 @@ public class CollectMsgReceiverThread extends DriverThread {
private TaskThreadService taskService;
- private int thread_max_num = 100;
+ private int threadMaxNum = 100;
@Override
public void dispose() {
collectChannel = MessageChannelFactory.getMessageChannel(Constant.COLLECT_CHANNEL_KEY);
- taskService = TaskThreadService.getInstance(thread_max_num);
+ taskService = TaskThreadService.getInstance(threadMaxNum);
taskService.start();
while (isRun()) {
@@ -71,18 +71,18 @@ public class CollectMsgReceiverThread extends DriverThread {
/**
- * @return the thread_max_num
+ * @return the threadMaxNum
*/
- public int getThread_max_num() {
- return thread_max_num;
+ public int getThreadMaxNum() {
+ return threadMaxNum;
}
/**
- * @param thread_max_num the thread_max_num to set
+ * @param threadMaxNum the threadMaxNum to set
*/
- public void setThread_max_num(int thread_max_num) {
- this.thread_max_num = thread_max_num;
+ public void setThreadMaxNum(int threadMaxNum) {
+ this.threadMaxNum = threadMaxNum;
}
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 7bf7a11..ff34554 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
@@ -19,8 +19,8 @@ import java.io.*;
public class MessageUtil {
- public static String MSG_BODY_ENCODE_CHARSET = "UTF-8";
- public static int MSG_BUF_SIZE = 8096;
+ public static final String MSG_BODY_ENCODE_CHARSET = "UTF-8";
+ public static final int MSG_BUF_SIZE = 8096;
public static Msg putLoginMsg(String user, String passwd) {
String body = String.format(Msg.reqLoginAlarm, user, passwd, "msg");
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPInterface.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPInterface.java
index 660c906..88acf66 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPInterface.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPInterface.java
@@ -24,7 +24,7 @@ public interface FTPInterface {
*
* @throws Exception
*/
- public void login(String host, int port, String user, String pwd, String encode, boolean isPassiveMode, int timeout) throws Exception;
+ public void login(String host, int port, String user, String pwd, String encode, boolean isPassiveMode, int timeout) throws IOException;
/**
* close ftp
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPSrv.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPSrv.java
index 1e82b78..a2b04bc 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPSrv.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/ftp/FTPSrv.java
@@ -42,7 +42,7 @@ public class FTPSrv implements FTPInterface {
* @param timeout
* @throws Exception
*/
- public void login(String host, int port, String user, String pwd, String encode, boolean isPassiveMode, int timeout) throws Exception {
+ public void login(String host, int port, String user, String pwd, String encode, boolean isPassiveMode, int timeout) throws IOException {
ftpClient = new FTPClient();
FTPClientConfig ftpClientConfig = new FTPClientConfig();
@@ -63,7 +63,7 @@ public class FTPSrv implements FTPInterface {
}
if (!ftpClient.login(user, pwd)) {
- throw new Exception("login[" + host + "],port[" + port + "] fail, please check user and password");
+ throw new IOException("login[" + host + "],port[" + port + "] fail, please check user and password");
}
if (isPassiveMode) {
ftpClient.enterLocalPassiveMode();
@@ -76,7 +76,8 @@ public class FTPSrv implements FTPInterface {
try {
this.ftpClient.setSoTimeout(timeout);
} catch (Exception e) {
- e.printStackTrace();
+ //e.printStackTrace();
+ log.error(" StackTrace :", e);
}
}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java
index cbdbd3c..1b59022 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/DriverThread.java
@@ -52,7 +52,8 @@ public abstract class DriverThread implements Runnable {
try {
dispose();
} catch (Exception e) {
- e.printStackTrace();
+ //e.printStackTrace();
+ log.error(" printStackTrace :", e);
}
this.setEnd(true);
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java
index 9098c27..a24afbe 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java
@@ -24,24 +24,22 @@ public class Gunzip {
*
*/
public void unCompress(String gzFileName, String toFile) throws IOException {
- GZIPInputStream gzIn = null;
- FileOutputStream fileOutput = null;
- FileInputStream gzInput = new FileInputStream(gzFileName);
try {
- gzIn = new GZIPInputStream(gzInput);
+ FileInputStream gzInput = new FileInputStream(gzFileName);
+ GZIPInputStream gzIn = new GZIPInputStream(gzInput);
File tofile = new File(toFile);
enable(tofile);
- fileOutput = new FileOutputStream(tofile, false);
-
- moveBytes(gzIn, fileOutput, -1, -1, 1024);
- } finally {
- if (gzIn != null) {
+ FileOutputStream fileOutput = new FileOutputStream(tofile, false);
+ try{
+ moveBytes(gzIn, fileOutput, -1, -1, 1024);
+ } finally {
+ gzInput.close();
gzIn.close();
- }
- if (fileOutput != null) {
fileOutput.close();
}
+ }catch(IOException e){
+ throw e;
}
}
@@ -81,4 +79,4 @@ public class Gunzip {
return totalNum;
}
-} \ No newline at end of file
+}
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java
index b065083..49e0894 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/UnZip.java
@@ -56,7 +56,8 @@ public class UnZip {
try {
Enumeration<ZipEntry> e = zipFile.getEntries();
for (ZipEntry entry; e.hasMoreElements(); ) {
- if (!(entry = e.nextElement()).isDirectory()) {
+ entry = e.nextElement();
+ if (!entry.isDirectory()) {
String toPath = new StringBuffer(
deCompressPath).append(entry.getName()).toString();
toPath = toPath.replace("\\", File.separator);
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java
index 67f58fe..1d757a3 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Zip.java
@@ -92,15 +92,21 @@ public class Zip {
}
protected void compressFile(String absolutePath) throws IOException {
- compressFileCount++;
- byte byteBuf[] = new byte[2048];
- zipOutput.putNextEntry(new ZipEntry(absolutePath.substring(relativeAddrIdx)));
-
- FileInputStream input = new FileInputStream(absolutePath);
- for (int count = 0; (count = input.read(byteBuf, 0, byteBuf.length)) != -1; )
- zipOutput.write(byteBuf, 0, count);
- input.close();
- zipOutput.closeEntry();
+ try{
+ compressFileCount++;
+ byte byteBuf[] = new byte[2048];
+ zipOutput.putNextEntry(new ZipEntry(absolutePath.substring(relativeAddrIdx)));
+ FileInputStream input = new FileInputStream(absolutePath);
+ try{
+ for (int count = 0; (count = input.read(byteBuf, 0, byteBuf.length)) != -1; )
+ zipOutput.write(byteBuf, 0, count);
+ }finally{
+ input.close();
+ zipOutput.closeEntry();
+ }
+ }catch(IOException e){
+ throw e;
+ }
}
public void setCompressLevel(int level) {
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 4550e87..d17ced5 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
@@ -197,7 +197,8 @@ public class ConfigurationManager extends DriverThread {
try {
Thread.sleep(60 * 1000);
} catch (InterruptedException e1) {
- e1.printStackTrace();
+ //e1.printStackTrace();
+ log.error("InterruptedException :" + StringUtil.getStackTrace(e1));
}
log.error("ReceiveSource exception", e);
}
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 aa01c99..feb6679 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
@@ -68,7 +68,7 @@ public class NorthMessageMgr extends DriverThread {
//login north
event_api_url = "http://" + event_api_url;
log.info("AgentMain.evel_initialize start event_api_url=[" + event_api_url + "]port=[" + port + "]path=[" + path + "]"
- + "topic=[" + topic + "]username=[" + username + "]password=[" + password + "]level=[" + level + "]");
+ + "topic=[" + topic + "]username=[" + username + /*"]password=[" + password +*/ "]level=[" + level + "]");
try {
EVEL_ERR_CODES evecode = AgentMain.evel_initialize(event_api_url, Integer.parseInt(port),
path, topic,
@@ -78,9 +78,9 @@ public class NorthMessageMgr extends DriverThread {
log.info("AgentMain.evel_initialize sucess EVEL_ERR_CODES=" + evecode);
} catch (Exception e) {
log.error("AgentMain.evel_initialize fail ", e);
- } catch (Error e1) {
+ }/* catch (Error e1) {
log.error("AgentMain.evel_initialize Error ", e1);
- }
+ }*/
} catch (Exception e2) {
log.error("NorthMessageMgr start fail ", e2);
}
@@ -126,7 +126,8 @@ public class NorthMessageMgr extends DriverThread {
try {
Thread.sleep(60 * 1000);
} catch (Exception e) {
- e.printStackTrace();
+ // e.printStackTrace();
+ log.error("Unable to sleep the HB thread ", e);
}
} catch (Exception e) {
log.error("HeatBeatTread exception", e);
@@ -224,7 +225,8 @@ public class NorthMessageMgr extends DriverThread {
eventTimeD = format.parse(eventTime);
} catch (ParseException e) {
// TODO Auto-generated catch block
- e.printStackTrace();
+ //e.printStackTrace();
+ log.error("ParseException ", e);
}
flt.evel_start_epoch_set(eventTimeD.getTime());
flt.evel_last_epoch_set(eventTimeD.getTime());
@@ -314,9 +316,9 @@ public class NorthMessageMgr extends DriverThread {
} catch (Exception e) {
log.error("CollectMessageRecv exception", e);
- } catch (Error e) {
+ } /*catch (Error e) {
log.error("CollectMessageRecv Error", e);
- }
+ }*/
}
}
diff --git a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThreadTest.java b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThreadTest.java
index c836cf6..a120021 100644
--- a/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThreadTest.java
+++ b/ems/boco/src/test/java/org/onap/vfc/nfvo/emsdriver/collector/CollectMsgReceiverThreadTest.java
@@ -46,8 +46,8 @@ public class CollectMsgReceiverThreadTest {
col.setRun(true);
col.dispose();
col.getTaskService().stopTask();
- col.getThread_max_num();
- col.setThread_max_num(1);
+ col.getThreadMaxNum();
+ col.setThreadMaxNum(1);
}
@@ -67,8 +67,8 @@ public class CollectMsgReceiverThreadTest {
col.setRun(true);
col.dispose();
col.getTaskService().stopTask();
- col.getThread_max_num();
- col.setThread_max_num(1);
+ col.getThreadMaxNum();
+ col.setThreadMaxNum(1);
}
}