if (!spec.instanceMatches(resources[i].getName(), resources[i].getId())) { continue;
void matchSpec(StatSpec spec, List matchedValues) { if (spec.typeMatches(this.type.getName())) { if (spec.instanceMatches(this.getName(), this.getId())) { for (int statIdx = 0; statIdx < values.length; statIdx++) { if (values[statIdx] != null) { if (spec.statMatches(values[statIdx].getDescriptor().getName())) { matchedValues.add(values[statIdx]); } } } } } }
public void load() throws IOException { if (cleanDatabaseOnLoad) { doCreateEmptyDatabase(); } statValueCache.clear(); statValueEmpty.clear(); final StatArchiveReader reader = new StatArchiveReader(new File[] { archiveFileName }, statFilters, false); for (Object r : reader.getResourceInstList()) { final StatArchiveReader.ResourceInst ri = (StatArchiveReader.ResourceInst) r; if (statFilters != null && statFilters.length > 0 && !statFilters[0].typeMatches(ri.getType().getName())) { // Filter out measurement types not in the allowed types list continue; } String measurementName = ri.getType().getName() + ":" + ri.getName(); LOG.info("Measurement [" + measurementName + "], Samples: " + ri.getSampleCount() + ", Fields: " + ri.getStatValues().length); doPrepareMeasurementLoad(); for (int measurementIndex = 0; measurementIndex < ri.getSampleCount(); measurementIndex++) { StatArchiveReader.StatValue[] measurementFields = ri.getStatValues(); long measurementTimestamp = measurementFields[0].getRawAbsoluteTimeStamps()[measurementIndex]; doLoadMeasurement(measurementName, ri.getType().getName(), measurementIndex, measurementTimestamp, measurementFields); } doCompleteMeasurementLoad(); } }
boolean loadStat(StatDescriptor stat, ResourceInst resource) { ResourceType type = resource.getType(); if (!resource.isLoaded() || !type.isLoaded() || !stat.isLoaded()) { return false; } if (filters == null || filters.length == 0) { return true; } else { String textId = resource.getName(); long numericId = resource.getId(); for (int i = 0; i < filters.length; i++) { if (filters[i].statMatches(stat.getName()) && filters[i].typeMatches(type.getName()) && filters[i].instanceMatches(textId, numericId)) { return true; } } return false; } }