ÎļþÃû´Ó igds-inout/src/main/java/com/ld/igds/inout/manager/ApiInoutManager.java ÐÞ¸Ä |
| | |
| | | package com.ld.igds.inout.manager; |
| | | package com.ld.igds.inout; |
| | | |
| | | import com.ld.igds.io.InoutApiService; |
| | | import com.ld.igds.io.constant.ProtocolEnum; |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | |
| | | public class ApiInoutManager implements ApplicationContextAware { |
| | | |
| | | |
| | | public static Map<String, InoutApiService> remoteMap = new HashMap<>(); |
| | | public static Map<String, ApiInoutService> remoteMap = new HashMap<>(); |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | |
| | | Map<String, InoutApiService> grainMap = applicationContext.getBeansOfType(InoutApiService.class); |
| | | Map<String, ApiInoutService> grainMap = applicationContext.getBeansOfType(ApiInoutService.class); |
| | | |
| | | for (String key : grainMap.keySet()) { |
| | | remoteMap.put(grainMap.get(key).getProtocol(), grainMap.get(key)); |
| | |
| | | * @param protocol æå±åè®® |
| | | * @return |
| | | */ |
| | | public InoutApiService getApiService(String protocol) { |
| | | InoutApiService apiService = remoteMap.get(protocol); |
| | | public ApiInoutService getApiService(String protocol) { |
| | | ApiInoutService apiService = remoteMap.get(protocol); |
| | | if (null == apiService) { |
| | | apiService = remoteMap.get(ProtocolEnum.TCP_DEFAULT.getCode()); |
| | | } |