private DatabusV3Registration findV3Registration(RegistrationId regId, DatabusRequest request) throws IOException, RequestProcessingException { Map<RegistrationId, DatabusV3Registration> regIdMap = _client.getRegistrationIdMap(); if (null == regIdMap) throw new InvalidRequestParamValueException( request.getName(), REGISTRATION_KEY_PREFIX, "No registrations available !! "); DatabusV3Registration reg = regIdMap.get(regId); if (null == reg) throw new InvalidRequestParamValueException( request.getName(), REGISTRATION_KEY_PREFIX, "Registration with id " + regId + " not present !!"); return reg; }
/** Exposes the mapping between a mpRegistration -> Set of individual registrations */ private void processMPRegistrations(DatabusRequest request) throws IOException, RequestProcessingException { Map<RegistrationId, DatabusV3Registration> registrationIdMap = _client.getRegistrationIdMap(); if (null == registrationIdMap) throw new InvalidRequestParamValueException( request.getName(), REGISTRATIONS_KEY, "Present only for Databus V3 clients"); Map<String, List<String>> ridList = new TreeMap<String, List<String>>(); for (Map.Entry<RegistrationId, DatabusV3Registration> entry : registrationIdMap.entrySet()) { DatabusV3Registration reg = entry.getValue(); if (reg instanceof DatabusV3MultiPartitionRegistration) { Collection<DatabusV3Registration> dvrList = ((DatabusV3MultiPartitionRegistration) reg).getPartionRegs().values(); List<String> mpRegList = new ArrayList<String>(); for (DatabusV3Registration dvr : dvrList) { mpRegList.add(dvr.getId().getId()); } ridList.put(entry.getKey().getId(), mpRegList); } } writeJsonObjectToResponse(ridList, request); return; }
private void processV3RegistrationInfo(String prefix, DatabusRequest request) throws IOException, RequestProcessingException { String category = request.getParams().getProperty(DatabusRequest.PATH_PARAM_NAME); String regIdStr = category.substring(prefix.length()); RegistrationId regId = new RegistrationId(regIdStr); DatabusV3Registration reg = findV3Registration(regId, request); DatabusSourcesConnection sourcesConn = _client.getDatabusSourcesConnection(regIdStr); if (null == reg) throw new InvalidRequestParamValueException( request.getName(), REGISTRATION_KEY_PREFIX, "Registration with id " + regId + " not present !!"); RegistrationStatsInfo regStatsInfo = new RegistrationStatsInfo(reg, sourcesConn); writeJsonObjectToResponse(regStatsInfo, request); }
private void processV3Registrations(DatabusRequest request) throws IOException, RequestProcessingException { Map<RegistrationId, DatabusV3Registration> registrationIdMap = _client.getRegistrationIdMap(); if (null == registrationIdMap) throw new InvalidRequestParamValueException( request.getName(), REGISTRATIONS_KEY, "Present only for Databus V3 clients"); Map<String, List<DatabusSubscription>> regIds = new TreeMap<String, List<DatabusSubscription>>(); for (Map.Entry<RegistrationId, DatabusV3Registration> entry : registrationIdMap.entrySet()) { DatabusV3Registration reg = entry.getValue(); if (reg instanceof DatabusV3MultiPartitionRegistration) continue; List<DatabusSubscription> dsl = reg.getSubscriptions(); regIds.put(entry.getKey().getId(), dsl); } writeJsonObjectToResponse(regIds, request); return; }