public List<Statistics> getConsumingStatistics( String componentName, String componentType, String cType, String cName, String saName) { List<Statistics> list = new ArrayList<Statistics>(); String name = Util.mapComponentValue(cName, componentName); String type = Util.mapComponentValue(cType, componentType); // first get provisioning endpoints String[] endpoints = getConsumingEndpoints(name, type); if (endpoints != null && endpoints.length > 0) { // get SU endpoints boolean isSU = GenericConstants.SU_TYPE.equals(componentType); Map<String, String> suList = null; if (isSU) { suList = getSuEndpoints(EndpointType.CONSUMER, saName, componentName, targetName); } for (int i = 0; i < endpoints.length; i++) { String endpoint = endpoints[i]; Statistics stats = null; // filter out endpoints that does not belong to SU if (isSU) { if (isSuEndpoint(endpoint, suList)) { stats = getStatisticsEndpoint(endpoint, cName, cType); } } else { stats = getStatisticsEndpoint(endpoint, componentName, componentType); } if (stats != null) { list.add(stats); } } } return list; }
private boolean isSuEndpoint(String endpoint, Map<String, String> suList) { boolean valid = false; if (suList != null) { String endpt = Util.trimRight(endpoint, GenericConstants.COMMA_SEPARATOR); if (suList.get(endpt) != null) { valid = true; } } return valid; }
private String getObjectName(String componentName, String componentType) { String name = DOMAIN_NAME_PREFIX + SERVICE_TYPE_PREFIX + GenericConstants.COMMA_SEPARATOR + INSTALLATION_TYPE_PREFIX + Util.mapType(componentType) + GenericConstants.COMMA_SEPARATOR + IDENTIFICATION_NAME_PREFIX + componentName; return name; }