示例#1
0
 public void addDatasource(String sourcePath, String destPath, DsDef newDatasource)
 {
     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.addDatasource(newDatasource);
     RrdDb rrdDest = new RrdDb(rrdDef);
     rrdSource.copyStateTo(rrdDest);
     rrdSource.close();
     rrdDest.close();
 }
示例#2
0
 public void addDatasource(String sourcePath, DsDef newDatasource, boolean saveBackup)
 {
     String destPath = Util.getTmpFilename();
     addDatasource(sourcePath, destPath, newDatasource);
     copyFile(destPath, sourcePath, saveBackup);
 }