public void addArchive(String sourcePath, String destPath, ArcDef newArchive) { if (Util.sameFilePath(sourcePath, destPath)) { throw new RrdException("Source and destination paths are the same"); } RrdDb rrdSource = new RrdDb(sourcePath); RrdDef rrdDef = rrdSource.getRrdDef(); rrdDef.setPath(destPath); rrdDef.addArchive(newArchive); RrdDb rrdDest = new RrdDb(rrdDef); rrdSource.copyStateTo(rrdDest); rrdSource.close(); rrdDest.close(); }
public void addArchive(String sourcePath, ArcDef newArchive, boolean saveBackup) { String destPath = Util.getTmpFilename(); addArchive(sourcePath, destPath, newArchive); copyFile(destPath, sourcePath, saveBackup); }