提交 | 用户 | 时间
|
71e81e
|
1 |
package cn.stylefeng.guns.plcserver.opc.conf; |
懒 |
2 |
|
|
3 |
import org.openscada.opc.lib.common.ConnectionInformation; |
|
4 |
|
|
5 |
public final class OPCConfiguration { |
|
6 |
|
|
7 |
private final static ConnectionInformation ci; |
|
8 |
private static String HOST = "172.20.1.10"; |
|
9 |
//private static String HOST = "192.168.1.100"; |
|
10 |
private static String USER = "OPCServer"; |
|
11 |
private static String PASSWORD = "admin@123"; |
|
12 |
private static String CLSID= "7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729"; |
|
13 |
private static String PROGID = ""; |
|
14 |
|
|
15 |
/*public final static String CONFIG_USERNAME = "username"; |
|
16 |
public final static String CONFIG_PASSWORD = "password"; |
|
17 |
public final static String CONFIG_HOST = "host"; |
|
18 |
public final static String CONFIG_DOMAIN = "domain"; |
|
19 |
public final static String CONFIG_CLSID = "clsid"; |
|
20 |
public final static String CONFIG_PROGID = "progid"; |
|
21 |
private final static String CONFIG_FILE_NAME = "opc.properties";*/ |
|
22 |
/** |
|
23 |
* 加载配置文件 |
|
24 |
*/ |
|
25 |
static { |
|
26 |
ci = new ConnectionInformation(); |
|
27 |
/*prop = new Properties(); |
|
28 |
try { |
|
29 |
prop.load(OPCConfiguration.class.getClassLoader().getResourceAsStream(CONFIG_FILE_NAME)); |
|
30 |
} catch (IOException e) { |
|
31 |
e.printStackTrace(); |
|
32 |
}*/ |
|
33 |
} |
|
34 |
/** |
|
35 |
* 通过名字获得配置的值 |
|
36 |
*/ |
|
37 |
/*public static String getEntryValue(String name) { |
|
38 |
return prop.getProperty(name); |
|
39 |
}*/ |
|
40 |
/** |
|
41 |
* 获得包含ClsId的连接信息 |
|
42 |
*/ |
|
43 |
public static ConnectionInformation getCLSIDConnectionInfomation() { |
|
44 |
ci.setProgId(null); |
|
45 |
getConnectionInfomation(); |
|
46 |
ci.setClsid(CLSID); |
|
47 |
return ci; |
|
48 |
} |
|
49 |
/** |
|
50 |
* 获得包含ProgId的连接信息 |
|
51 |
*/ |
|
52 |
public static ConnectionInformation getPROGIDConnectionInfomation() { |
|
53 |
ci.setClsid(null); |
|
54 |
getConnectionInfomation(); |
|
55 |
ci.setProgId(PROGID); |
|
56 |
return ci; |
|
57 |
} |
|
58 |
/** |
|
59 |
* 获得基础的连接信息 |
|
60 |
*/ |
|
61 |
private static void getConnectionInfomation() { |
|
62 |
ci.setHost(HOST); |
|
63 |
ci.setDomain(""); |
|
64 |
ci.setUser(USER); |
|
65 |
ci.setPassword(PASSWORD); |
|
66 |
} |
|
67 |
} |