@Override public DatasetMetadata queryMetadata(String uri, String referential) throws IOException { DatasetMetadata md = new DatasetMetadata(); // Coordinate system Dataset dataset = findDataset(uri, referential); if (dataset == null) { throw new IOException(String.format("Could not find dataset %s", uri)); } log.trace("Querying spatial axes of {}", dataset); List<TimeSlice> tss = datasetDao.getTimeSlices(dataset.getId()); GridProjected grid = queryGrid(dataset, tss); TimeAxis timeAxis = queryTimeAxis(dataset, tss); md.setCsys(new QueryCoordinateSystem(grid, timeAxis)); // Variable names log.trace("Querying variable names of {}", dataset); List<String> bandNames = new ArrayList<>(); for (Band b : datasetDao.getBands(dataset.getId())) { bandNames.add(b.getName()); } // In the current RSA, all datasets have coordinate axes (1D variables) // x, y and time bandNames.add("time"); bandNames.add("y"); bandNames.add("x"); md.setVariables(bandNames); return md; }
ReadWriteLock getLock(Dataset dataset) { List<TimeSlice> tss = datasetDao.getTimeSlices(dataset.getId()); // Get locks for all timeslices TimeSliceDbReadWriteLock lock = new TimeSliceDbReadWriteLock(TaskType.Query.toString()); for (TimeSlice ts : tss) lock.getTimeSliceIds().add(ts.getId()); return lock; }