public void addMapInterceptors(MapContainer mapContainer) { InterceptorRegistry interceptorRegistry = mapContainer.getInterceptorRegistry(); List<MapInterceptor> interceptorList = interceptorRegistry.getInterceptors(); Map<String, MapInterceptor> interceptorMap = interceptorRegistry.getId2InterceptorMap(); Map<MapInterceptor, String> revMap = new HashMap<MapInterceptor, String>(); for (Map.Entry<String, MapInterceptor> entry : interceptorMap.entrySet()) { revMap.put(entry.getValue(), entry.getKey()); } InterceptorInfo interceptorInfo = new InterceptorInfo(mapContainer.getName()); for (MapInterceptor interceptor : interceptorList) { interceptorInfo.addInterceptor(revMap.get(interceptor), interceptor); } interceptorInfoList.add(interceptorInfo); }
@Override public void run() throws Exception { MapService mapService = getService(); MapServiceContext mapServiceContext = mapService.getMapServiceContext(); for (MapIndexInfo mapIndex : indexInfoList) { final MapContainer mapContainer = mapServiceContext.getMapContainer(mapIndex.mapName); final Indexes indexes = mapContainer.getIndexes(); for (MapIndexInfo.IndexInfo indexInfo : mapIndex.lsIndexes) { indexes.addOrGetIndex(indexInfo.attributeName, indexInfo.ordered); } } for (InterceptorInfo interceptorInfo : interceptorInfoList) { final MapContainer mapContainer = mapServiceContext.getMapContainer(interceptorInfo.mapName); InterceptorRegistry interceptorRegistry = mapContainer.getInterceptorRegistry(); Map<String, MapInterceptor> interceptorMap = interceptorRegistry.getId2InterceptorMap(); List<Map.Entry<String, MapInterceptor>> entryList = interceptorInfo.interceptors; for (Map.Entry<String, MapInterceptor> entry : entryList) { if (!interceptorMap.containsKey(entry.getKey())) { interceptorRegistry.register(entry.getKey(), entry.getValue()); } } } }