FileFtpColl.java
1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.sitech.ismp.coll.busi;
import java.util.HashMap;
import java.util.Vector;
import org.apache.log4j.Logger;
import com.sitech.ismp.coll.basic.TblATO_KPIDETAIL;
import com.sitech.util.DES3;
import com.sitech.util.ThreadPoolUtil;
/**
* FTP采集配置文件(GX)
* 本地目录命名规则: ${coll.local.path} + "/" + ip.replace(".","_")/
* 例:/bnmsapp2/172_21_1_100/
*
* 1. FTP配置文件到本地目录,文件命名规则为:CFG_$GUID.txt
* 2. 创建对应的描述文件到本地目录,文件命名规则为:CFG_$GUID.info
*
*******Begin CFG_986C5F24.info***************************************
* TYPE=FTP
* IP_ADDR=172.21.1.100
* DIRECTORY=/bnmsapp2
* FILE_NAME=AppCenterProxy_error_check.sh
* PERSSIONS=-rw-r--r--
* SIZE=1279
* UPDATE_TIME=2012-10-17 10:02:38
* USER=bnmsapp2
* COLL_TIME=2012-11-21 13:18:55
*******End CFG_986C5F24.info*****************************************
*
* @author linxc
*/
public class FileFtpColl implements FileFtpCollMBean {
private Logger logger = Logger.getLogger(FileFtpColl.class);
/**
* @param params HashMap KEY:[IP_ADDR, USERNAME, PASSWORD, FILE_$GUID]
* @return
*/
public Vector<TblATO_KPIDETAIL> collFile(HashMap<String, String> params) {
try {
ThreadPoolUtil.executorService.execute(new FileFtpCollThread(params));
} catch (Exception e) {
logger.error("Exception while do FileFtpColl.collFile() ", e);
return new Vector<TblATO_KPIDETAIL>();
}
return new Vector<TblATO_KPIDETAIL>();
}
public static void main(String[] args) {
HashMap<String,String> params = new HashMap<String, String>();
params.put("IP_ADDR", "172.21.1.69");
params.put("USERNAME", "yfbnms");
params.put("PASSWORD", DES3.encrypt("yfbnms"));
Thread thread = new Thread(new FileFtpCollThread(params));
thread.start();
}
}