7e1846e4a19a45753c02a3e998ecaa096072077a.svn-base
3.5 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package com.espeed.yxy.tool;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.util.Properties;
/**
* 程序名称: EspeedMail_时速邮箱
* 程序版本: V1.0
* 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776)
* 版权所有: 深圳市科飞时速网络技术有限公司
* 技术支持: Tech@21gmail.com
* 单元名称: 配置文件读取工具类(营销游)
* 开始时间: 2013.12.09
* 程 序 员: 谢勇
* 最后修改:
* 备 注: 如需修改请通知程序员
*/
public class ConfigPath {
static Properties p = loadPropertyFile("config.properties");
public static String getFilePth(){
return p.get("cfgFilePath")+"";
}
public static String getXmlFilePth(){
return p.get("xmlFilePath")+"";
}
/**读取配置的最大线程量*/
public static int getThreadNum(){
return Integer.parseInt(p.get("threadNum")+"");
}
/**获取点读服务路径*/
public static String getClickService(){
return p.get("clickserviceurl")+"";
}
/**获取点读服务路径(业务修改后)*/
public static String getClickService2()
{
return p.get("clickserviceurl2")+"";
}
/**获取营销服务器路径(易外销)*/
public static String getYxyServicePath(){
return p.get("yxywebmailpath")+"";
}
/**获取营销服务器路径(单独)*/
public static String getYxyServicePath2(){
return p.get("yxywebmailpath2")+"";
}
/**获取一个smtp发送邮件数量*/
public static int getSmtpSendNum(){
return Integer.parseInt(p.get("smtpsendnum").toString());
}
/**webmail定时器URL*/
public static String getWebMailTimeUrl(){
return p.get("webmailtimeurl")+"";
}
/**webmail接口URL*/
public static String getWebmailInterfaceUrl(){
return p.get("webmailinterfaceurl")+"";
}
/**地址发送异常数量*/
public static int getSendExpNum(){
return Integer.parseInt(p.get("sendexpnum").toString());
}
/**获取超链接跟踪url*/
public static String getTrackUrl(){
return p.getProperty("trackurl");
}
/**加载配置文件*/
public static Properties loadPropertyFile(String fullFile) {
String webRootPath = null;
if ( fullFile.equals(""))
throw new IllegalArgumentException("Properties file path can not be null : " + fullFile);
try {
webRootPath = ConfigPath.class.getClassLoader().getResource("").toURI().getPath();
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
webRootPath = new File(webRootPath).getParent();
InputStream inputStream = null;
Properties p = null;
try {
inputStream = new FileInputStream(new File(webRootPath+ File.separator + fullFile));
p = new Properties();
p.load(inputStream);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("Properties file not found: "
+ fullFile);
} catch (IOException e) {
throw new IllegalArgumentException(
"Properties file can not be loading: " + fullFile);
} finally {
try {
if (inputStream != null)
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return p;
}
}