| | |
| | | package com.config;
|
| | |
|
| | | import java.io.File;
|
| | |
|
| | | import java.io.FileWriter;
|
| | | import java.io.IOException;
|
| | | import java.io.UnsupportedEncodingException;
|
| | |
| | | import org.dom4j.io.XMLWriter;
|
| | |
|
| | | /**
|
| | | * 创建config.xml文件并更新 config.xml 文件中的属性值
|
| | | * |
| | | * @author 军
|
| | | *
|
| | | */
|
| | | public class AppConfig {
|
| | |
|
| | | public static final int SOURCE_BATTDATA_TYPE_FBSDEV = 0;
|
| | | public static final int SOURCE_BATTDATA_TYPE_SQLSERVER = 1;
|
| | | public static final int SOURCE_BATTDATA_TYPE_C_INTERFACE = 2;
|
| | | public static final int SOURCE_BATTDATA_TYPE_SQLSERVER_AND_C_INTERFACE = 3;
|
| | | |
| | | private final String ConfigFileName = "config.xml";
|
| | |
|
| | | private boolean mysqlDB_RecreateEn = false;
|
| | | private String mysqlServerIp = "127.0.0.1";
|
| | | private int sqlServerType = 1; //连接数据库类型 1-MySQL 2-瀚高
|
| | | private String sqlServerIp = "127.0.0.1"; //数据库IP地址
|
| | | private int sqlServerPort = 5866; //数据库端口号
|
| | | private int sqlConnCountMax = 200; //数据库连接池数量
|
| | | private int workThreadCountMax = 300; //
|
| | | private boolean battTestStateReloadEn = true; //电池测试数据重载-若程序重启前正在测试,后续是否接着记录历史数据,默认连续
|
| | |
|
| | | private int sourceBattDataType = 0;
|
| | | private int powerAcceptPort = 9000; //电源通信端口
|
| | | |
| | | //----------------------------------------------------------------//
|
| | | private int sourceSQLServerType = 0;
|
| | | private String sourceSQLServerIp = "127.0.0.1";
|
| | | private String sourceSQLServerUsrName = "sxfg001";
|
| | | private String sourceSQLServerPWD = "sxfg001";
|
| | | private int sourceSQLServerPort = 5000;
|
| | | |
| | | private String cInterfaceServerIp = "127.0.0.1";
|
| | | private String cInterfaceUsrName = "cdnt";
|
| | | private String cInterfacePWD = "cdnt";
|
| | | private int cInterfaceSocketPort = 7009;
|
| | | |
| | | private String fbsDeviceBaseIp = "192.168.0.1";
|
| | | private int discharge_SaveDataTimeInterval = 10; //放电测试数据存储间隔 |
| | | private float discharge_MonVolChangeLevel = 0.05F; //放电单体电压变化阈值(单体电压变化差值>0.05F即记录一笔测试数据)
|
| | | private int discharge_TestTimeLongMinimum = 30; //记录放电测试的最短时间
|
| | | private int discharge_TestDataRecordCountMax = 15000; //放电测试最大笔数
|
| | | private int discharge_BattTestGroupCountMax = 100; //同时记录测试的电池组数量
|
| | | //----------------------------------------------------------------//
|
| | | //----------------------------------------------------------------//
|
| | | private boolean sybSrvCurrChargeDirPos = false;
|
| | | public int charge_SaveDataTimeInterval = 10; //充电测试数据存储间隔 |
| | | public float charge_MonVolChangeLevel = 0.05F; //充电单体电压变化阈值(单体电压变化差值>0.05F即记录一笔测试数据)
|
| | | public int charge_TestTimeLongMinimum = 30; //记录充电测试的最短时间
|
| | | public int charge_TestDataRecordCountMax = 15000; //充电测试最大笔数
|
| | | public int charge_BattTestGroupCountMax = 100; //同时记录测试的电池组数量
|
| | | //----------------------------------------------------------------//
|
| | |
|
| | | private int mysqlConnCountMax = 300;
|
| | | private int workThreadCountMax = 300;
|
| | | |
| | | private boolean battAlarmFnEn = false;
|
| | | private int battAlarmFnStartDelay = 60;
|
| | | private int battAlarmClearedDelay = 600;
|
| | | private int battAlarmDataDayCountMax = 400;
|
| | | |
| | | private boolean battResStoreFnEn = false;
|
| | | private int battResStoreDelayForTestManual = 1200;
|
| | | private int battResStoreDayInterval = 7;
|
| | | |
| | | private boolean battAutoStoreFnEn = false;
|
| | | private int battAutoStoreDelayForStartUp = 60;
|
| | | private int battAutoStoreMinuteInterval = 10;
|
| | | private int battAutoStoreDayCountMax = 7;
|
| | | |
| | | private boolean userTaskFnEn = true;
|
| | | private boolean userTaskSmsFnEn = false;
|
| | | private String userTaskSmsDevIp = "192.168.1.60";
|
| | | |
| | | private boolean idce8200ServerFnEn = false;
|
| | | private boolean mobileServerFnEn = true;
|
| | | private boolean ftpServerFnEn = true;
|
| | | |
| | | private int autoSqlDbBackUpDayInterval = 30;
|
| | | private boolean bpm7100CommErrDataClearEN = true;
|
| | | private int fbsDevCommRate = 1;
|
| | | |
| | | private boolean DevBTS_SeverComm_En = true;
|
| | | private boolean DevFBS9100_SeverComm_En = true;
|
| | | private boolean DevFBS9100_ClientComm_En = true;
|
| | | private boolean RealDataRecord_fn_En = false; //历史实时数据记录使能
|
| | | private int RealDataRecord_MinTimeLong = 60; //实时数据最短记录间隔(秒)
|
| | | private int RealDataRecord_MaxSaveTime = 90; //实时数据最短保留天数
|
| | |
|
| | | public AppConfig()
|
| | | { /*
|
| | | {
|
| | | /*
|
| | | String path = System.getProperty("user.dir");
|
| | | if(path.contains("\\"))
|
| | | path += "\\";
|
| | |
| | |
|
| | | readConfigFromXml();
|
| | | }
|
| | | |
| | | public boolean getMysqlDB_RecreateEn()
|
| | | {
|
| | | return mysqlDB_RecreateEn;
|
| | | }
|
| | | public void setMysqlDB_RecreateEn(boolean en)
|
| | | {
|
| | | mysqlDB_RecreateEn = en;
|
| | |
|
| | | public void copyAppParam(AppConfig config) {
|
| | | this.sqlServerIp = config.sqlServerIp; //数据库IP地址
|
| | | this.sqlServerPort = config.sqlServerPort; //数据库端口号
|
| | | this.sqlConnCountMax = config.sqlConnCountMax; //数据库连接池数量
|
| | | this.workThreadCountMax = config.workThreadCountMax; //
|
| | | |
| | | //----------------------------------------------------------------//
|
| | | this.discharge_SaveDataTimeInterval = config.discharge_SaveDataTimeInterval; //放电测试数据存储间隔 |
| | | this.discharge_MonVolChangeLevel = config.discharge_MonVolChangeLevel; //放电单体电压变化阈值(单体电压变化差值>0.05F即记录一笔测试数据)
|
| | | this.discharge_TestTimeLongMinimum = config.discharge_TestTimeLongMinimum; //记录放电测试的最短时间
|
| | | this.discharge_TestDataRecordCountMax = config.discharge_TestDataRecordCountMax; //放电测试最大笔数
|
| | | this.discharge_BattTestGroupCountMax = config.discharge_BattTestGroupCountMax; //同时记录测试的电池组数量
|
| | | //----------------------------------------------------------------//
|
| | | //----------------------------------------------------------------//
|
| | | this.charge_SaveDataTimeInterval = config.charge_SaveDataTimeInterval; //充电测试数据存储间隔 |
| | | this.charge_MonVolChangeLevel = config.charge_MonVolChangeLevel; //充电单体电压变化阈值(单体电压变化差值>0.05F即记录一笔测试数据)
|
| | | this.charge_TestTimeLongMinimum = config.charge_TestTimeLongMinimum; //记录充电测试的最短时间
|
| | | this.charge_TestDataRecordCountMax = config.charge_TestDataRecordCountMax; //充电测试最大笔数
|
| | | this.charge_BattTestGroupCountMax = config.charge_BattTestGroupCountMax; //同时记录测试的电池组数量
|
| | | //----------------------------------------------------------------//
|
| | | |
| | | this.RealDataRecord_fn_En = config.RealDataRecord_fn_En; //历史实时数据记录使能
|
| | | this.RealDataRecord_MinTimeLong = config.RealDataRecord_MinTimeLong; //实时数据最短记录间隔(秒)
|
| | | this.RealDataRecord_MaxSaveTime = config.RealDataRecord_MaxSaveTime; //实时数据最短保留天数
|
| | | }
|
| | |
|
| | | public String getMysqlServerIp()
|
| | | {
|
| | | return mysqlServerIp;
|
| | | }
|
| | |
|
| | | public String getSourceSQLServerIp()
|
| | | {
|
| | | return sourceSQLServerIp;
|
| | | public boolean isRealDataRecord_fn_En() {
|
| | | return RealDataRecord_fn_En;
|
| | | }
|
| | | public String getSourceSQLServerUsrName()
|
| | | {
|
| | | return sourceSQLServerUsrName;
|
| | |
|
| | | public int getRealDataRecord_MinTimeLong() {
|
| | | return RealDataRecord_MinTimeLong;
|
| | | }
|
| | | public String getSourceSQLServerPWD()
|
| | | {
|
| | | return sourceSQLServerPWD;
|
| | |
|
| | | public int getRealDataRecord_MaxSaveTime() {
|
| | | return RealDataRecord_MaxSaveTime;
|
| | | }
|
| | | public int getSourceSQLServerPort()
|
| | | {
|
| | | return sourceSQLServerPort;
|
| | |
|
| | | public void setRealDataRecord_fn_En(boolean realDataRecord_fn_En) {
|
| | | RealDataRecord_fn_En = realDataRecord_fn_En;
|
| | | }
|
| | | |
| | | public String getCInterfaceServerIp()
|
| | | {
|
| | | return cInterfaceServerIp;
|
| | |
|
| | | public void setRealDataRecord_MinTimeLong(int realDataRecord_MinTimeLong) {
|
| | | RealDataRecord_MinTimeLong = realDataRecord_MinTimeLong;
|
| | | }
|
| | | public String getCInterfaceUsrName()
|
| | | {
|
| | | return cInterfaceUsrName;
|
| | |
|
| | | public void setRealDataRecord_MaxSaveTime(int realDataRecord_MaxSaveTime) {
|
| | | RealDataRecord_MaxSaveTime = realDataRecord_MaxSaveTime;
|
| | | }
|
| | | public String getCInterfacePWD()
|
| | | {
|
| | | return cInterfacePWD;
|
| | | }
|
| | | public int getCInterfacePort()
|
| | | {
|
| | | return cInterfaceSocketPort;
|
| | | }
|
| | | |
| | | public String getFbsDeviceBaseIp()
|
| | | {
|
| | | return fbsDeviceBaseIp;
|
| | | }
|
| | | public int getSourceSQLServerType()
|
| | | {
|
| | | return sourceSQLServerType;
|
| | | }
|
| | | public int getSourceBattDataType()
|
| | | {
|
| | | return sourceBattDataType;
|
| | | }
|
| | | |
| | | public boolean getSybSrvCurrChargeDirPos()
|
| | | {
|
| | | return sybSrvCurrChargeDirPos;
|
| | | }
|
| | | |
| | | public int getMysqlConnCountMax()
|
| | | {
|
| | | return mysqlConnCountMax;
|
| | | }
|
| | | public int getWorkThreadCountMax()
|
| | | {
|
| | |
|
| | | public int getWorkThreadCountMax() {
|
| | | return workThreadCountMax;
|
| | | }
|
| | | |
| | | public boolean getBattAlarmFnEn()
|
| | | {
|
| | | return battAlarmFnEn;
|
| | |
|
| | | public int getSaveDataTimeInterval(int type) {
|
| | | int val = 0;
|
| | | switch (type) {
|
| | | case 0:
|
| | | val = this.discharge_SaveDataTimeInterval;
|
| | | break;
|
| | | case 1:
|
| | | val = this.charge_SaveDataTimeInterval;
|
| | | break;
|
| | | }
|
| | |
|
| | | return val;
|
| | | }
|
| | |
|
| | | public float getMonVolChangeLevel(int type) {
|
| | | float val = 0.0F;
|
| | | switch (type) {
|
| | | case 0:
|
| | | val = this.discharge_MonVolChangeLevel;
|
| | | break;
|
| | | case 1:
|
| | | val = this.charge_MonVolChangeLevel;
|
| | | break;
|
| | | }
|
| | |
|
| | | return val;
|
| | | }
|
| | |
|
| | | public int getTestTimeLongMinimum(int type) {
|
| | | int val = 0;
|
| | | switch (type) {
|
| | | case 0:
|
| | | val = this.discharge_TestTimeLongMinimum;
|
| | | break;
|
| | | case 1:
|
| | | val = this.charge_TestTimeLongMinimum;
|
| | | break;
|
| | | }
|
| | |
|
| | | return val;
|
| | | }
|
| | |
|
| | | public int getTestDataRecordCountMax(int type) {
|
| | | int val = 0;
|
| | | switch (type) {
|
| | | case 0:
|
| | | val = this.discharge_TestDataRecordCountMax;
|
| | | break;
|
| | | case 1:
|
| | | val = this.charge_TestDataRecordCountMax;
|
| | | break;
|
| | | }
|
| | |
|
| | | return val;
|
| | | }
|
| | |
|
| | | public int getBattTestGroupCountMax(int type) {
|
| | | int val = 0;
|
| | | switch (type) {
|
| | | case 0:
|
| | | val = this.discharge_BattTestGroupCountMax;
|
| | | break;
|
| | | case 1:
|
| | | val = this.charge_BattTestGroupCountMax;
|
| | | break;
|
| | | }
|
| | |
|
| | | return val;
|
| | | }
|
| | |
|
| | | public int getBattAlarmFnStartDelay()
|
| | | {
|
| | | return battAlarmFnStartDelay;
|
| | | }
|
| | | |
| | | public int getBattAlarmClearedDelay()
|
| | | {
|
| | | return battAlarmClearedDelay;
|
| | | }
|
| | | |
| | | public int getBattAlarmDataDayCountMax()
|
| | | {
|
| | | return battAlarmDataDayCountMax;
|
| | | }
|
| | | |
| | | public boolean getBattResStoreFnEn()
|
| | | {
|
| | | return battResStoreFnEn;
|
| | | }
|
| | | public int getBattResStoreDelayForTestManual()
|
| | | {
|
| | | return battResStoreDelayForTestManual;
|
| | | }
|
| | | public int getBattResStoreDayInterval()
|
| | | {
|
| | | return battResStoreDayInterval;
|
| | | }
|
| | | |
| | | public boolean getBattAutoStoreFnEn()
|
| | | {
|
| | | return battAutoStoreFnEn;
|
| | | }
|
| | | public int getBattAutoStoreDelayForStartUp()
|
| | | {
|
| | | return battAutoStoreDelayForStartUp;
|
| | | }
|
| | | public int getBattAutoStoreMinuteInterval()
|
| | | {
|
| | | return battAutoStoreMinuteInterval;
|
| | | }
|
| | | public int getBattAutoStoreDayCountMax()
|
| | | {
|
| | | return battAutoStoreDayCountMax;
|
| | | }
|
| | | |
| | | public boolean getUserTaskFnEn()
|
| | | {
|
| | | return userTaskFnEn;
|
| | | }
|
| | | public boolean getUserTaskSmsFnEn()
|
| | | {
|
| | | return userTaskSmsFnEn;
|
| | | }
|
| | | public String getUserTaskSmsDevIp()
|
| | | {
|
| | | return userTaskSmsDevIp;
|
| | | }
|
| | | |
| | | public boolean getIdce8200ServerFnEn()
|
| | | {
|
| | | return idce8200ServerFnEn;
|
| | | }
|
| | | public boolean getMobileServerFnEn()
|
| | | {
|
| | | return mobileServerFnEn;
|
| | | }
|
| | | public boolean getFtpServerFnEn()
|
| | | {
|
| | | return ftpServerFnEn;
|
| | | }
|
| | | |
| | | public int getAutoSqlDbBackUpDayInterval() {
|
| | | return autoSqlDbBackUpDayInterval;
|
| | | }
|
| | | |
| | | public boolean getBpm7100CommErrDataClearEN() {
|
| | | return bpm7100CommErrDataClearEN;
|
| | | }
|
| | | |
| | | public int getFbsDevCommRate() {
|
| | | return fbsDevCommRate;
|
| | | }
|
| | | |
| | | public boolean getBTS_CommEn() {
|
| | | return DevBTS_SeverComm_En;
|
| | | }
|
| | | public boolean getFbs9100_ServerCommEn() {
|
| | | return DevFBS9100_SeverComm_En;
|
| | | }
|
| | | public boolean getFbs9100_ClientCommEn() {
|
| | | return DevFBS9100_ClientComm_En;
|
| | | }
|
| | |
|
| | | public void writeConfigToXml()
|
| | | {
|
| | |
| | | Element sub_param;
|
| | |
|
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("mysql_ramdb_recreate_en"); |
| | | param.addText(String.valueOf(mysqlDB_RecreateEn));
|
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("mysql_server_ip"); |
| | | param.addText(mysqlServerIp);
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | root.addComment("SOURCE_BATTDATA_TYPE_FBSDEV = 0");
|
| | | root.addComment("SOURCE_BATTDATA_TYPE_SQLSERVER = 1");
|
| | | root.addComment("SOURCE_BATTDATA_TYPE_C_INTERFACE = 2");
|
| | | root.addComment("SOURCE_BATTDATA_TYPE_SQLSERVER_AND_C_INTERFACE = 3");
|
| | | |
| | | param = root.addElement("source_battdata_type");
|
| | | param.addText(String.valueOf(sourceBattDataType));
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("source_sqlserver_config");
|
| | | |
| | | param.addComment("SOURCE_SQLSERVER_TYPE_SYBASE_DEMO = 0");
|
| | | param.addComment("SOURCE_SQLSERVER_TYPE_SYBASE = 1");
|
| | | param.addComment("SOURCE_SQLSERVER_TYPE_MSSQLSERVER = 2");
|
| | | |
| | | sub_param = param.addElement("source_sqlserver_type"); |
| | | sub_param.addText(String.valueOf(sourceSQLServerType));
|
| | | |
| | | sub_param = param.addElement("source_sqlserver_ip"); |
| | | sub_param.addText(sourceSQLServerIp);
|
| | | |
| | | sub_param = param.addElement("source_sqlserver_usrname"); |
| | | sub_param.addText(sourceSQLServerUsrName);
|
| | | |
| | | sub_param = param.addElement("source_sqlserver_pwd"); |
| | | sub_param.addText(sourceSQLServerPWD);
|
| | | |
| | | sub_param = param.addElement("source_sqlserver_port"); |
| | | sub_param.addText(String.valueOf(sourceSQLServerPort));
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------//
|
| | | param = root.addElement("c_interface_server_config");
|
| | | |
| | | sub_param = param.addElement("c_interface_server_ip");
|
| | | sub_param.addText(cInterfaceServerIp);
|
| | | |
| | | sub_param = param.addElement("c_interface_usrname");
|
| | | sub_param.addText(cInterfaceUsrName);
|
| | | |
| | | sub_param = param.addElement("c_interface_pwd");
|
| | | sub_param.addText(cInterfacePWD);
|
| | | |
| | | sub_param = param.addElement("c_interface_sokcet_port");
|
| | | sub_param.addText(String.valueOf(cInterfaceSocketPort));
|
| | | //--------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------//
|
| | | param = root.addElement("fbs_device_base_ip"); |
| | | param.addText(fbsDeviceBaseIp);
|
| | | //--------------------------------------------------------//
|
| | | |
| | | param = root.addElement("syb_srv_curr_charge_dir_pos"); |
| | | param.addText(String.valueOf(sybSrvCurrChargeDirPos));
|
| | | |
| | | param = root.addElement("mysql_conn_count_max"); |
| | | param.addText(String.valueOf(mysqlConnCountMax));
|
| | | |
| | | param = root.addElement("work_thread_count_max"); |
| | | param = root.addElement("sql_server_type"); |
| | | param.addText(String.valueOf(sqlServerType));
|
| | | param = root.addElement("sql_server_ip"); |
| | | param.addText(sqlServerIp);
|
| | | param = root.addElement("sql_server_port"); |
| | | param.addText(String.valueOf(sqlServerPort));
|
| | | param = root.addElement("sql_conncount_max"); |
| | | param.addText(String.valueOf(sqlConnCountMax));
|
| | | param = root.addElement("workThreadCountMax"); |
| | | param.addText(String.valueOf(workThreadCountMax));
|
| | |
|
| | | //--------------------------------------------------------//
|
| | | param = root.addElement("batt_alarm_fn_config");
|
| | | param = root.addElement("battTestStateReloadEn"); |
| | | param.addText(String.valueOf(battTestStateReloadEn));
|
| | |
|
| | | sub_param = param.addElement("batt_alarm_fn_en"); |
| | | sub_param.addText(String.valueOf(battAlarmFnEn));
|
| | | |
| | | sub_param = param.addElement("batt_alarm_fn_start_delay"); |
| | | sub_param.addText(String.valueOf(battAlarmFnStartDelay));
|
| | | |
| | | sub_param = param.addElement("batt_alarm_cleared_delay"); |
| | | sub_param.addText(String.valueOf(battAlarmClearedDelay));
|
| | | |
| | | sub_param = param.addElement("batt_alarm_data_daycount_max"); |
| | | sub_param.addText(String.valueOf(battAlarmDataDayCountMax));
|
| | | |
| | | param = root.addElement("powerAcceptPort"); |
| | | param.addText(String.valueOf(powerAcceptPort));
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("discharge_test_config"); //放电测试
|
| | | |
| | | // param.addComment("SOURCE_SQLSERVER_TYPE_SYBASE_DEMO = 0"); 注释
|
| | | // param.addComment("SOURCE_SQLSERVER_TYPE_SYBASE = 1"); 注释
|
| | | // param.addComment("SOURCE_SQLSERVER_TYPE_MSSQLSERVER = 2"); 注释
|
| | | |
| | | sub_param = param.addElement("discharge_SaveDataTimeInterval"); |
| | | sub_param.addText(String.valueOf(discharge_SaveDataTimeInterval));
|
| | | |
| | | sub_param = param.addElement("discharge_MonVolChangeLevel"); |
| | | sub_param.addText(String.valueOf(discharge_MonVolChangeLevel));
|
| | | |
| | | sub_param = param.addElement("discharge_TestTimeLongMinimum"); |
| | | sub_param.addText(String.valueOf(discharge_TestTimeLongMinimum));
|
| | | |
| | | sub_param = param.addElement("discharge_TestDataRecordCountMax"); |
| | | sub_param.addText(String.valueOf(discharge_TestDataRecordCountMax));
|
| | | |
| | | sub_param = param.addElement("discharge_BattTestGroupCountMax"); |
| | | sub_param.addText(String.valueOf(discharge_BattTestGroupCountMax));
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------//
|
| | | param = root.addElement("chrcharge_test_config");
|
| | | |
| | | sub_param = param.addElement("charge_SaveDataTimeInterval");
|
| | | sub_param.addText(String.valueOf(charge_SaveDataTimeInterval));
|
| | | |
| | | sub_param = param.addElement("charge_MonVolChangeLevel");
|
| | | sub_param.addText(String.valueOf(charge_MonVolChangeLevel));
|
| | | |
| | | sub_param = param.addElement("charge_TestTimeLongMinimum");
|
| | | sub_param.addText(String.valueOf(charge_TestTimeLongMinimum));
|
| | | |
| | | sub_param = param.addElement("charge_TestDataRecordCountMax");
|
| | | sub_param.addText(String.valueOf(charge_TestDataRecordCountMax));
|
| | | |
| | | sub_param = param.addElement("charge_BattTestGroupCountMax");
|
| | | sub_param.addText(String.valueOf(charge_BattTestGroupCountMax));
|
| | | //--------------------------------------------------------//
|
| | |
|
| | | //--------------------------------------------------------//
|
| | | param = root.addElement("batt_res_store_fn_config");
|
| | | |
| | | sub_param = param.addElement("batt_res_store_fn_en"); |
| | | sub_param.addText(String.valueOf(battResStoreFnEn));
|
| | | |
| | | sub_param = param.addElement("batt_res_store_delay_for_test_manual"); |
| | | sub_param.addText(String.valueOf(battResStoreDelayForTestManual));
|
| | | |
| | | sub_param = param.addElement("batt_res_store_day_interval"); |
| | | sub_param.addText(String.valueOf(battResStoreDayInterval));
|
| | | //-------------------------------------------------------//
|
| | | //--------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------//
|
| | | param = root.addElement("batt_auto_store_fn_config");
|
| | | |
| | | sub_param = param.addElement("batt_auto_store_fn_en"); |
| | | sub_param.addText(String.valueOf(battAutoStoreFnEn));
|
| | | param = root.addElement("realdatarecord_fn_cofig"); |
| | | sub_param = param.addElement("realdatarecord_fn_en");
|
| | | sub_param.addText(String.valueOf(RealDataRecord_fn_En));
|
| | |
|
| | | sub_param = param.addElement("batt_auto_store_delay_for_start_up"); |
| | | sub_param.addText(String.valueOf(battAutoStoreDelayForStartUp));
|
| | | sub_param = param.addElement("realdatarecord_mintimelong");
|
| | | sub_param.addText(String.valueOf(RealDataRecord_MinTimeLong));
|
| | |
|
| | | sub_param = param.addElement("batt_auto_store_minute_interval"); |
| | | sub_param.addText(String.valueOf(battAutoStoreMinuteInterval));
|
| | | |
| | | sub_param = param.addElement("batt_auto_store_day_count_max"); |
| | | sub_param.addText(String.valueOf(battAutoStoreDayCountMax));
|
| | | //--------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------//
|
| | | param = root.addElement("user_task_fn_config");
|
| | | |
| | | sub_param = param.addElement("user_task_fn_en"); |
| | | sub_param.addText(String.valueOf(userTaskFnEn));
|
| | | |
| | | sub_param = param.addElement("user_task_sms_fn_en"); |
| | | sub_param.addText(String.valueOf(userTaskSmsFnEn));
|
| | | |
| | | sub_param = param.addElement("user_task_sms_dev_ip"); |
| | | sub_param.addText(userTaskSmsDevIp);
|
| | | //--------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------//
|
| | | param = root.addElement("idce8200_server_fn_config");
|
| | | param.addText(String.valueOf(idce8200ServerFnEn));
|
| | | |
| | | param = root.addElement("mobile_server_fn_config");
|
| | | param.addText(String.valueOf(mobileServerFnEn));
|
| | | |
| | | param = root.addElement("ftp_server_fn_config");
|
| | | param.addText(String.valueOf(ftpServerFnEn));
|
| | | //--------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("auto_sqldb_backup_dayinterval"); |
| | | param.addText(String.valueOf(autoSqlDbBackUpDayInterval));
|
| | | //-------------------------------------------------------//
|
| | | sub_param = param.addElement("realdatarecord_maxsavetime");
|
| | | sub_param.addText(String.valueOf(RealDataRecord_MaxSaveTime));
|
| | |
|
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("bpm7100_commerr_dataclear_en"); |
| | | param.addText(String.valueOf(bpm7100CommErrDataClearEN));
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("fbsdev_comm_rate"); |
| | | param.addText(String.valueOf(fbsDevCommRate));
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("dev_bts_severcomm_en"); |
| | | param.addText(String.valueOf(DevBTS_SeverComm_En));
|
| | | //-------------------------------------------------------//
|
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("devfbs9100_severcomm_en"); |
| | | param.addText(String.valueOf(DevFBS9100_SeverComm_En));
|
| | | //-------------------------------------------------------//
|
| | | //-------------------------------------------------------//
|
| | | param = root.addElement("devfbs9100_clientcomm_en"); |
| | | param.addText(String.valueOf(DevFBS9100_ClientComm_En));
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------// |
| | | OutputFormat format = OutputFormat.createPrettyPrint();
|
| | | format.setEncoding("gbk");
|
| | | XMLWriter writer2 = new XMLWriter(new FileWriter(ConfigFileName), format);
|
| | |
| | | Element sub_node;
|
| | |
|
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("mysql_ramdb_recreate_en"); |
| | | mysqlDB_RecreateEn = Boolean.parseBoolean(node.getTextTrim());
|
| | | node = rootnode.element("sql_server_type"); |
| | | sqlServerType = Integer.parseInt(node.getTextTrim());
|
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("mysql_server_ip"); |
| | | mysqlServerIp = node.getTextTrim();
|
| | | node = rootnode.element("sql_server_ip"); |
| | | sqlServerIp = node.getTextTrim();
|
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("source_battdata_type"); |
| | | sourceBattDataType = Integer.parseInt(node.getTextTrim());
|
| | | if(sourceBattDataType < 0)
|
| | | sourceBattDataType = 0;
|
| | | if(sourceBattDataType > 3)
|
| | | sourceBattDataType = 3;
|
| | | |
| | | node = rootnode.element("sql_server_port"); |
| | | sqlServerPort = Integer.parseInt(node.getTextTrim());
|
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("source_sqlserver_config");
|
| | | node = rootnode.element("sql_conncount_max"); |
| | | sqlConnCountMax = Integer.parseInt(node.getTextTrim());
|
| | |
|
| | | sub_node = node.element("source_sqlserver_type"); |
| | | sourceSQLServerType = Integer.parseInt(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("source_sqlserver_ip"); |
| | | sourceSQLServerIp = sub_node.getTextTrim();
|
| | | |
| | | sub_node = node.element("source_sqlserver_usrname"); |
| | | sourceSQLServerUsrName = sub_node.getTextTrim();
|
| | | |
| | | sub_node = node.element("source_sqlserver_pwd"); |
| | | sourceSQLServerPWD = sub_node.getTextTrim();
|
| | | |
| | | sub_node = node.element("source_sqlserver_port");
|
| | | sourceSQLServerPort = Integer.parseInt(sub_node.getTextTrim());
|
| | | if(sqlConnCountMax < 10)
|
| | | sqlConnCountMax = 10;
|
| | | if(sqlConnCountMax > 1000)
|
| | | sqlConnCountMax = 800;
|
| | | //------------------------------------------------------------//
|
| | | |
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("c_interface_server_config");
|
| | | |
| | | sub_node = node.element("c_interface_server_ip");
|
| | | cInterfaceServerIp = sub_node.getTextTrim();
|
| | | |
| | | sub_node = node.element("c_interface_usrname");
|
| | | cInterfaceUsrName = sub_node.getTextTrim();
|
| | | |
| | | sub_node = node.element("c_interface_pwd");
|
| | | cInterfacePWD = sub_node.getTextTrim();
|
| | | |
| | | sub_node = node.element("c_interface_sokcet_port");
|
| | | cInterfaceSocketPort = Integer.parseInt(sub_node.getTextTrim());
|
| | | //------------------------------------------------------------//
|
| | | |
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("fbs_device_base_ip"); |
| | | fbsDeviceBaseIp = node.getTextTrim();
|
| | | //------------------------------------------------------------//
|
| | | |
| | | node = rootnode.element("syb_srv_curr_charge_dir_pos");
|
| | | sybSrvCurrChargeDirPos = Boolean.parseBoolean(node.getTextTrim());
|
| | | |
| | | node = rootnode.element("mysql_conn_count_max");
|
| | | mysqlConnCountMax = Integer.parseInt(node.getTextTrim());
|
| | | if(mysqlConnCountMax < 5)
|
| | | mysqlConnCountMax = 5;
|
| | | if(mysqlConnCountMax > 400)
|
| | | mysqlConnCountMax = 400;
|
| | | |
| | | node = rootnode.element("work_thread_count_max"); |
| | | node = rootnode.element("workThreadCountMax"); |
| | | workThreadCountMax = Integer.parseInt(node.getTextTrim());
|
| | |
|
| | | /* if(workThreadCountMax < 10)
|
| | | if(workThreadCountMax < 10)
|
| | | workThreadCountMax = 10;
|
| | | if(workThreadCountMax > 400)
|
| | | workThreadCountMax = 400;*/
|
| | | if(workThreadCountMax > 20000)
|
| | | workThreadCountMax = 20000;
|
| | | //------------------------------------------------------------// |
| | | node = rootnode.element("battTestStateReloadEn"); |
| | | battTestStateReloadEn = Boolean.parseBoolean(node.getTextTrim());
|
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("powerAcceptPort"); |
| | | powerAcceptPort = Integer.parseInt(node.getTextTrim());
|
| | |
|
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("batt_alarm_fn_config");
|
| | | |
| | | sub_node = node.element("batt_alarm_fn_en"); |
| | | battAlarmFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("batt_alarm_fn_start_delay"); |
| | | battAlarmFnStartDelay = Integer.parseInt(sub_node.getTextTrim());
|
| | | if(battAlarmFnStartDelay < 0)
|
| | | battAlarmFnStartDelay = 0;
|
| | | if(battAlarmFnStartDelay > 3600)
|
| | | battAlarmFnStartDelay = 3600;
|
| | | |
| | | sub_node = node.element("batt_alarm_cleared_delay"); |
| | | battAlarmClearedDelay = Integer.parseInt(sub_node.getTextTrim());
|
| | | if(battAlarmClearedDelay < 0)
|
| | | battAlarmClearedDelay = 0;
|
| | | if(battAlarmClearedDelay > 3600)
|
| | | battAlarmClearedDelay = 3600;
|
| | | |
| | | |
| | | sub_node = node.element("batt_alarm_data_daycount_max"); |
| | | battAlarmDataDayCountMax = Integer.parseInt(sub_node.getTextTrim());
|
| | | // if(battAlarmDataDayCountMax < 7)
|
| | | // battAlarmDataDayCountMax = 7;
|
| | | // if(battAlarmDataDayCountMax > 2048)
|
| | | // battAlarmDataDayCountMax = 2048;
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("batt_res_store_fn_config");
|
| | | |
| | | sub_node = node.element("batt_res_store_fn_en");
|
| | | battResStoreFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("batt_res_store_delay_for_test_manual");
|
| | | battResStoreDelayForTestManual = Integer.parseInt(sub_node.getTextTrim());
|
| | | if(battResStoreDelayForTestManual < 180)
|
| | | battResStoreDelayForTestManual = 180;
|
| | | if(battResStoreDelayForTestManual > 1800)
|
| | | battResStoreDelayForTestManual = 1800;
|
| | | |
| | | sub_node = node.element("batt_res_store_day_interval");
|
| | | battResStoreDayInterval = Integer.parseInt(sub_node.getTextTrim());
|
| | | if(battResStoreDayInterval < 1)
|
| | | battResStoreDayInterval = 1;
|
| | | if(battResStoreDayInterval > 360)
|
| | | battResStoreDayInterval = 360;
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("batt_auto_store_fn_config");
|
| | | |
| | | sub_node = node.element("batt_auto_store_fn_en");
|
| | | battAutoStoreFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("batt_auto_store_delay_for_start_up");
|
| | | battAutoStoreDelayForStartUp = Integer.parseInt(sub_node.getTextTrim());
|
| | | if(battAutoStoreDelayForStartUp < 180)
|
| | | battAutoStoreDelayForStartUp = 180;
|
| | | if(battAutoStoreDelayForStartUp > 3600)
|
| | | battAutoStoreDelayForStartUp = 3600;
|
| | | |
| | | sub_node = node.element("batt_auto_store_minute_interval");
|
| | | battAutoStoreMinuteInterval = Integer.parseInt(sub_node.getTextTrim());
|
| | | if(battAutoStoreMinuteInterval < 10)
|
| | | battAutoStoreMinuteInterval = 10;
|
| | | if(battAutoStoreMinuteInterval > ((60*24)*30))
|
| | | battAutoStoreMinuteInterval = ((60*24)*30);
|
| | | |
| | | sub_node = node.element("batt_auto_store_day_count_max");
|
| | | battAutoStoreDayCountMax = Integer.parseInt(sub_node.getTextTrim());
|
| | | if(battAutoStoreDayCountMax < 1)
|
| | | battAutoStoreDayCountMax = 1;
|
| | | if(battAutoStoreDayCountMax > 300)
|
| | | battAutoStoreDayCountMax = 300;
|
| | | //-------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------//
|
| | | node = rootnode.element("user_task_fn_config");
|
| | | |
| | | sub_node = node.element("user_task_fn_en");
|
| | | userTaskFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("user_task_sms_fn_en");
|
| | | userTaskSmsFnEn = Boolean.parseBoolean(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("user_task_sms_dev_ip");
|
| | | userTaskSmsDevIp = sub_node.getTextTrim();
|
| | | //--------------------------------------------------------//
|
| | | |
| | | //--------------------------------------------------------//
|
| | | node = rootnode.element("idce8200_server_fn_config");
|
| | | idce8200ServerFnEn = Boolean.parseBoolean(node.getTextTrim());
|
| | | |
| | | node = rootnode.element("mobile_server_fn_config");
|
| | | mobileServerFnEn = Boolean.parseBoolean(node.getTextTrim());
|
| | | |
| | | node = rootnode.element("ftp_server_fn_config");
|
| | | ftpServerFnEn = Boolean.parseBoolean(node.getTextTrim());
|
| | | //--------------------------------------------------------//
|
| | | |
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("auto_sqldb_backup_dayinterval"); |
| | | autoSqlDbBackUpDayInterval = Integer.parseInt(node.getTextTrim());
|
| | | if(autoSqlDbBackUpDayInterval < 7) {
|
| | | autoSqlDbBackUpDayInterval = 7;
|
| | | if(powerAcceptPort < 1000) {
|
| | | powerAcceptPort = 9000;
|
| | | }
|
| | | if(autoSqlDbBackUpDayInterval > 365) {
|
| | | autoSqlDbBackUpDayInterval = 365;
|
| | | }
|
| | | //-------------------------------------------------------//
|
| | | //------------------------------------------------------------//
|
| | |
|
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("bpm7100_commerr_dataclear_en");
|
| | | bpm7100CommErrDataClearEN = Boolean.parseBoolean(node.getTextTrim());
|
| | | //-------------------------------------------------------//
|
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("discharge_test_config");
|
| | |
|
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("fbsdev_comm_rate");
|
| | | fbsDevCommRate = Integer.parseInt(node.getTextTrim());
|
| | | //-------------------------------------------------------//
|
| | | sub_node = node.element("discharge_SaveDataTimeInterval"); |
| | | discharge_SaveDataTimeInterval = Integer.parseInt(sub_node.getTextTrim());
|
| | |
|
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("dev_bts_severcomm_en");
|
| | | DevBTS_SeverComm_En = Boolean.parseBoolean(node.getTextTrim());
|
| | | //-------------------------------------------------------//
|
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("devfbs9100_severcomm_en");
|
| | | DevFBS9100_SeverComm_En = Boolean.parseBoolean(node.getTextTrim());
|
| | | //-------------------------------------------------------//
|
| | | //-------------------------------------------------------//
|
| | | node = rootnode.element("devfbs9100_clientcomm_en");
|
| | | DevFBS9100_ClientComm_En = Boolean.parseBoolean(node.getTextTrim());
|
| | | //-------------------------------------------------------//
|
| | | sub_node = node.element("discharge_MonVolChangeLevel"); |
| | | discharge_MonVolChangeLevel = Float.parseFloat(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("discharge_TestTimeLongMinimum"); |
| | | discharge_TestTimeLongMinimum = Integer.parseInt(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("discharge_TestDataRecordCountMax"); |
| | | discharge_TestDataRecordCountMax = Integer.parseInt(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("discharge_BattTestGroupCountMax"); |
| | | discharge_BattTestGroupCountMax = Integer.parseInt(sub_node.getTextTrim());
|
| | | //------------------------------------------------------------//
|
| | | |
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("chrcharge_test_config");
|
| | | |
| | | sub_node = node.element("charge_SaveDataTimeInterval");
|
| | | charge_SaveDataTimeInterval = Integer.parseInt(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("charge_MonVolChangeLevel");
|
| | | charge_MonVolChangeLevel = Float.parseFloat(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("charge_TestTimeLongMinimum");
|
| | | charge_TestTimeLongMinimum = Integer.parseInt(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("charge_TestDataRecordCountMax");
|
| | | charge_TestDataRecordCountMax = Integer.parseInt(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("charge_BattTestGroupCountMax");
|
| | | charge_BattTestGroupCountMax = Integer.parseInt(sub_node.getTextTrim());
|
| | | //------------------------------------------------------------//
|
| | | node = rootnode.element("realdatarecord_fn_cofig");
|
| | | |
| | | sub_node = node.element("realdatarecord_fn_en"); |
| | | RealDataRecord_fn_En = Boolean.parseBoolean(sub_node.getTextTrim());
|
| | | |
| | | sub_node = node.element("realdatarecord_mintimelong"); |
| | | RealDataRecord_MinTimeLong = Integer.parseInt(sub_node.getTextTrim());
|
| | |
|
| | | sub_node = node.element("realdatarecord_maxsavetime"); |
| | | RealDataRecord_MaxSaveTime = Integer.parseInt(sub_node.getTextTrim());
|
| | | //-------------------------------------------------------//
|
| | | |
| | | } catch (NullPointerException | NumberFormatException | DocumentException e) {
|
| | | res = false;
|
| | | e.printStackTrace();
|
| | |
| | | writeConfigToXml();
|
| | | }
|
| | | }
|
| | | |
| | | public int getSqlServerType() {
|
| | | return sqlServerType;
|
| | | }
|
| | |
|
| | | public void setSqlServerType(int sqlServerType) {
|
| | | this.sqlServerType = sqlServerType;
|
| | | }
|
| | |
|
| | | public String getSqlServerIp() {
|
| | | return sqlServerIp;
|
| | | }
|
| | |
|
| | | public int getSqlServerPort() {
|
| | | return sqlServerPort;
|
| | | }
|
| | |
|
| | | public int getSqlConnCountMax() {
|
| | | return sqlConnCountMax;
|
| | | }
|
| | |
|
| | | public int getDischarge_SaveDataTimeInterval() {
|
| | | return discharge_SaveDataTimeInterval;
|
| | | }
|
| | |
|
| | | public float getDischarge_MonVolChangeLevel() {
|
| | | return discharge_MonVolChangeLevel;
|
| | | }
|
| | |
|
| | | public int getDischarge_TestTimeLongMinimum() {
|
| | | return discharge_TestTimeLongMinimum;
|
| | | }
|
| | |
|
| | | public int getDischarge_TestDataRecordCountMax() {
|
| | | return discharge_TestDataRecordCountMax;
|
| | | }
|
| | |
|
| | | public int getDischarge_BattTestGroupCountMax() {
|
| | | return discharge_BattTestGroupCountMax;
|
| | | }
|
| | |
|
| | | public int getCharge_SaveDataTimeInterval() {
|
| | | return charge_SaveDataTimeInterval;
|
| | | }
|
| | |
|
| | | public float getCharge_MonVolChangeLevel() {
|
| | | return charge_MonVolChangeLevel;
|
| | | }
|
| | |
|
| | | public int getCharge_TestTimeLongMinimum() {
|
| | | return charge_TestTimeLongMinimum;
|
| | | }
|
| | |
|
| | | public int getCharge_TestDataRecordCountMax() {
|
| | | return charge_TestDataRecordCountMax;
|
| | | }
|
| | |
|
| | | public int getCharge_BattTestGroupCountMax() {
|
| | | return charge_BattTestGroupCountMax;
|
| | | }
|
| | |
|
| | | public int getPowerAcceptPort() {
|
| | | return powerAcceptPort;
|
| | | }
|
| | |
|
| | | public boolean getBattTestStateReloadEn() {
|
| | | return battTestStateReloadEn;
|
| | | }
|
| | |
|
| | | public void setBattTestStateReloadEn(boolean battTestStateReloadEn) {
|
| | | this.battTestStateReloadEn = battTestStateReloadEn;
|
| | | }
|
| | |
|
| | | public void setPowerAcceptPort(int powerAcceptPort) {
|
| | | this.powerAcceptPort = powerAcceptPort;
|
| | | }
|
| | | |
| | | |
| | | }
|