|  |  |  | 
|---|
|  |  |  | int onLineDataMinLength; | 
|---|
|  |  |  | int headMinLength ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | HashMap<String, AnnotationDriverVo> driverMap = ProtocolCach.getDriverMap() ; | 
|---|
|  |  |  | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCach.getPrefixedDataAvailableMap() ; | 
|---|
|  |  |  | HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCach.getOnLineMap() ; | 
|---|
|  |  |  | HashMap<String, AnnotationDriverVo> driverMap = ProtocolCache.getDriverMap() ; | 
|---|
|  |  |  | HashMap<String, AnnotationPrefixedDataAvailableVo> prefixedDataAvailableMap = ProtocolCache.getPrefixedDataAvailableMap() ; | 
|---|
|  |  |  | HashMap<String, AnnotationOnLineVo> onLineMap = ProtocolCache.getOnLineMap() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for(String cName : classNames){ | 
|---|
|  |  |  | String className = cName.substring(0,  cName.lastIndexOf('.')) ; | 
|---|
|  |  |  | 
|---|
|  |  |  | if(clazz.isAnnotationPresent(AnnotationDriver.class)){ | 
|---|
|  |  |  | AnnotationDriver ann = clazz.getAnnotation(AnnotationDriver.class) ; | 
|---|
|  |  |  | if(ann != null){ | 
|---|
|  |  |  | protocolName = ann.name() ; | 
|---|
|  |  |  | if(!(protocolName.trim().equals(""))){ | 
|---|
|  |  |  | if(driverMap.containsKey(protocolName)){ | 
|---|
|  |  |  | throw new Exception("严重错误,协议驱动名称" + protocolName + "出现了重复注解!") ; | 
|---|
|  |  |  | 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{ | 
|---|
|  |  |  | throw new Exception("严重错误,协议驱动名称注解值为空字符串") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | driverMap.put(protocolName, new AnnotationDriverVo(clazz)) ; | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | throw new Exception("严重错误,协议驱动名称注解值为空字符串") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if(clazz.isAnnotationPresent(AnnotationPrefixedDataAvailable.class)){ | 
|---|
|  |  |  | AnnotationPrefixedDataAvailable ann = clazz.getAnnotation(AnnotationPrefixedDataAvailable.class) ; | 
|---|
|  |  |  | if(ann != null){ | 
|---|
|  |  |  | protocolName = ann.protocolName() ; | 
|---|
|  |  |  | if(!(protocolName.trim().equals(""))){ | 
|---|
|  |  |  | if(prefixedDataAvailableMap.containsKey(protocolName)){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上行数据完整性检查所配协议驱动" + protocolName + "出现了重复注解!") ; | 
|---|
|  |  |  | if(ann.enable()){ | 
|---|
|  |  |  | protocolName = ann.protocolName() ; | 
|---|
|  |  |  | if(!(protocolName.trim().equals(""))){ | 
|---|
|  |  |  | if(prefixedDataAvailableMap.containsKey(protocolName)){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上行数据完整性检查所配协议驱动" + protocolName + "出现了重复注解!") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | throw new Exception("严重错误,上行数据完整性检查所配协议驱动注解值为空字符串") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | throw new Exception("严重错误,上行数据完整性检查所配协议驱动注解值为空字符串") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | priority = ann.priority() ; | 
|---|
|  |  |  | if(priority == 0){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上行数据完整性检查所配优先级注解不能为0") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(isRepeatPrefixedDataAvailablePriority(priority, prefixedDataAvailableMap)){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上行数据完整性检查所配优先级注解(priority)数值" + priority + "重复") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | priority = ann.priority() ; | 
|---|
|  |  |  | if(priority == 0){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上行数据完整性检查所配优先级注解不能为0") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(isRepeatPrefixedDataAvailablePriority(priority, prefixedDataAvailableMap)){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上行数据完整性检查所配优先级注解(priority)数值" + priority + "重复") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | onLineDataMinLength = ann.onLineDataMinLength() ; | 
|---|
|  |  |  | /*气象协议为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)) ; | 
|---|
|  |  |  | onLineDataMinLength = ann.onLineDataMinLength() ; | 
|---|
|  |  |  | /*气象协议为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)) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(clazz.isAnnotationPresent(AnnotationOnLine.class)){ | 
|---|
|  |  |  | AnnotationOnLine ann = clazz.getAnnotation(AnnotationOnLine.class) ; | 
|---|
|  |  |  | if(ann != null){ | 
|---|
|  |  |  | protocolName = ann.protocolName() ; | 
|---|
|  |  |  | if(!(protocolName.trim().equals(""))){ | 
|---|
|  |  |  | if(onLineMap.containsKey(protocolName)){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上线数据分析所配协议驱动" + protocolName + "出现了重复注解!") ; | 
|---|
|  |  |  | if(ann.enable()){ | 
|---|
|  |  |  | protocolName = ann.protocolName() ; | 
|---|
|  |  |  | if(!(protocolName.trim().equals(""))){ | 
|---|
|  |  |  | if(onLineMap.containsKey(protocolName)){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上线数据分析所配协议驱动" + protocolName + "出现了重复注解!") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | throw new Exception("严重错误,上线数据分析所配协议驱动注解值为空字符串") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else{ | 
|---|
|  |  |  | throw new Exception("严重错误,上线数据分析所配协议驱动注解值为空字符串") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | priority = ann.priority() ; | 
|---|
|  |  |  | if(priority == 0){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上线数据分析所配优先级注解不能为0") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(isRepeatOnLinePriority(priority, onLineMap)){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上线数据分析所配优先级注解(priority)数值" + priority + "重复") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | priority = ann.priority() ; | 
|---|
|  |  |  | if(priority == 0){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上线数据分析所配优先级注解不能为0") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(isRepeatOnLinePriority(priority, onLineMap)){ | 
|---|
|  |  |  | throw new Exception("严重错误, 上线数据分析所配优先级注解(priority)数值" + priority + "重复") ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | onLineMap.put(protocolName, new AnnotationOnLineVo(clazz, protocolName, priority)) ; | 
|---|
|  |  |  | onLineMap.put(protocolName, new AnnotationOnLineVo(clazz, protocolName, priority)) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|