@Override protected Object doPost(String account, String id, SampleRequest request) throws Exception { File parent = new File(dataDir, account + "/" + id); File file = new File(parent, "database.rrd"); if (!file.exists()) { throw new DatabaseDoesNotExistException(); } RrdDb db = new RrdDb(file.getPath()); Sample sample = db.createSample(Util.normalize(request.getTime(), db.getRrdDef().getStep())); for (Map.Entry<String, Double> entry : request.getValues().entrySet()) { sample.setValue(entry.getKey(), entry.getValue()); } sample.update(); db.close(); return null; }