| | |
| | | Set<Class<?>> driverClasses = reflections.getTypesAnnotatedWith(AnnotationDriver.class); |
| | | if (driverClasses != null && driverClasses.size() > 0) { |
| | | String protocolName; |
| | | short protocolVersion; |
| | | String key ; |
| | | int priority; |
| | | int onLineDataMinLength; |
| | | int headMinLength; |
| | |
| | | if (ann != null) { |
| | | if (ann.enable()) { |
| | | protocolName = ann.name(); |
| | | if (!(protocolName.trim().equals(""))) { |
| | | if (driverMap.containsKey(protocolName)) { |
| | | throw new Exception("严重错误,协议驱动(名称)" + protocolName + "出现了重复注解!"); |
| | | } |
| | | driverMap.put(protocolName, new AnnotationDriverVo(clazz)); |
| | | } else { |
| | | protocolVersion = ann.version() ; |
| | | if(protocolName == null || protocolName.trim().equals("")){ |
| | | throw new Exception("严重错误,协议驱动名称注解值为空字符串"); |
| | | } |
| | | if(protocolVersion == -1){ |
| | | throw new Exception("严重错误,协议驱动版本号未配置"); |
| | | } |
| | | key = protocolName + protocolVersion ; |
| | | if (driverMap.containsKey(key)) { |
| | | throw new Exception("严重错误,协议驱动(名称+版本号)" + key + "出现了重复注解!"); |
| | | } |
| | | driverMap.put(key, new AnnotationDriverVo(clazz)); |
| | | } |
| | | } |
| | | } |
| | |
| | | throw new Exception("严重错误,上行数据完整性检查所配协议驱动注解值为空字符串"); |
| | | } |
| | | |
| | | protocolVersion = ann.protocolVersion(); |
| | | if (protocolVersion == -1) { |
| | | throw new Exception("严重错误, 上行数据完整性检查所配协议版本号未配置"); |
| | | } |
| | | |
| | | priority = ann.priority(); |
| | | if (priority == 0) { |
| | | throw new Exception("严重错误, 上行数据完整性检查所配优先级注解不能为0"); |
| | |
| | | } |
| | | |
| | | onLineDataMinLength = ann.onLineDataMinLength(); |
| | | /*气象协议为0 |
| | | if(onLineDataMinLength == 0){ |
| | | throw new Exception("严重错误, 上行数据完整性检查所配上线数据最小长度注解不能为0") ; |
| | | } |
| | | */ |
| | | /*气象协议为0 |
| | | if(onLineDataMinLength == 0){ |
| | | throw new Exception("严重错误, 上行数据完整性检查所配上线数据最小长度注解不能为0") ; |
| | | } |
| | | */ |
| | | headMinLength = ann.headMinLength(); |
| | | /*气象协议为0 |
| | | if(headMinLength == 0){ |
| | | throw new Exception("严重错误, 上行数据完整性检查所配上报数据的头部最小长度注解不能为0") ; |
| | | } |
| | | */ |
| | | prefixedDataAvailableMap.put(protocolName, new AnnotationPrefixedDataAvailableVo(clazz, protocolName, priority, onLineDataMinLength, headMinLength, ProtocolConstant.errorMaxLength)); |
| | | /*气象协议为0 |
| | | if(headMinLength == 0){ |
| | | throw new Exception("严重错误, 上行数据完整性检查所配上报数据的头部最小长度注解不能为0") ; |
| | | } |
| | | */ |
| | | key = protocolName + protocolVersion ; |
| | | prefixedDataAvailableMap.put(key, new AnnotationPrefixedDataAvailableVo(clazz, protocolName, protocolVersion, priority, onLineDataMinLength, headMinLength, ProtocolConstant.errorMaxLength)); |
| | | } |
| | | } |
| | | } |
| | |
| | | throw new Exception("严重错误,上线数据分析所配协议驱动注解值为空字符串"); |
| | | } |
| | | |
| | | protocolVersion = ann.protocolVersion(); |
| | | if (protocolVersion == -1) { |
| | | throw new Exception("严重错误, 上线数据分析所配协议版本号未配置"); |
| | | } |
| | | |
| | | priority = ann.priority(); |
| | | if (priority == 0) { |
| | | throw new Exception("严重错误, 上线数据分析所配优先级注解不能为0"); |
| | |
| | | throw new Exception("严重错误, 上线数据分析所配优先级注解(priority)数值" + priority + "重复"); |
| | | } |
| | | |
| | | onLineMap.put(protocolName, new AnnotationOnLineVo(clazz, protocolName, priority)); |
| | | key = protocolName + protocolVersion ; |
| | | onLineMap.put(key, new AnnotationOnLineVo(clazz, protocolName, protocolVersion, priority)); |
| | | } |
| | | } |
| | | } |
| | |
| | | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap){ |
| | | Collection<AnnotationPrefixedDataAvailableVo> col = prefixedDataAvailableMap.values(); |
| | | for(AnnotationPrefixedDataAvailableVo vo : col){ |
| | | if(!driverMap.containsKey(vo.protocolName)){ |
| | | return "严重错误,上行数据完整性检查所配驱动名称(" + vo.protocolName + ")在协议驱动中未配置" ; |
| | | if(!driverMap.containsKey(vo.protocolName + vo.protocolVersion)){ |
| | | return "严重错误,上行数据完整性检查所配驱动名称(" + (vo.protocolName + vo.protocolVersion) + ")在协议驱动中未配置" ; |
| | | } |
| | | } |
| | | |
| | |
| | | HashMap<String, AnnotationOnLineVo> onLineMap){ |
| | | Collection<AnnotationOnLineVo> col = onLineMap.values(); |
| | | for(AnnotationOnLineVo vo : col){ |
| | | if(!driverMap.containsKey(vo.protocolName)){ |
| | | return "严重错误,上线数据分析所配驱动名称(" + vo.protocolName + ")在协议驱动中未配置" ; |
| | | if(!driverMap.containsKey(vo.protocolName + vo.protocolVersion)){ |
| | | return "严重错误,上线数据分析所配驱动名称(" + (vo.protocolName + vo.protocolVersion) + ")在协议驱动中未配置" ; |
| | | } |
| | | } |
| | | |