package com.ld.igds.io;
|
|
import org.springframework.beans.BeansException;
|
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.stereotype.Component;
|
|
import java.util.HashMap;
|
import java.util.Map;
|
|
/**
|
* 各个解析协议实现 获取
|
*
|
* @author: andy.jia
|
* @description:
|
* @version:
|
* @data:2020年4月16日
|
*/
|
@Component(MRemoteManager.BEAN_ID)
|
public class MRemoteManager implements ApplicationContextAware {
|
|
public static final String BEAN_ID = "manager.remoteManager";
|
|
/**
|
* GPS定位管理
|
*/
|
public static Map<String, RemoteGpsMacService> remoteGpsMac = new HashMap<String, RemoteGpsMacService>();
|
|
@Override
|
public void setApplicationContext(ApplicationContext applicationContext)
|
throws BeansException {
|
Map<String, RemoteGpsMacService> gpsMap = applicationContext
|
.getBeansOfType(RemoteGpsMacService.class);
|
for (String key : gpsMap.keySet()) {
|
remoteGpsMac.put(gpsMap.get(key).getProtocol(),
|
gpsMap.get(key));
|
}
|
}
|
|
|
/**
|
* 根据协议获取GPS实现
|
*
|
* @param protocol
|
* @return
|
*/
|
public RemoteGpsMacService getRemoteGpsMacService(String protocol) {
|
return remoteGpsMac.get(protocol);
|
}
|
|
}
|