|
From: <sa...@us...> - 2004-02-19 12:34:15
|
Update of /cvsroot/jrobin/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12822 Modified Files: Demo.java Log Message: Minor improvements (FetchData dump to XML) Index: Demo.java =================================================================== RCS file: /cvsroot/jrobin/src/Demo.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Demo.java 27 Nov 2003 10:22:58 -0000 1.8 --- Demo.java 19 Feb 2004 12:23:56 -0000 1.9 *************** *** 62,66 **** String gifPath = getFullPath(FILE + ".gif"); String logPath = getFullPath(FILE + ".log"); ! PrintWriter pw = new PrintWriter( new BufferedOutputStream(new FileOutputStream(logPath, false)) ); --- 62,66 ---- String gifPath = getFullPath(FILE + ".gif"); String logPath = getFullPath(FILE + ".log"); ! PrintWriter log = new PrintWriter( new BufferedOutputStream(new FileOutputStream(logPath, false)) ); *************** *** 80,84 **** rrdDef.addArchive("MAX", 0.5, 288, 797); println(rrdDef.dump()); ! pw.println(rrdDef.dump()); RrdDb rrdDb = new RrdDb(rrdDef); rrdDb.close(); --- 80,84 ---- rrdDef.addArchive("MAX", 0.5, 288, 797); println(rrdDef.dump()); ! log.println(rrdDef.dump()); RrdDb rrdDb = new RrdDb(rrdDef); rrdDb.close(); *************** *** 97,101 **** sample.setValue("sun", sunSource.getValue()); sample.setValue("shade", shadeSource.getValue()); ! pw.println(sample.dump()); sample.update(); --- 97,101 ---- sample.setValue("sun", sunSource.getValue()); sample.setValue("shade", shadeSource.getValue()); ! log.println(sample.dump()); sample.update(); *************** *** 113,117 **** FetchRequest request = rrdDb.createFetchRequest("AVERAGE", start, end); println(request.dump()); ! pw.println(request.dump()); FetchData fetchData = request.fetchData(); println("== Data fetched. " + fetchData.getRowCount() + " points obtained"); --- 113,117 ---- FetchRequest request = rrdDb.createFetchRequest("AVERAGE", start, end); println(request.dump()); ! log.println(request.dump()); FetchData fetchData = request.fetchData(); println("== Data fetched. " + fetchData.getRowCount() + " points obtained"); *************** *** 119,125 **** println(fetchData.getRow(i).dump()); } println("== Fetch completed"); println("== Dumping RRD file to XML file " + xmlPath + " (can be restored with RRDTool)"); ! rrdDb.dumpXml(xmlPath); println("== Creating RRD file " + rrdRestoredPath + " from XML file " + xmlPath); RrdDb rrdRestoredDb = new RrdDb(rrdRestoredPath, xmlPath); --- 119,129 ---- println(fetchData.getRow(i).dump()); } + println("== Dumping fetch data to XML format"); + println(fetchData.exportXml()); println("== Fetch completed"); + + // dump to XML file println("== Dumping RRD file to XML file " + xmlPath + " (can be restored with RRDTool)"); ! rrdDb.exportXml(xmlPath); println("== Creating RRD file " + rrdRestoredPath + " from XML file " + xmlPath); RrdDb rrdRestoredDb = new RrdDb(rrdRestoredPath, xmlPath); *************** *** 163,167 **** // demo ends ! pw.close(); println("== Demo completed in " + ((System.currentTimeMillis() - startMillis) / 1000.0) + " sec"); --- 167,171 ---- // demo ends ! log.close(); println("== Demo completed in " + ((System.currentTimeMillis() - startMillis) / 1000.0) + " sec"); |