|  |  |  | 
|---|
|  |  |  | package com.dy.pipIrrMwTestRtu; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.mw.UnitInterface; | 
|---|
|  |  |  | import com.dy.common.util.ConfigXml; | 
|---|
|  |  |  | import com.dy.common.util.ConfigXml4Springboot; | 
|---|
|  |  |  | import com.dy.pipIrrMwTestRtu.tcpClient.TcpClUnit; | 
|---|
|  |  |  | import com.dy.pipIrrMwTestRtu.tcpClient.TcpClUnitConfigVo; | 
|---|
|  |  |  | import org.jdom2.Document; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.core.io.ResourceLoader; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | public class Server { | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | protected ResourceLoader resourceLoader ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private ConfigXml conf = null ; | 
|---|
|  |  |  | private ConfigXml4Springboot conf = null ; | 
|---|
|  |  |  | private Document doc = null ; | 
|---|
|  |  |  | private boolean showStartInfo = false ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | //ConfigProperties.init(this.getClass().getResourceAsStream("/config/config.properties"), false); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | this.conf = new ConfigXml() ; | 
|---|
|  |  |  | this.doc = this.conf.createDom(this.getClass(), "config.xml") ; | 
|---|
|  |  |  | this.conf = new ConfigXml4Springboot() ; | 
|---|
|  |  |  | this.doc = this.conf.createDom(resourceLoader, "config.xml") ; | 
|---|
|  |  |  | //////////////// | 
|---|
|  |  |  | //服务 配置 | 
|---|
|  |  |  | this.showStartInfo = this.conf.getSetAttrBoolean(this.doc, "config.server", "showStartInfo", null, null) ; | 
|---|
|  |  |  | 
|---|
|  |  |  | // /////////////// | 
|---|
|  |  |  | // 基础配置 | 
|---|
|  |  |  | ServerProperties.rtuAddr = conf.getSetAttrTxt(doc, "config.base", "rtuAddr", null, false, null); | 
|---|
|  |  |  | ServerProperties.onlyOneHeartBeat = conf.getSetAttrBoolean(doc, "config.base", "onlyOneHeartBeat",  null, null); | 
|---|
|  |  |  | ServerProperties.icCardAddr = conf.getSetAttrTxt(doc, "config.base", "icCardAddr", null, false, null); | 
|---|
|  |  |  | ServerProperties.icCardNo = conf.getSetAttrTxt(doc, "config.base", "icCardNo", null, false, null); | 
|---|
|  |  |  |  | 
|---|