New file |
| | |
| | | package com.dy.rtuMw.server.rtuData; |
| | | |
| | | import com.dy.common.mw.UnitAdapterInterface; |
| | | import com.dy.common.mw.UnitInterface; |
| | | import com.dy.common.mw.UnitCallbackInterface; |
| | | |
| | | public class RtuDataUnit implements UnitInterface { |
| | | |
| | | private static RtuDataUnit instance = new RtuDataUnit() ; |
| | | |
| | | public static RtuDataUnitAdapter adapter ; |
| | | public static RtuDataUnitConfigVo confVo ; |
| | | |
| | | private RtuDataUnit(){} ; |
| | | |
| | | public static RtuDataUnit getInstance(){ |
| | | return instance ; |
| | | } |
| | | |
| | | @Override |
| | | public void setAdapter(UnitAdapterInterface adapter) throws Exception { |
| | | if(adapter == null){ |
| | | throw new Exception("RTU数据处理模块适配器对象不能为空!") ; |
| | | } |
| | | RtuDataUnit.adapter = (RtuDataUnitAdapter)adapter ; |
| | | RtuDataUnit.confVo = RtuDataUnit.adapter.getConfig() ; |
| | | if(RtuDataUnit.confVo == null){ |
| | | throw new Exception("RTU数据处理模块配置对象不能为空!") ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化上行数据处理任务池 |
| | | */ |
| | | @Override |
| | | public void start(UnitCallbackInterface callback) throws Exception { |
| | | TaskPool.setTaskTreeCofig(new TreeParse().parseConfig(confVo.resourceLoader)); |
| | | callback.call(null) ; |
| | | System.out.println("RTU数据处理模块成功启动"); |
| | | } |
| | | |
| | | @Override |
| | | public void stop(UnitCallbackInterface callback) throws Exception { |
| | | } |
| | | |
| | | } |
| | | |