package org.example.opc.conf; import org.openscada.opc.lib.common.ConnectionInformation; public final class OPCConfiguration { private final static ConnectionInformation ci; private static String HOST = "172.20.1.10"; //private static String HOST = "192.168.1.100"; private static String USER = "OPCServer"; private static String PASSWORD = "admin@123"; private static String CLSID= "7BC0CC8E-482C-47CA-ABDC-0FE7F9C6E729"; private static String PROGID = ""; /*public final static String CONFIG_USERNAME = "username"; public final static String CONFIG_PASSWORD = "password"; public final static String CONFIG_HOST = "host"; public final static String CONFIG_DOMAIN = "domain"; public final static String CONFIG_CLSID = "clsid"; public final static String CONFIG_PROGID = "progid"; private final static String CONFIG_FILE_NAME = "opc.properties";*/ /** * 加载配置文件 */ static { ci = new ConnectionInformation(); /*prop = new Properties(); try { prop.load(OPCConfiguration.class.getClassLoader().getResourceAsStream(CONFIG_FILE_NAME)); } catch (IOException e) { e.printStackTrace(); }*/ } /** * 通过名字获得配置的值 */ /*public static String getEntryValue(String name) { return prop.getProperty(name); }*/ /** * 获得包含ClsId的连接信息 */ public static ConnectionInformation getCLSIDConnectionInfomation() { ci.setProgId(null); getConnectionInfomation(); ci.setClsid(CLSID); return ci; } /** * 获得包含ProgId的连接信息 */ public static ConnectionInformation getPROGIDConnectionInfomation() { ci.setClsid(null); getConnectionInfomation(); ci.setProgId(PROGID); return ci; } /** * 获得基础的连接信息 */ private static void getConnectionInfomation() { ci.setHost(HOST); ci.setDomain(""); ci.setUser(USER); ci.setPassword(PASSWORD); } }