You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(11) |
Oct
(60) |
Nov
(68) |
Dec
(10) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(10) |
Feb
(15) |
Mar
(30) |
Apr
(20) |
May
(32) |
Jun
(30) |
Jul
(61) |
Aug
(13) |
Sep
(14) |
Oct
(13) |
Nov
(28) |
Dec
(10) |
2005 |
Jan
(7) |
Feb
(5) |
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(15) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(20) |
Aug
(35) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(14) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sasa M. <sa...@us...> - 2004-11-05 13:10:44
|
Update of /cvsroot/jrobin/src/org/jrobin/convertor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15799/org/jrobin/convertor Modified Files: Convertor.java Log Message: Minor change Index: Convertor.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/convertor/Convertor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Convertor.java 18 Aug 2004 12:48:39 -0000 1.3 --- Convertor.java 5 Nov 2004 13:10:19 -0000 1.4 *************** *** 31,35 **** class Convertor { ! private static final String SUFFIX = ".jrobin"; private static final DecimalFormat secondsFormatter = new DecimalFormat("##0.000"); private static final DecimalFormat countFormatter = new DecimalFormat("00000"); --- 31,35 ---- class Convertor { ! private static final String SUFFIX = ".jrb"; private static final DecimalFormat secondsFormatter = new DecimalFormat("##0.000"); private static final DecimalFormat countFormatter = new DecimalFormat("00000"); |
From: Sasa M. <sa...@us...> - 2004-11-05 12:23:02
|
Update of /cvsroot/jrobin/src/org/jrobin/core/jrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4852/org/jrobin/core/jrrd Modified Files: Archive.java Log Message: Major bug removed from the jrrd package (archived values were only partialy imported). Minor changes to Demo.java. Index: Archive.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/jrrd/Archive.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Archive.java 22 Jul 2004 09:34:10 -0000 1.1 --- Archive.java 5 Nov 2004 12:22:52 -0000 1.2 *************** *** 290,294 **** --- 290,321 ---- } + /* + // THIS IS THE ORIGINAL CODE: BUGGY! Replaced by Sasa Markovic with a new method + // Funny: the bug will appear only if dsCount != 2 :) + public double[][] getValuesOriginal() throws IOException { + if (values != null) { + return values; + } + values = new double[db.header.dsCount][rowCount]; + int row = currentRow; + db.rrdFile.ras.seek(dataOffset + (row + 1) * 16); // <----- BUG (resolved below) + for (int counter = 0; counter < rowCount; counter++) { + row++; + if (row == rowCount) { + row = 0; + db.rrdFile.ras.seek(dataOffset); + } + for (int col = 0; col < db.header.dsCount; col++) { + double value = db.rrdFile.readDouble(); + values[col][counter] = value; + } + } + return values; + } + */ + + // Resolved bug from the original method (see above) public double[][] getValues() throws IOException { + // OK PART if (values != null) { return values; *************** *** 296,300 **** values = new double[db.header.dsCount][rowCount]; int row = currentRow; ! db.rrdFile.ras.seek(dataOffset + (row + 1) * 16); for (int counter = 0; counter < rowCount; counter++) { row++; --- 323,329 ---- values = new double[db.header.dsCount][rowCount]; int row = currentRow; ! // HERE ARE THE DRAGONS! ! db.rrdFile.ras.seek(dataOffset + (row + 1) * db.header.dsCount * 8); ! // OK, TOO! for (int counter = 0; counter < rowCount; counter++) { row++; |
From: Sasa M. <sa...@us...> - 2004-11-05 12:23:02
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4852/org/jrobin/core Modified Files: RrdToolReader.java Log Message: Major bug removed from the jrrd package (archived values were only partialy imported). Minor changes to Demo.java. |
From: Sasa M. <sa...@us...> - 2004-11-05 12:23:02
|
Update of /cvsroot/jrobin/src/org/jrobin/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4852/org/jrobin/demo Modified Files: Demo.java Log Message: Major bug removed from the jrrd package (archived values were only partialy imported). Minor changes to Demo.java. Index: Demo.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/demo/Demo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Demo.java 20 Jul 2004 09:08:03 -0000 1.2 --- Demo.java 5 Nov 2004 12:22:52 -0000 1.3 *************** *** 54,57 **** --- 54,61 ---- RrdDb.setLockMode(RrdDb.NO_LOCKS); long startMillis = System.currentTimeMillis(); + if(args.length > 0) { + println("Setting default backend factory to " + args[0]); + RrdDb.setDefaultFactory(args[0]); + } long start = START; long end = END; |
From: Sasa M. <sa...@us...> - 2004-11-02 09:06:15
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19373/org/jrobin/core Modified Files: RrdNioBackend.java Log Message: minor changes Index: RrdNioBackend.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdNioBackend.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** RrdNioBackend.java 19 Oct 2004 10:14:03 -0000 1.19 --- RrdNioBackend.java 2 Nov 2004 09:06:05 -0000 1.20 *************** *** 79,83 **** private void unmapFile() { if(byteBuffer != null) { ! ((DirectBuffer) byteBuffer).cleaner().clean(); byteBuffer = null; } --- 79,85 ---- private void unmapFile() { if(byteBuffer != null) { ! if(byteBuffer instanceof DirectBuffer) { ! ((DirectBuffer) byteBuffer).cleaner().clean(); ! } byteBuffer = null; } |
From: Arne V. <cob...@us...> - 2004-10-28 20:05:01
|
Update of /cvsroot/jrobin/src/org/jrobin/graph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12533/org/jrobin/graph Modified Files: ExportData.java RrdExporter.java Source.java ValueExtractor.java Log Message: JRobin 1.4.1 - Fixing bug #0000067 - Note: Importing of ExportData is broken in this commit! Index: ValueExtractor.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/ValueExtractor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ValueExtractor.java 27 Oct 2004 20:36:26 -0000 1.5 --- ValueExtractor.java 28 Oct 2004 20:04:43 -0000 1.6 *************** *** 97,102 **** for (int x = 0; x < dsValues[i].length; x++) { ! sources[tblPos].setTimespan( startTime, endTime ); ! sources[tblPos++].setFetchedStep( steps[i] ); } } --- 97,101 ---- for (int x = 0; x < dsValues[i].length; x++) { ! sources[tblPos++].setFetchSettings( steps[i], startTime, endTime ); } } Index: ExportData.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/ExportData.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExportData.java 21 Sep 2004 08:42:10 -0000 1.6 --- ExportData.java 28 Oct 2004 20:04:43 -0000 1.7 *************** *** 605,609 **** { sources[i] = new Def( dsNames[i], arraySize, arraySize ); ! sources[i].setFetchedStep( step ); } --- 605,610 ---- { sources[i] = new Def( dsNames[i], arraySize, arraySize ); ! System.err.println("jdsklfjsdkljfdss"); ! //sources[i].setFetchedStep( step ); } Index: Source.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/Source.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Source.java 27 Oct 2004 20:36:26 -0000 1.13 --- Source.java 28 Oct 2004 20:04:43 -0000 1.14 *************** *** 52,56 **** private double min = Double.NaN; private double max = Double.NaN; - private double lastValue = Double.NaN; private double totalValue = 0; private double nextValue = Double.POSITIVE_INFINITY; --- 52,55 ---- *************** *** 96,109 **** } ! void setTimespan( long startTime, long endTime ) { this.startTime = startTime; this.endTime = endTime; } - void setFetchedStep( long step ) { - this.step = step; - } - long getStep() { return step; --- 95,105 ---- } ! void setFetchSettings( long step, long startTime, long endTime ) { + this.step = step; this.startTime = startTime; this.endTime = endTime; } long getStep() { return step; *************** *** 262,266 **** lastTime = ( time < startTime ? startTime : time ); - lastValue = value; } } --- 258,261 ---- Index: RrdExporter.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdExporter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RrdExporter.java 27 Oct 2004 20:36:26 -0000 1.7 --- RrdExporter.java 28 Oct 2004 20:04:43 -0000 1.8 *************** *** 292,296 **** { sources[tblPos] = new Def( edefList[i].getName(), numRows, reducedNumRows ); ! sources[tblPos].setFetchedStep( edefList[i].getStep() ); sourceIndex.put( edefList[i].getName(), new Integer(tblPos++) ); } --- 292,296 ---- { sources[tblPos] = new Def( edefList[i].getName(), numRows, reducedNumRows ); ! sources[tblPos].setFetchSettings( edefList[i].getStep(), startTime, endTime ); sourceIndex.put( edefList[i].getName(), new Integer(tblPos++) ); } *************** *** 300,304 **** { pdefList[i].prepare( numRows, reducedNumRows ); ! pdefList[i].setFetchedStep( minStep ); sources[tblPos] = pdefList[i]; --- 300,304 ---- { pdefList[i].prepare( numRows, reducedNumRows ); ! pdefList[i].setFetchSettings( minStep, startTime, endTime ); sources[tblPos] = pdefList[i]; *************** *** 313,317 **** { cdefList[i].prepare( sourceIndex, numRows, reducedNumRows ); ! cdefList[i].setFetchedStep( minStep ); sources[tblPos] = cdefList[i]; --- 313,317 ---- { cdefList[i].prepare( sourceIndex, numRows, reducedNumRows ); ! cdefList[i].setFetchSettings( minStep, startTime, endTime ); sources[tblPos] = cdefList[i]; *************** *** 500,504 **** { Def src = new Def( origSrc.getName(), reducedNumRows, reducedNumRows ); ! src.setFetchedStep( reducedStep ); for ( int i = 0; i < reducedNumRows; i++ ) --- 500,504 ---- { Def src = new Def( origSrc.getName(), reducedNumRows, reducedNumRows ); ! src.setFetchSettings( reducedStep, startTime, endTime ); for ( int i = 0; i < reducedNumRows; i++ ) |
From: Arne V. <cob...@us...> - 2004-10-28 20:04:53
|
Update of /cvsroot/jrobin/src/org/jrobin/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12533/org/jrobin/demo Modified Files: PlottableDemo.java Log Message: JRobin 1.4.1 - Fixing bug #0000067 - Note: Importing of ExportData is broken in this commit! Index: PlottableDemo.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/demo/PlottableDemo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PlottableDemo.java 27 Oct 2004 20:36:25 -0000 1.3 --- PlottableDemo.java 28 Oct 2004 20:04:42 -0000 1.4 *************** *** 59,63 **** private PlottableDemo() throws RrdException, IOException { createGraph1(); ! /*createGraph2(); createGraph3(); createGraph4(); --- 59,63 ---- private PlottableDemo() throws RrdException, IOException { createGraph1(); ! createGraph2(); createGraph3(); createGraph4(); *************** *** 73,77 **** createGraph14(); createGraph15(); ! createGraph16();*/ createGraph17(); } --- 73,77 ---- createGraph14(); createGraph15(); ! createGraph16(); createGraph17(); } *************** *** 476,479 **** --- 476,480 ---- String filename = Util.getJRobinDemoPath("plottable" + (++count) + ".png"); graph.saveAsPNG(filename, 800, 400); + //graph.getExportData().exportXml( System.out ); System.out.println("Saved to: " + filename); } |
From: Arne V. <cob...@us...> - 2004-10-27 20:36:42
|
Update of /cvsroot/jrobin/src/org/jrobin/demo In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8709/org/jrobin/demo Modified Files: ComplexDemo.java PlottableDemo.java StressTest.java Log Message: JRobin 1.4.1 - Fixing bug #0000067 - Improved grid with constant value Index: StressTest.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/demo/StressTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StressTest.java 9 Jun 2004 12:09:23 -0000 1.1 --- StressTest.java 27 Oct 2004 20:36:26 -0000 1.2 *************** *** 124,128 **** // GRAPH printLapTime("Creating composite graph definition"); ! RrdGraphDef gdef = new RrdGraphDef(TIME_START, TIME_END); gdef.setTitle("Temperatures"); gdef.setVerticalLabel("Fahrenheits"); --- 124,128 ---- // GRAPH printLapTime("Creating composite graph definition"); ! RrdGraphDef gdef = new RrdGraphDef(TIME_START, 0); // A 0 end time makes sure the last sample time i used gdef.setTitle("Temperatures"); gdef.setVerticalLabel("Fahrenheits"); Index: ComplexDemo.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/demo/ComplexDemo.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ComplexDemo.java 21 Sep 2004 08:42:10 -0000 1.3 --- ComplexDemo.java 27 Oct 2004 20:36:25 -0000 1.4 *************** *** 168,175 **** def.gprint("ftp", "MIN", "never below: @0 )\n\n"); def.comment(" Usage spread:"); ! def.area(new GregorianCalendar(2003, 7, 19, 17, 00), Double.MIN_VALUE, new GregorianCalendar(2003, 7, 19, 23, 00), Double.MAX_VALUE, Color.RED, "peak period"); ! def.area(new GregorianCalendar(2003, 7, 20, 5, 00), Double.MIN_VALUE, new GregorianCalendar(2003, 7, 20, 8, 30), Double.MAX_VALUE, Color.LIGHT_GRAY, "quiet period\n"); --- 168,175 ---- def.gprint("ftp", "MIN", "never below: @0 )\n\n"); def.comment(" Usage spread:"); ! def.area(new GregorianCalendar(2003, 7, 19, 17, 00), -Double.MAX_VALUE, new GregorianCalendar(2003, 7, 19, 23, 00), Double.MAX_VALUE, Color.RED, "peak period"); ! def.area(new GregorianCalendar(2003, 7, 20, 5, 00), -Double.MAX_VALUE, new GregorianCalendar(2003, 7, 20, 8, 30), Double.MAX_VALUE, Color.LIGHT_GRAY, "quiet period\n"); Index: PlottableDemo.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/demo/PlottableDemo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PlottableDemo.java 11 Jun 2004 07:58:51 -0000 1.2 --- PlottableDemo.java 27 Oct 2004 20:36:25 -0000 1.3 *************** *** 59,63 **** private PlottableDemo() throws RrdException, IOException { createGraph1(); ! createGraph2(); createGraph3(); createGraph4(); --- 59,63 ---- private PlottableDemo() throws RrdException, IOException { createGraph1(); ! /*createGraph2(); createGraph3(); createGraph4(); *************** *** 73,77 **** createGraph14(); createGraph15(); ! createGraph16(); createGraph17(); } --- 73,77 ---- createGraph14(); createGraph15(); ! createGraph16();*/ createGraph17(); } *************** *** 475,479 **** RrdGraph graph = new RrdGraph(gDef); String filename = Util.getJRobinDemoPath("plottable" + (++count) + ".png"); ! graph.saveAsPNG(filename, 400, 200); System.out.println("Saved to: " + filename); } --- 475,479 ---- RrdGraph graph = new RrdGraph(gDef); String filename = Util.getJRobinDemoPath("plottable" + (++count) + ".png"); ! graph.saveAsPNG(filename, 800, 400); System.out.println("Saved to: " + filename); } |
From: Arne V. <cob...@us...> - 2004-10-27 20:36:42
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8709/org/jrobin/core Modified Files: Util.java Log Message: JRobin 1.4.1 - Fixing bug #0000067 - Improved grid with constant value Index: Util.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/Util.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Util.java 13 Oct 2004 07:18:51 -0000 1.24 --- Util.java 27 Oct 2004 20:36:25 -0000 1.25 *************** *** 53,56 **** --- 53,59 ---- public class Util { + public static final double MAX_DOUBLE = Double.MAX_VALUE; + public static final double MIN_DOUBLE = -Double.MAX_VALUE; + // pattern RRDTool uses to format doubles in XML files static final String PATTERN = "0.0000000000E00"; |
From: Arne V. <cob...@us...> - 2004-10-27 20:36:42
|
Update of /cvsroot/jrobin/src/org/jrobin/graph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8709/org/jrobin/graph Modified Files: CustomArea.java RrdExporter.java Source.java ValueExtractor.java ValueGrid.java Removed Files: RrdtoolGraph.java Log Message: JRobin 1.4.1 - Fixing bug #0000067 - Improved grid with constant value Index: ValueExtractor.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/ValueExtractor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ValueExtractor.java 25 Jul 2004 12:28:49 -0000 1.4 --- ValueExtractor.java 27 Oct 2004 20:36:26 -0000 1.5 *************** *** 87,91 **** // -- Protected methods // ================================================================ ! int prepareSources( Source[] sources, int offset ) { int tblPos = offset; --- 87,91 ---- // -- Protected methods // ================================================================ ! int prepareSources( Source[] sources, int offset, long startTime, long endTime ) { int tblPos = offset; *************** *** 97,100 **** --- 97,101 ---- for (int x = 0; x < dsValues[i].length; x++) { + sources[tblPos].setTimespan( startTime, endTime ); sources[tblPos++].setFetchedStep( steps[i] ); } Index: ValueGrid.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/ValueGrid.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ValueGrid.java 25 Jul 2004 12:28:49 -0000 1.13 --- ValueGrid.java 27 Oct 2004 20:36:26 -0000 1.14 *************** *** 141,144 **** --- 141,151 ---- upper = 0.9; + if ( upper == lower ) + { + double origUpper = upper; + upper = origUpper + origUpper/100; + lower = origUpper - origUpper/100; + } + // Determine nice axis grid double shifted = Math.abs(upper - lower); Index: CustomArea.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/CustomArea.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CustomArea.java 9 Jul 2004 12:22:15 -0000 1.5 --- CustomArea.java 27 Oct 2004 20:36:26 -0000 1.6 *************** *** 30,33 **** --- 30,34 ---- import org.jrobin.core.RrdException; import org.jrobin.core.XmlWriter; + import org.jrobin.core.Util; /** *************** *** 110,123 **** // Get Y positions ! if ( yVal1 == Double.MIN_VALUE ) ay = g.getMinY(); ! else if ( yVal1 == Double.MAX_VALUE ) ay = g.getMaxY(); else ay = g.getY( yVal1 ); ! if ( yVal2 == Double.MIN_VALUE ) ny = g.getMinY(); ! else if ( yVal2 == Double.MAX_VALUE ) ny = g.getMaxY(); else --- 111,124 ---- // Get Y positions ! if ( yVal1 == Util.MIN_DOUBLE ) ay = g.getMinY(); ! else if ( yVal1 == Util.MAX_DOUBLE ) ay = g.getMaxY(); else ay = g.getY( yVal1 ); ! if ( yVal2 == Util.MIN_DOUBLE ) ny = g.getMinY(); ! else if ( yVal2 == Util.MAX_DOUBLE ) ny = g.getMaxY(); else *************** *** 135,139 **** // Set the stackvalues // Always use the y value of the second specified point to stack on ! if ( yVal2 != Double.MAX_VALUE ) for (int i = 0; i < stackValues.length; i++) if ( xValues[i] < ax || xValues[i] > nx ) --- 136,140 ---- // Set the stackvalues // Always use the y value of the second specified point to stack on ! if ( yVal2 != Util.MAX_DOUBLE ) for (int i = 0; i < stackValues.length; i++) if ( xValues[i] < ax || xValues[i] > nx ) *************** *** 155,166 **** { long time = timestamps[tblPos]; ! // Out of range if ( time > xVal2 || time < xVal1 ) return Double.NaN; ! ! if ( yVal2 == Double.MAX_VALUE ) return Double.NaN; ! return yVal2; } --- 156,167 ---- { long time = timestamps[tblPos]; ! // Out of range if ( time > xVal2 || time < xVal1 ) return Double.NaN; ! ! if ( yVal2 == Util.MAX_DOUBLE ) return Double.NaN; ! return yVal2; } Index: Source.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/Source.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Source.java 25 Jul 2004 12:28:49 -0000 1.12 --- Source.java 27 Oct 2004 20:36:26 -0000 1.13 *************** *** 61,64 **** --- 61,66 ---- private long totalTime = 0; + private long startTime, endTime; + private int stPos = 0; private int lastStPos = 0; // Last value position requested *************** *** 75,80 **** this.name = name; } ! ! // ================================================================ // -- Protected methods --- 77,81 ---- this.name = name; } ! // ================================================================ // -- Protected methods *************** *** 91,98 **** // The first sample is before the time range we want, and as such // should not be counted for data aggregation ! if ( pos > 0 && pos < aggregatePoints ) aggregate( time, val ); } void setFetchedStep( long step ) { this.step = step; --- 92,105 ---- // The first sample is before the time range we want, and as such // should not be counted for data aggregation ! if ( pos < aggregatePoints ) aggregate( time, val ); } + void setTimespan( long startTime, long endTime ) + { + this.startTime = startTime; + this.endTime = endTime; + } + void setFetchedStep( long step ) { this.step = step; *************** *** 155,159 **** t = ( t < preciseTime ? t + step : t ); ! if ( preciseTime < lastPreciseTime ) // Backward fetching is weird, start over, we prolly in a new iteration stPos = 0; --- 162,166 ---- t = ( t < preciseTime ? t + step : t ); ! if ( preciseTime < lastPreciseTime ) // Backward fetching is weird, start over, we're prolly in a new iteration stPos = 0; *************** *** 199,203 **** case AGG_FIRST: if ( values != null && values.length > 0) ! return values[0]; break; --- 206,210 ---- case AGG_FIRST: if ( values != null && values.length > 0) ! return values[ values.length > 1 ? 1 : 0 ]; break; *************** *** 235,255 **** * @param value Double value of the datapoint. */ ! private void aggregate( long time, double value ) { if ( Double.isInfinite(value) ) return; ! min = Util.min( min, value ); ! max = Util.max( max, value ); ! ! if ( !Double.isNaN(lastValue) && !Double.isNaN(value) ) { long timeDelta = time - lastTime; ! totalValue += timeDelta * ( value + lastValue ) / 2.0; totalTime += timeDelta; } ! lastTime = time; lastValue = value; } --- 242,265 ---- * @param value Double value of the datapoint. */ ! private void aggregate( long time, double value ) { if ( Double.isInfinite(value) ) return; ! if ( time > endTime ) ! time = endTime; ! ! if ( lastTime > 0 && !Double.isNaN(value) && value != Double.MIN_VALUE && value != Double.MAX_VALUE ) { + min = Util.min( min, value ); + max = Util.max( max, value ); + long timeDelta = time - lastTime; ! totalValue += timeDelta * value; totalTime += timeDelta; } ! lastTime = ( time < startTime ? startTime : time ); lastValue = value; } Index: RrdExporter.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdExporter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RrdExporter.java 25 Jul 2004 12:28:49 -0000 1.6 --- RrdExporter.java 27 Oct 2004 20:36:26 -0000 1.7 *************** *** 327,331 **** int pos = 0; for (int j = 0; j < veList.length; j++) ! pos = veList[j].prepareSources( sources, pos ); // **************************************************************************************** // --- 327,331 ---- int pos = 0; for (int j = 0; j < veList.length; j++) ! pos = veList[j].prepareSources( sources, pos, startTime, endTime ); // **************************************************************************************** // --- RrdtoolGraph.java DELETED --- |
From: Arne V. <cob...@us...> - 2004-10-27 20:36:42
|
Update of /cvsroot/jrobin/src/org/jrobin/cmd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8709/org/jrobin/cmd Modified Files: RrdXportCmd.java Log Message: JRobin 1.4.1 - Fixing bug #0000067 - Improved grid with constant value Index: RrdXportCmd.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/cmd/RrdXportCmd.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RrdXportCmd.java 19 Jul 2004 15:00:03 -0000 1.3 --- RrdXportCmd.java 27 Oct 2004 20:36:24 -0000 1.4 *************** *** 40,44 **** } ! Object execute() throws RrdException, IOException { // --start String startStr = getOptionValue("s", "start", DEFAULT_START); --- 40,45 ---- } ! Object execute() throws RrdException, IOException ! { // --start String startStr = getOptionValue("s", "start", DEFAULT_START); |
From: Sasa M. <sa...@us...> - 2004-10-22 13:27:36
|
Update of /cvsroot/jrobin/ant In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11329 Modified Files: build.xml Log Message: minor changes Index: build.xml =================================================================== RCS file: /cvsroot/jrobin/ant/build.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** build.xml 12 Jul 2004 14:01:41 -0000 1.3 --- build.xml 22 Oct 2004 13:27:20 -0000 1.4 *************** *** 71,74 **** --- 71,75 ---- <include name="${libs}/${lib-inspector}" /> <include name="${libs}/${lib-convertor}" /> + <include name="${libs}/${lib-demo}" /> </fileset> </delete> *************** *** 161,164 **** --- 162,166 ---- destdir="${cwd}/${javadoc}" packagenames="org.jrobin.core.*,org.jrobin.graph.*" + excludepackagenames="org.jrobin.core.jrrd.*" source="1.4" sourcepath="${cwd}/${src}" |
From: Sasa M. <sa...@us...> - 2004-10-22 12:31:12
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29236/org/jrobin/core Modified Files: RrdDb.java Log Message: Modifed RrdDb constructor so that it throws more specific FileNotFoundException (subclass of IOException) if the RRD file does not exist. Won't break existing code. Index: RrdDb.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDb.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** RrdDb.java 21 Oct 2004 08:05:25 -0000 1.32 --- RrdDb.java 22 Oct 2004 12:30:50 -0000 1.33 *************** *** 26,33 **** package org.jrobin.core; ! import java.io.ByteArrayOutputStream; ! import java.io.FileOutputStream; ! import java.io.IOException; ! import java.io.OutputStream; /** --- 26,30 ---- package org.jrobin.core; ! import java.io.*; /** *************** *** 215,227 **** * <code>IOException</code> will be thrown. * @param factory Backend factory which will be used for this RRD. ! * @throws IOException Thrown in case of I/O error. * @throws RrdException Thrown in case of JRobin specific error. * @see RrdBackendFactory */ public RrdDb(String path, boolean readOnly, RrdBackendFactory factory) ! throws IOException, RrdException { // opens existing RRD file - throw exception if the file does not exist... if(!factory.exists(path)) { ! throw new IOException("Could not open " + path + " [non existent]"); } backend = factory.open(path, readOnly, lockMode); --- 212,225 ---- * <code>IOException</code> will be thrown. * @param factory Backend factory which will be used for this RRD. ! * @throws FileNotFoundException Thrown if the requested file does not exist. ! * @throws IOException Thrown in case of general I/O error (bad RRD file, for example). * @throws RrdException Thrown in case of JRobin specific error. * @see RrdBackendFactory */ public RrdDb(String path, boolean readOnly, RrdBackendFactory factory) ! throws FileNotFoundException, IOException, RrdException { // opens existing RRD file - throw exception if the file does not exist... if(!factory.exists(path)) { ! throw new FileNotFoundException("Could not open " + path + " [non existent]"); } backend = factory.open(path, readOnly, lockMode); |
From: Sasa M. <sa...@us...> - 2004-10-21 08:05:42
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17853/org/jrobin/core Modified Files: RrdDb.java Log Message: Added two methods to fetch last datasource values from a RrdDb object Index: RrdDb.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDb.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** RrdDb.java 19 Oct 2004 10:14:02 -0000 1.31 --- RrdDb.java 21 Oct 2004 08:05:25 -0000 1.32 *************** *** 1088,1096 **** } public static void main(String[] args) { - System.out.println("JRobin base directory: " + Util.getJRobinHomeDirectory()); System.out.println("JRobin Java Library :: RRDTool choice for the Java world"); ! System.out.println("http://www.jrobin.org"); ! System.out.println("(C) 2004 Sasa Markovic & Arne Vandamme"); } --- 1088,1125 ---- } + /** + * Returns an array of last datasource values. The first value in the array corresponds + * to the first datasource defined in the RrdDb and so on. + * @return Array of last datasource values + * @throws IOException Thrown in case of I/O error + */ + public synchronized double[] getLastDatasourceValues() throws IOException { + double[] values = new double[datasources.length]; + for(int i = 0; i < values.length; i++) { + values[i] = datasources[i].getLastValue(); + } + return values; + } + + /** + * Returns the last stored value for the given datasource. + * @param dsName Datasource name + * @return Last stored value for the given datasource + * @throws IOException Thrown in case of I/O error + * @throws RrdException Thrown if no datasource in this RrdDb matches the given datasource name + */ + public synchronized double getLastDatasourceValue(String dsName) throws IOException, RrdException { + int dsIndex = getDsIndex(dsName); + return datasources[dsIndex].getLastValue(); + } + public static void main(String[] args) { System.out.println("JRobin Java Library :: RRDTool choice for the Java world"); ! System.out.println("=================================================================="); ! System.out.println("JRobin base directory: " + Util.getJRobinHomeDirectory()); ! System.out.println("Current timestamp: " + Util.getTime()); ! System.out.println("------------------------------------------------------------------"); ! System.out.println("For the latest information visit: http://www.jrobin.org"); ! System.out.println("(C) 2003, 2004 Sasa Markovic & Arne Vandamme. All rights reserved."); } |
From: Sasa M. <sa...@us...> - 2004-10-19 10:14:20
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14900/org/jrobin/core Modified Files: RrdBackend.java RrdDb.java RrdDbPool.java RrdFileBackend.java RrdNioBackend.java Log Message: Major improvement to NIO backend: it is now possible to discard MappedByteBuffer without invoking System.gc(). As a result, the code is much simpler, cleaner and safer. HACK: to discard MappedByteBuffer buffer, use: ((DirectBuffer) buffer).cleaner.clean(); Index: RrdDbPool.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDbPool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** RrdDbPool.java 27 Sep 2004 14:32:13 -0000 1.17 --- RrdDbPool.java 19 Oct 2004 10:14:03 -0000 1.18 *************** *** 107,125 **** // singleton pattern private static RrdDbPool ourInstance; ! static { ! Runtime.getRuntime().addShutdownHook(new Thread(CLOSING_THREAD_NAME) { ! public void run() { ! if(ourInstance != null) { ! try { ! ourInstance.close(); ! } ! catch (IOException e) { ! e.printStackTrace(); ! } ! } } ! }); ! } /** --- 107,122 ---- // singleton pattern private static RrdDbPool ourInstance; + private boolean closingOnExit = true; ! private Thread shutdownHook = new Thread(CLOSING_THREAD_NAME) { ! public void run() { ! try { ! close(); } ! catch (IOException e) { ! e.printStackTrace(); ! } ! } ! }; /** *************** *** 164,168 **** private RrdDbPool() { ! // just to satisfy the singleton pattern } --- 161,192 ---- private RrdDbPool() { ! setClosingOnExit(closingOnExit); ! } ! ! /** ! * Checks the exiting behaviour of RrdDbPool. ! * @return <code>True</code>, if all RRD files are to be closed ! * when application invokes <code>System.exit()</code>. ! * <code>False</code> otherwise. The default behaviour is <code>true</code> ! * (all RRD files will be closed on exit). ! */ ! public synchronized boolean isClosingOnExit() { ! return closingOnExit; ! } ! ! /** ! * Sets the exiting behaviour of RrdDbPool. ! * @param closingOnExit <code>True</code>, if all RRD files are to be closed ! * when application invokes <code>System.exit()</code>. ! * <code>False</code> otherwise. The default behaviour is <code>true</code> ! * (all RRD files will be closed on exit). ! */ ! public synchronized void setClosingOnExit(boolean closingOnExit) { ! Runtime runtime = Runtime.getRuntime(); ! runtime.removeShutdownHook(shutdownHook); ! if(closingOnExit) { ! runtime.addShutdownHook(shutdownHook); ! } ! this.closingOnExit = closingOnExit; } Index: RrdBackend.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdBackend.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RrdBackend.java 18 Oct 2004 13:09:33 -0000 1.8 --- RrdBackend.java 19 Oct 2004 10:14:02 -0000 1.9 *************** *** 137,151 **** /** ! * Closes the underlying storage. Calls sync() implicitly. ! * In other words, you don't have to call sync() before close() in order to preserve ! * data cached in memory. * @throws IOException Thrown in case of I/O error */ public void close() throws IOException { - sync(); } /** ! * Method called by the framework immediatelly before RRD update operation starts. This method * does nothing, but can be overriden in subclasses. */ --- 137,148 ---- /** ! * Closes the underlying backend. * @throws IOException Thrown in case of I/O error */ public void close() throws IOException { } /** ! * Method called by the framework immediately before RRD update operation starts. This method * does nothing, but can be overriden in subclasses. */ *************** *** 154,158 **** /** ! * Method called by the framework immediatelly after RRD update operation is completed. This method * does nothing, but can be overriden in subclasses. */ --- 151,155 ---- /** ! * Method called by the framework immediately after RRD update operation is completed. This method * does nothing, but can be overriden in subclasses. */ *************** *** 161,165 **** /** ! * Method called by the framework immediatelly before RRD fetch operation starts. This method * does nothing, but can be overriden in subclasses. */ --- 158,162 ---- /** ! * Method called by the framework immediately before RRD fetch operation starts. This method * does nothing, but can be overriden in subclasses. */ *************** *** 168,172 **** /** ! * Method called by the framework immediatelly after RRD fetch operation is completed. This method * does nothing, but can be overriden in subclasses. */ --- 165,169 ---- /** ! * Method called by the framework immediately after RRD fetch operation is completed. This method * does nothing, but can be overriden in subclasses. */ *************** *** 175,179 **** /** ! * Method called by the framework immediatelly after RrdDb obejct is created. This method * does nothing, but can be overriden in subclasses. */ --- 172,176 ---- /** ! * Method called by the framework immediately after RrdDb obejct is created. This method * does nothing, but can be overriden in subclasses. */ *************** *** 188,192 **** * @throws IOException Thrown in case of I/O error */ ! public void sync() throws IOException { } --- 185,197 ---- * @throws IOException Thrown in case of I/O error */ ! protected void sync() throws IOException { ! } ! ! /** ! * Method called by the framework when a RrdDb file is about to be closed. This method ! * calls {@link #sync()} internally. ! */ ! public void beforeClose() throws IOException { ! sync(); } Index: RrdNioBackend.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdNioBackend.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** RrdNioBackend.java 18 Oct 2004 13:09:33 -0000 1.18 --- RrdNioBackend.java 19 Oct 2004 10:14:03 -0000 1.19 *************** *** 27,34 **** import java.io.IOException; - import java.nio.channels.FileChannel; import java.nio.MappedByteBuffer; ! import java.util.TimerTask; import java.util.Timer; /** --- 27,35 ---- import java.io.IOException; import java.nio.MappedByteBuffer; ! import java.nio.channels.FileChannel; ! import sun.nio.ch.DirectBuffer; import java.util.Timer; + import java.util.TimerTask; /** *************** *** 37,73 **** */ public class RrdNioBackend extends RrdFileBackend { ! /** ! * Defines <code>System.gc()</code> usage policy for this backend.<p> ! * ! * NIO backend uses potentially large in-memory buffer to cache file data. ! * The buffer remains 'active' (by prohibiting file re-creation with the smaller file size) ! * as long as it is not garbage-collected. By forcing <code>System.gc()</code> call where ! * appropriate, this backend will free in-memory buffers sooner and file re-creation won't fail.<p> ! * ! * The constant is set to <b><code>true</code></b> initially and currently there is no ! * API to change it during runtime. ! * ! * Garbage collection will be forced only in some special circumstances. ! * It should not affect the speed of your application significantly.<p> ! */ ! public static final boolean SHOULD_GC = true; ! ! private static final Timer syncTimer = new Timer(true); private int syncMode; - MappedByteBuffer byteBuffer; private TimerTask syncTask; protected RrdNioBackend(String path, boolean readOnly, int lockMode, int syncMode, int syncPeriod) throws IOException { super(path, readOnly, lockMode); - map(readOnly); this.syncMode = syncMode; if(syncMode == RrdNioBackendFactory.SYNC_BACKGROUND && !readOnly) { ! createSyncTask(syncPeriod); } } ! private void map(boolean readOnly) throws IOException { long length = getLength(); if(length > 0) { --- 38,72 ---- */ public class RrdNioBackend extends RrdFileBackend { ! private static final Timer fileSyncTimer = new Timer(true); + private MappedByteBuffer byteBuffer; private int syncMode; private TimerTask syncTask; + /** + * Creates RrdFileBackend object for the given file path, backed by java.nio.* classes. + * @param path Path to a file + * @param readOnly True, if file should be open in a read-only mode. False otherwise + * @param lockMode Locking mode, as described in {@link RrdDb#getLockMode()} + * @param syncMode See {@link RrdNioBackendFactory#setSyncMode(int)} for explanation + * @param syncPeriod See {@link RrdNioBackendFactory#setSyncMode(int)} for explanation + * @throws IOException Thrown in case of I/O error + */ protected RrdNioBackend(String path, boolean readOnly, int lockMode, int syncMode, int syncPeriod) throws IOException { super(path, readOnly, lockMode); this.syncMode = syncMode; + mapFile(); if(syncMode == RrdNioBackendFactory.SYNC_BACKGROUND && !readOnly) { ! syncTask = new TimerTask() { ! public void run() { ! sync(); ! } ! }; ! fileSyncTimer.schedule(syncTask, syncPeriod * 1000L, syncPeriod * 1000L); } } ! private void mapFile() throws IOException { long length = getLength(); if(length > 0) { *************** *** 76,91 **** byteBuffer = channel.map(mapMode, 0, length); } - else { - byteBuffer = null; - } } ! private void createSyncTask(int syncPeriod) { ! syncTask = new TimerTask() { ! public void run() { ! sync(); ! } ! }; ! syncTimer.schedule(syncTask, syncPeriod * 1000L, syncPeriod * 1000L); } --- 75,85 ---- byteBuffer = channel.map(mapMode, 0, length); } } ! private void unmapFile() { ! if(byteBuffer != null) { ! ((DirectBuffer) byteBuffer).cleaner().clean(); ! byteBuffer = null; ! } } *************** *** 96,109 **** * @throws IOException Thrown in case of I/O error. */ ! protected void setLength(long newLength) throws IOException { ! if(newLength < getLength()) { ! // the file will be truncated ! if(SHOULD_GC) { ! byteBuffer = null; ! System.gc(); ! } ! } super.setLength(newLength); ! map(false); } --- 90,97 ---- * @throws IOException Thrown in case of I/O error. */ ! protected synchronized void setLength(long newLength) throws IOException { ! unmapFile(); super.setLength(newLength); ! mapFile(); } *************** *** 113,121 **** * @param b Bytes to be written. */ ! protected void write(long offset, byte[] b) { ! synchronized(byteBuffer) { byteBuffer.position((int)offset); byteBuffer.put(b); } } --- 101,112 ---- * @param b Bytes to be written. */ ! protected synchronized void write(long offset, byte[] b) throws IOException { ! if(byteBuffer != null) { byteBuffer.position((int)offset); byteBuffer.put(b); } + else { + throw new IOException("Write failed, file " + getPath() + " not mapped for I/O"); + } } *************** *** 125,133 **** * @param b Buffer which receives bytes read from the file. */ ! protected void read(long offset, byte[] b) { ! synchronized(byteBuffer) { byteBuffer.position((int)offset); byteBuffer.get(b); } } --- 116,127 ---- * @param b Buffer which receives bytes read from the file. */ ! protected synchronized void read(long offset, byte[] b) throws IOException { ! if(byteBuffer != null) { byteBuffer.position((int)offset); byteBuffer.get(b); } + else { + throw new IOException("Read failed, file " + getPath() + " not mapped for I/O"); + } } *************** *** 136,149 **** * @throws IOException Thrown in case of I/O error */ ! public void close() throws IOException { // cancel synchronization if(syncTask != null) { syncTask.cancel(); } ! // synchronize with the disk for the last time ! sync(); ! // release the buffer, make it eligible for GC as soon as possible ! byteBuffer = null; ! // close the underlying file super.close(); } --- 130,139 ---- * @throws IOException Thrown in case of I/O error */ ! public synchronized void close() throws IOException { // cancel synchronization if(syncTask != null) { syncTask.cancel(); } ! unmapFile(); super.close(); } *************** *** 151,164 **** /** * This method forces all data cached in memory but not yet stored in the file, ! * to be stored in it. RrdNioBackend uses (a lot of) memory to cache I/O data. ! * This method is automatically invoked when the {@link #close()} ! * method is called. In other words, you don't have to call sync() before you call close().<p> */ ! public void sync() { if(byteBuffer != null) { ! synchronized(byteBuffer) { ! // System.out.println("** SYNC **"); ! byteBuffer.force(); ! } } } --- 141,149 ---- /** * This method forces all data cached in memory but not yet stored in the file, ! * to be stored in it. */ ! protected synchronized void sync() { if(byteBuffer != null) { ! byteBuffer.force(); } } Index: RrdDb.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDb.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** RrdDb.java 21 Sep 2004 08:42:09 -0000 1.30 --- RrdDb.java 19 Oct 2004 10:14:02 -0000 1.31 *************** *** 421,426 **** public synchronized void close() throws IOException { if(!closed) { - backend.close(); closed = true; } } --- 421,427 ---- public synchronized void close() throws IOException { if(!closed) { closed = true; + backend.beforeClose(); + backend.close(); } } Index: RrdFileBackend.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdFileBackend.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RrdFileBackend.java 18 Oct 2004 13:09:33 -0000 1.10 --- RrdFileBackend.java 19 Oct 2004 10:14:03 -0000 1.11 *************** *** 40,55 **** */ public class RrdFileBackend extends RrdBackend { ! static final long LOCK_DELAY = 100; // 0.1sec private static HashSet openFiles = new HashSet(); ! private boolean readOnly; ! private int lockMode; ! private boolean closed = false; protected RandomAccessFile file; protected FileChannel channel; protected FileLock fileLock; protected RrdFileBackend(String path, boolean readOnly, int lockMode) throws IOException { super(path); --- 40,66 ---- */ public class RrdFileBackend extends RrdBackend { ! private static final long LOCK_DELAY = 100; // 0.1sec private static HashSet openFiles = new HashSet(); ! /** read/write file status */ ! protected boolean readOnly; ! /** locking mode */ ! protected int lockMode; + /** radnom access file handle */ protected RandomAccessFile file; + /** file channel used to create locks */ protected FileChannel channel; + /** file lock */ protected FileLock fileLock; + /** + * Creates RrdFileBackend object for the given file path, backed by RandomAccessFile object. + * @param path Path to a file + * @param readOnly True, if file should be open in a read-only mode. False otherwise + * @param lockMode Locking mode, as described in {@link RrdDb#getLockMode()} + * @throws IOException Thrown in case of I/O error + */ protected RrdFileBackend(String path, boolean readOnly, int lockMode) throws IOException { super(path); *************** *** 112,122 **** */ public void close() throws IOException { ! if (!closed) { ! unregisterWriter(); ! unlockFile(); ! channel.close(); ! file.close(); ! closed = true; ! } } --- 123,130 ---- */ public void close() throws IOException { ! unregisterWriter(); ! unlockFile(); ! channel.close(); ! file.close(); } *************** *** 142,154 **** /** - * Closes the underlying RRD file if not already closed - * - * @throws IOException Thrown in case of I/O error - */ - protected void finalize() throws IOException { - close(); - } - - /** * Returns canonical path to the file on the disk. * --- 150,153 ---- |
From: Sasa M. <sa...@us...> - 2004-10-18 13:09:48
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5788/org/jrobin/core Modified Files: RrdBackend.java RrdFileBackend.java RrdNioBackend.java Log Message: Minor bug removed Index: RrdNioBackend.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdNioBackend.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** RrdNioBackend.java 28 Sep 2004 09:01:31 -0000 1.17 --- RrdNioBackend.java 18 Oct 2004 13:09:33 -0000 1.18 *************** *** 141,147 **** syncTask.cancel(); } ! super.close(); // calls sync() eventually // release the buffer, make it eligible for GC as soon as possible byteBuffer = null; } --- 141,150 ---- syncTask.cancel(); } ! // synchronize with the disk for the last time ! sync(); // release the buffer, make it eligible for GC as soon as possible byteBuffer = null; + // close the underlying file + super.close(); } Index: RrdFileBackend.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdFileBackend.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RrdFileBackend.java 27 Sep 2004 14:11:38 -0000 1.9 --- RrdFileBackend.java 18 Oct 2004 13:09:33 -0000 1.10 *************** *** 36,40 **** * JRobin backend which is used to store RRD data to ordinary files on the disk. This was the * default factory before 1.4.0 version<p> ! * * This backend is based on the RandomAccessFile class (java.io.* package). */ --- 36,40 ---- * JRobin backend which is used to store RRD data to ordinary files on the disk. This was the * default factory before 1.4.0 version<p> ! * <p/> * This backend is based on the RandomAccessFile class (java.io.* package). */ *************** *** 44,47 **** --- 44,51 ---- private static HashSet openFiles = new HashSet(); + private boolean readOnly; + private int lockMode; + private boolean closed = false; + protected RandomAccessFile file; protected FileChannel channel; *************** *** 50,93 **** protected RrdFileBackend(String path, boolean readOnly, int lockMode) throws IOException { super(path); ! file = new RandomAccessFile(path, readOnly? "r": "rw"); channel = file.getChannel(); ! if(!readOnly) { ! // We'll try to lock the file only in "rw" mode ! lockFile(lockMode); ! registerWriter(path); ! } ! } ! ! private static synchronized void registerWriter(String path) throws IOException { ! String canonicalPath = getCanonicalPath(path); ! if(openFiles.contains(canonicalPath)) { ! throw new IOException("File \"" + path + "\" already open for R/W access. " + ! "You cannot open the same file for R/W access twice"); ! } ! else { ! openFiles.add(canonicalPath); ! } } ! private void lockFile(int lockMode) throws IOException { ! if(lockMode == RrdDb.WAIT_IF_LOCKED || lockMode == RrdDb.EXCEPTION_IF_LOCKED) { ! do { fileLock = channel.tryLock(); ! if(fileLock == null) { // could not obtain lock ! if(lockMode == RrdDb.WAIT_IF_LOCKED) { ! // wait a little, than try again try { Thread.sleep(LOCK_DELAY); ! } catch (InterruptedException e) { // NOP } } - else { - throw new IOException("Access denied. " + - "File [" + getPath() + "] already locked"); - } } ! } while(fileLock == null); } } --- 54,106 ---- protected RrdFileBackend(String path, boolean readOnly, int lockMode) throws IOException { super(path); ! this.readOnly = readOnly; ! this.lockMode = lockMode; ! file = new RandomAccessFile(path, readOnly ? "r" : "rw"); channel = file.getChannel(); ! lockFile(); ! registerWriter(); } ! private void lockFile() throws IOException { ! switch (lockMode) { ! case RrdDb.EXCEPTION_IF_LOCKED: fileLock = channel.tryLock(); ! if (fileLock == null) { // could not obtain lock ! throw new IOException("Access denied. " + "File [" + getPath() + "] already locked"); ! } ! break; ! case RrdDb.WAIT_IF_LOCKED: ! while (fileLock == null) { ! fileLock = channel.tryLock(); ! if (fileLock == null) { ! // could not obtain lock, wait a little, than try again try { Thread.sleep(LOCK_DELAY); ! } ! catch (InterruptedException e) { // NOP } } } ! break; ! case RrdDb.NO_LOCKS: ! break; ! } ! } ! ! private void registerWriter() throws IOException { ! if (!readOnly) { ! String path = getPath(); ! String canonicalPath = getCanonicalPath(path); ! synchronized (openFiles) { ! if (openFiles.contains(canonicalPath)) { ! throw new IOException("File \"" + path + "\" already open for R/W access. " + ! "You cannot open the same file for R/W access twice"); ! } ! else { ! openFiles.add(canonicalPath); ! } ! } } } *************** *** 95,117 **** /** * Closes the underlying RRD file. * @throws IOException Thrown in case of I/O error */ public void close() throws IOException { ! super.close(); // calls sync() ! unregisterWriter(getPath()); ! unlockFile(); ! channel.close(); ! file.close(); ! } ! ! private static synchronized void unregisterWriter(String path) throws IOException { ! String canonicalPath = getCanonicalPath(path); ! openFiles.remove(canonicalPath); } private void unlockFile() throws IOException { ! if(fileLock != null) { fileLock.release(); ! fileLock = null; } } --- 108,141 ---- /** * Closes the underlying RRD file. + * * @throws IOException Thrown in case of I/O error */ public void close() throws IOException { ! if (!closed) { ! unregisterWriter(); ! unlockFile(); ! channel.close(); ! file.close(); ! closed = true; ! } } private void unlockFile() throws IOException { ! if (fileLock != null) { fileLock.release(); ! } ! } ! ! private void unregisterWriter() throws IOException { ! if (!readOnly) { ! String path = getPath(); ! String canonicalPath = getCanonicalPath(path); ! synchronized (openFiles) { ! boolean removed = openFiles.remove(canonicalPath); ! if (!removed) { ! throw new IOException("File [" + file + "] could not be removed from the list of files " + ! "open for R/W access"); ! } ! } } } *************** *** 119,122 **** --- 143,147 ---- /** * Closes the underlying RRD file if not already closed + * * @throws IOException Thrown in case of I/O error */ *************** *** 127,130 **** --- 152,156 ---- /** * Returns canonical path to the file on the disk. + * * @param path File path * @return Canonical file path *************** *** 137,140 **** --- 163,167 ---- /** * Returns canonical path to the file on the disk. + * * @return Canonical file path * @throws IOException Thrown in case of I/O error *************** *** 146,151 **** /** * Writes bytes to the underlying RRD file on the disk * @param offset Starting file offset ! * @param b Bytes to be written. * @throws IOException Thrown in case of I/O error */ --- 173,179 ---- /** * Writes bytes to the underlying RRD file on the disk + * * @param offset Starting file offset ! * @param b Bytes to be written. * @throws IOException Thrown in case of I/O error */ *************** *** 157,167 **** /** * Reads a number of bytes from the RRD file on the disk * @param offset Starting file offset ! * @param b Buffer which receives bytes read from the file. * @throws IOException Thrown in case of I/O error. */ protected void read(long offset, byte[] b) throws IOException { file.seek(offset); ! if(file.read(b) != b.length) { throw new IOException("Not enough bytes available in file " + getPath()); } --- 185,196 ---- /** * Reads a number of bytes from the RRD file on the disk + * * @param offset Starting file offset ! * @param b Buffer which receives bytes read from the file. * @throws IOException Thrown in case of I/O error. */ protected void read(long offset, byte[] b) throws IOException { file.seek(offset); ! if (file.read(b) != b.length) { throw new IOException("Not enough bytes available in file " + getPath()); } *************** *** 170,173 **** --- 199,203 ---- /** * Returns RRD file length. + * * @return File length. * @throws IOException Thrown in case of I/O error. *************** *** 180,183 **** --- 210,214 ---- * Sets length of the underlying RRD file. This method is called only once, immediately * after a new RRD file gets created. + * * @param length Length of the RRD file * @throws IOException Thrown in case of I/O error. |
From: Sasa M. <sa...@us...> - 2004-10-13 07:19:18
|
Update of /cvsroot/jrobin/src/org/jrobin/mrtg/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25602/org/jrobin/mrtg/server Modified Files: Server.java Log Message: Minor changes Index: Server.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/mrtg/server/Server.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Server.java 21 Jul 2004 07:10:27 -0000 1.14 --- Server.java 13 Oct 2004 07:18:52 -0000 1.15 *************** *** 292,296 **** hash.put("badSavesCount", new Integer(rrdWriter.getBadSavesCount())); hash.put("startDate", startDate); ! hash.put("poolEfficency", new Double(RrdDbPool.getInstance().getPoolEfficency())); return hash; } --- 292,296 ---- hash.put("badSavesCount", new Integer(rrdWriter.getBadSavesCount())); hash.put("startDate", startDate); ! hash.put("poolEfficency", new Double(RrdDbPool.getInstance().getPoolEfficiency())); return hash; } |
From: Sasa M. <sa...@us...> - 2004-10-13 07:19:15
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25602/org/jrobin/core Modified Files: Util.java Log Message: Minor changes Index: Util.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/Util.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Util.java 2 Sep 2004 11:36:08 -0000 1.23 --- Util.java 13 Oct 2004 07:18:51 -0000 1.24 *************** *** 516,519 **** --- 516,520 ---- String className = Util.class.getName().replace('.', '/'); String uri = Util.class.getResource("/" + className + ".class").toString(); + //System.out.println(uri); if(uri.startsWith("file:/")) { uri = uri.substring(6); *************** *** 526,530 **** } else if(uri.startsWith("jar:file:/")) { ! uri = uri.substring(10, uri.lastIndexOf('!')); File file = new File(uri); // let's go 2 steps backwards --- 527,531 ---- } else if(uri.startsWith("jar:file:/")) { ! uri = uri.substring(9, uri.lastIndexOf('!')); File file = new File(uri); // let's go 2 steps backwards |
From: Sasa M. <sa...@us...> - 2004-09-28 09:01:46
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19466/org/jrobin/core Modified Files: RrdNioBackend.java Log Message: Minor changes Index: RrdNioBackend.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdNioBackend.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** RrdNioBackend.java 27 Sep 2004 14:32:13 -0000 1.16 --- RrdNioBackend.java 28 Sep 2004 09:01:31 -0000 1.17 *************** *** 52,68 **** */ public static final boolean SHOULD_GC = true; - private static final String NIO_CLOSING_THREAD_NAME = "RrdNioBackend closing thread"; - - static { - if(SHOULD_GC) { - final Runtime runtime = Runtime.getRuntime(); - runtime.addShutdownHook(new Thread(NIO_CLOSING_THREAD_NAME) { - public void run() { - runtime.runFinalization(); - runtime.gc(); - } - }); - } - } private static final Timer syncTimer = new Timer(true); --- 52,55 ---- |
From: Sasa M. <sa...@us...> - 2004-09-27 14:32:23
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16873/org/jrobin/core Modified Files: RrdDbPool.java RrdNioBackend.java Log Message: Added shutdown hook to close all open RrdDb files held in the pool when the JVM is about to exit. Added method to close() the pool manualy (it's not harmful to close the file more than once). Index: RrdNioBackend.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdNioBackend.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RrdNioBackend.java 16 Jul 2004 14:16:38 -0000 1.15 --- RrdNioBackend.java 27 Sep 2004 14:32:13 -0000 1.16 *************** *** 52,60 **** */ public static final boolean SHOULD_GC = true; static { if(SHOULD_GC) { final Runtime runtime = Runtime.getRuntime(); ! runtime.addShutdownHook(new Thread() { public void run() { runtime.runFinalization(); --- 52,61 ---- */ public static final boolean SHOULD_GC = true; + private static final String NIO_CLOSING_THREAD_NAME = "RrdNioBackend closing thread"; static { if(SHOULD_GC) { final Runtime runtime = Runtime.getRuntime(); ! runtime.addShutdownHook(new Thread(NIO_CLOSING_THREAD_NAME) { public void run() { runtime.runFinalization(); |
From: Sasa M. <sa...@us...> - 2004-09-27 14:11:55
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12811/org/jrobin/core Modified Files: RrdFileBackend.java Log Message: Added shutdown hook to close all open RrdDb files held in the pool when the JVM is about to exit. Added method to close() the pool manualy (it's not harmful to close the file more than once). |
From: Sasa M. <sa...@us...> - 2004-09-27 13:58:48
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10260/org/jrobin/core Modified Files: RrdDbPool.java Log Message: Added shutdown hook to close all open RrdDb files held in the pool when the JVM is about to exit. Added method to close() the pool manualy (it's not harmful to close the file more than once). Index: RrdDbPool.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDbPool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RrdDbPool.java 23 Sep 2004 13:12:54 -0000 1.15 --- RrdDbPool.java 27 Sep 2004 13:58:36 -0000 1.16 *************** *** 102,108 **** public class RrdDbPool implements Runnable { static final String GC_THREAD_NAME = "RrdDbPool GC thread"; ! private static RrdDbPool ourInstance; private static final boolean DEBUG = false; /** * Constant to represent the maximum number of internally open RRD files --- 102,126 ---- public class RrdDbPool implements Runnable { static final String GC_THREAD_NAME = "RrdDbPool GC thread"; ! static final String CLOSING_THREAD_NAME = "RrdDbPool closing thread"; private static final boolean DEBUG = false; + // singleton pattern + private static RrdDbPool ourInstance; + + static { + Runtime.getRuntime().addShutdownHook(new Thread(CLOSING_THREAD_NAME) { + public void run() { + if(ourInstance != null) { + try { + ourInstance.close(); + } + catch (IOException e) { + e.printStackTrace(); + } + } + } + }); + } + /** * Constant to represent the maximum number of internally open RRD files *************** *** 111,114 **** --- 129,133 ---- public static final int INITIAL_CAPACITY = 500; private int capacity = INITIAL_CAPACITY, maxUsedCapacity; + private boolean active = true; /** *************** *** 166,169 **** --- 185,189 ---- */ public synchronized RrdDb requestRrdDb(String path) throws IOException, RrdException { + proveActive(); poolRequestsCount++; String canonicalPath = getCanonicalPath(path); *************** *** 227,230 **** --- 247,251 ---- private RrdDb requestNewRrdDb(String path, Object creationDef) throws IOException, RrdException { + proveActive(); poolRequestsCount++; String canonicalPath = getCanonicalPath(path); *************** *** 326,329 **** --- 347,351 ---- */ public synchronized void release(RrdDb rrdDb) throws IOException, RrdException { + proveActive(); if (rrdDb == null) { // we don't want NullPointerException *************** *** 354,358 **** public void run() { // debug("GC: started"); ! for (; ;) { synchronized (this) { if (rrdMap.size() >= capacity && rrdIdleMap.size() > 0) { --- 376,380 ---- public void run() { // debug("GC: started"); ! while (active) { synchronized (this) { if (rrdMap.size() >= capacity && rrdIdleMap.size() > 0) { *************** *** 381,385 **** protected void finalize() throws IOException { ! reset(); } --- 403,407 ---- protected void finalize() throws IOException { ! close(); } *************** *** 400,403 **** --- 422,441 ---- } + /** + * Closes the pool and all RRD files currently held in the pool. + * No further operations on the pool are allowed. + * @throws IOException Thrown in case of I/O error. + */ + public synchronized void close() throws IOException { + if(active) { + active = false; + reset(); + // debug("The pool is closed."); + } + else { + // debug("The pool is already closed!"); + } + } + private static String getCanonicalPath(String path) throws IOException { return RrdFileBackend.getCanonicalPath(path); *************** *** 583,587 **** * limit on the number of simultaneously open files), <code>false</code> otherwise. */ ! public boolean isLimitedCapacity() { return limitedCapacity; } --- 621,625 ---- * limit on the number of simultaneously open files), <code>false</code> otherwise. */ ! public synchronized boolean isLimitedCapacity() { return limitedCapacity; } *************** *** 599,605 **** * limit on the number of simultaneously open files), <code>false</code> otherwise. */ ! public void setLimitedCapacity(boolean limitedCapacity) { this.limitedCapacity = limitedCapacity; } } --- 637,658 ---- * limit on the number of simultaneously open files), <code>false</code> otherwise. */ ! public synchronized void setLimitedCapacity(boolean limitedCapacity) { this.limitedCapacity = limitedCapacity; } + + private void proveActive() throws IOException { + if(!active) { + throw new IOException("RrdDbPool is already closed"); + } + } + + /** + * Checks if the pool is active. You can request RrdDb references only from the active pool. The + * pool is deactived when the {@link #close()} method is called. + * @return <code>true</code> if active, <code>false</code> otherwise. + */ + public synchronized boolean isActive() { + return active; + } } |
From: Sasa M. <sa...@us...> - 2004-09-23 13:13:02
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1094/org/jrobin/core Modified Files: RrdDbPool.java Log Message: spelling error corrected in the getPoolEfficiency method name Index: RrdDbPool.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDbPool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RrdDbPool.java 23 Sep 2004 08:45:51 -0000 1.14 --- RrdDbPool.java 23 Sep 2004 13:12:54 -0000 1.15 *************** *** 425,429 **** buff.append("capacity=" + capacity + ", " + "maxUsedCapacity=" + maxUsedCapacity + "\n"); buff.append("hits=" + poolHitsCount + ", " + "requests=" + poolRequestsCount + "\n"); ! buff.append("efficiency=" + getPoolEfficency() + "\n"); if(dumpFiles) { buff.append("---- CACHED FILES ------------------------\n"); --- 425,429 ---- buff.append("capacity=" + capacity + ", " + "maxUsedCapacity=" + maxUsedCapacity + "\n"); buff.append("hits=" + poolHitsCount + ", " + "requests=" + poolRequestsCount + "\n"); ! buff.append("efficiency=" + getPoolEfficiency() + "\n"); if(dumpFiles) { buff.append("---- CACHED FILES ------------------------\n"); *************** *** 537,544 **** * with the number of total RrdDb requests. * ! * @return Pool's efficiency ratio as a double between 1 (best) and 0 (worst). If no RrdDb reference ! * was ever requested, 1 would be returned. */ ! public synchronized double getPoolEfficency() { if (poolRequestsCount == 0) { return 1.0; --- 537,544 ---- * with the number of total RrdDb requests. * ! * @return Pool's efficiency ratio as a double between 1 (best) and 0 (worst). ! * If no RrdDb reference was ever requested, 1 would be returned. */ ! public synchronized double getPoolEfficiency() { if (poolRequestsCount == 0) { return 1.0; |
From: Sasa M. <sa...@us...> - 2004-09-23 08:46:01
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6628/org/jrobin/core Modified Files: RrdDbPool.java Log Message: almost of no importance Index: RrdDbPool.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDbPool.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RrdDbPool.java 1 Sep 2004 07:59:54 -0000 1.13 --- RrdDbPool.java 23 Sep 2004 08:45:51 -0000 1.14 *************** *** 101,104 **** --- 101,105 ---- */ public class RrdDbPool implements Runnable { + static final String GC_THREAD_NAME = "RrdDbPool GC thread"; private static RrdDbPool ourInstance; private static final boolean DEBUG = false; *************** *** 148,152 **** private void startGarbageCollector() { ! Thread gcThread = new Thread(this); gcThread.setPriority(GC_THREAD_PRIORITY); gcThread.setDaemon(true); --- 149,153 ---- private void startGarbageCollector() { ! Thread gcThread = new Thread(this, GC_THREAD_NAME); gcThread.setPriority(GC_THREAD_PRIORITY); gcThread.setDaemon(true); |
Update of /cvsroot/jrobin/src/org/jrobin/graph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv324/org/jrobin/graph Modified Files: ExportData.java FetchSource.java FetchSourceList.java Gprint.java RrdExportDef.java RrdGraphDef.java Sdef.java Log Message: Strings like "AVERAGE" or "GAUGE" replaced with constants like ConsolFuns.AVERAGE and DsTypes.GAUGE. This change does not affect existing JRobin-based code (since constants are defined as Strings). Changes made in org.jrobin.core.* and org.jrobin.graph.* packages Index: RrdExportDef.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdExportDef.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RrdExportDef.java 11 Jul 2004 22:04:13 -0000 1.3 --- RrdExportDef.java 21 Sep 2004 08:42:10 -0000 1.4 *************** *** 183,187 **** * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD ! * file ("AVERAGE", "MIN", "MAX" or "LAST"). */ public void datasource( String name, String file, String dsName, String consolFunc ) throws RrdException --- 183,188 ---- * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD ! * file ("AVERAGE", "MIN", "MAX" or "LAST" - these string constants are conveniently defined ! * in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class). */ public void datasource( String name, String file, String dsName, String consolFunc ) throws RrdException *************** *** 206,210 **** * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD ! * file ("AVERAGE", "MIN", "MAX" or "LAST"). * @param backend Name of the RrdBackendFactory that should be used for this RrdDb. */ --- 207,212 ---- * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD ! * file ("AVERAGE", "MIN", "MAX" or "LAST" - these string constants are conveniently defined ! * in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class). * @param backend Name of the RrdBackendFactory that should be used for this RrdDb. */ Index: FetchSourceList.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/FetchSourceList.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FetchSourceList.java 13 Jul 2004 16:20:07 -0000 1.3 --- FetchSourceList.java 21 Sep 2004 08:42:10 -0000 1.4 *************** *** 276,280 **** * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD ! * file ("AVERAGE", "MIN", "MAX" or "LAST"). * @param backend Name of the RrdBackendFactory that should be used for this RrdDb. * @throws RrdException Thrown in case of a JRobin specific error. --- 276,281 ---- * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD ! * file ("AVERAGE", "MIN", "MAX" or "LAST" - these string constants are conveniently defined ! * in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class). * @param backend Name of the RrdBackendFactory that should be used for this RrdDb. * @throws RrdException Thrown in case of a JRobin specific error. *************** *** 306,310 **** * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD ! * file ("AVERAGE", "MIN", "MAX" or "LAST"). * @throws RrdException Thrown in case of a JRobin specific error. */ --- 307,312 ---- * @param dsName Data source name defined in the RRD file. * @param consolFunc Consolidation function that will be used to extract data from the RRD ! * file ("AVERAGE", "MIN", "MAX" or "LAST" - these string constants are conveniently defined ! * in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class). * @throws RrdException Thrown in case of a JRobin specific error. */ Index: Sdef.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/Sdef.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Sdef.java 11 Jul 2004 22:04:14 -0000 1.3 --- Sdef.java 21 Sep 2004 08:42:10 -0000 1.4 *************** *** 5,17 **** import org.jrobin.core.RrdException; import org.jrobin.core.XmlWriter; /** * <p>Represents a 'static' datasource for a graph. A static datasource is a single value (constant), ! * but can only be the result of applying a consolidation function (AVG, MIN, MAX, LAST, FIRST or TOTAL) ! * to one of the other, already defined, datasources.</p> * * @author Arne Vandamme (cob...@jr...) */ ! class Sdef extends Cdef { // ================================================================ --- 5,19 ---- import org.jrobin.core.RrdException; import org.jrobin.core.XmlWriter; + import org.jrobin.core.ConsolFuns; /** * <p>Represents a 'static' datasource for a graph. A static datasource is a single value (constant), ! * but can only be the result of applying a consolidation function ! * ("AVERAGE", "MIN", "MAX", "LAST", "FIRST" or "TOTAL") to one of the other, ! * already defined, datasources.</p> * * @author Arne Vandamme (cob...@jr...) */ ! class Sdef extends Cdef implements ConsolFuns { // ================================================================ *************** *** 21,25 **** private String defName = ""; ! private String consolFunc = "AVERAGE"; private int aggregate = Source.AGG_AVERAGE; --- 23,27 ---- private String defName = ""; ! private String consolFunc = CF_AVERAGE; private int aggregate = Source.AGG_AVERAGE; *************** *** 48,62 **** // -- Parse the consolidation function to be used ! if ( consolFunc.equalsIgnoreCase("AVERAGE") || consolFunc.equalsIgnoreCase("AVG") ) aggregate = Source.AGG_AVERAGE; ! else if ( consolFunc.equalsIgnoreCase("MAX") || consolFunc.equalsIgnoreCase("MAXIMUM") ) aggregate = Source.AGG_MAXIMUM; ! else if ( consolFunc.equalsIgnoreCase("MIN") || consolFunc.equalsIgnoreCase("MINIMUM") ) aggregate = Source.AGG_MINIMUM; ! else if ( consolFunc.equalsIgnoreCase("LAST") ) aggregate = Source.AGG_LAST; ! else if ( consolFunc.equalsIgnoreCase("FIRST") ) aggregate = Source.AGG_FIRST; ! else if ( consolFunc.equalsIgnoreCase("TOTAL") ) aggregate = Source.AGG_TOTAL; else --- 50,64 ---- // -- Parse the consolidation function to be used ! if ( consolFunc.equalsIgnoreCase(CF_AVERAGE) || consolFunc.equalsIgnoreCase("AVG") ) aggregate = Source.AGG_AVERAGE; ! else if ( consolFunc.equalsIgnoreCase(CF_MAX) || consolFunc.equalsIgnoreCase("MAXIMUM") ) aggregate = Source.AGG_MAXIMUM; ! else if ( consolFunc.equalsIgnoreCase(CF_MIN) || consolFunc.equalsIgnoreCase("MINIMUM") ) aggregate = Source.AGG_MINIMUM; ! else if ( consolFunc.equalsIgnoreCase(CF_LAST) ) aggregate = Source.AGG_LAST; ! else if ( consolFunc.equalsIgnoreCase(CF_FIRST) ) aggregate = Source.AGG_FIRST; ! else if ( consolFunc.equalsIgnoreCase(CF_TOTAL) ) aggregate = Source.AGG_TOTAL; else Index: ExportData.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/ExportData.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ExportData.java 27 Jul 2004 12:30:17 -0000 1.5 --- ExportData.java 21 Sep 2004 08:42:10 -0000 1.6 *************** *** 28,31 **** --- 28,32 ---- import org.jrobin.core.RrdException; import org.jrobin.core.Util; + import org.jrobin.core.ConsolFuns; import org.w3c.dom.Element; import org.w3c.dom.Node; *************** *** 39,43 **** * @author Arne Vandamme (cob...@jr...) */ ! public class ExportData implements RrdDataSet { // ================================================================ --- 40,44 ---- * @author Arne Vandamme (cob...@jr...) */ ! public class ExportData implements RrdDataSet, ConsolFuns { // ================================================================ *************** *** 302,307 **** * @param dsName Datasource name * @param consolFun Consolidation function to be applied to set datasource values datasource. ! * Valid consolidation functions are MIN, MAX, LAST, FIRST, AVERAGE and TOTAL ! * @return MIN, MAX, LAST, FIRST, AVERAGE or TOTAL value calculated from the dataset for the given datasource name * @throws RrdException Thrown if the given datasource name cannot be found in the dataset. */ --- 303,311 ---- * @param dsName Datasource name * @param consolFun Consolidation function to be applied to set datasource values datasource. ! * Valid consolidation functions are "MIN", "MAX", "LAST", "FIRST", "AVERAGE" and "TOTAL" ! * (These constants are conveniently defined in the ! * {@link org.jrobin.core.ConsolFuns ConsolFuns} class). ! * @return MIN, MAX, LAST, FIRST, AVERAGE or TOTAL value calculated from the dataset ! * for the given datasource name * @throws RrdException Thrown if the given datasource name cannot be found in the dataset. */ *************** *** 310,324 **** Source src = getSource( dsName ); ! if( consolFun.equalsIgnoreCase("MAX") ) return src.getAggregate( Source.AGG_MAXIMUM ); ! else if ( consolFun.equalsIgnoreCase("MIN") ) return src.getAggregate( Source.AGG_MINIMUM ); ! else if ( consolFun.equalsIgnoreCase("LAST") ) return src.getAggregate( Source.AGG_LAST); ! else if ( consolFun.equalsIgnoreCase("FIRST") ) return src.getAggregate( Source.AGG_FIRST ); ! else if ( consolFun.equalsIgnoreCase("TOTAL") ) return src.getAggregate( Source.AGG_TOTAL ); ! else if ( consolFun.equalsIgnoreCase("AVERAGE") ) return src.getAggregate( Source.AGG_AVERAGE ); else --- 314,328 ---- Source src = getSource( dsName ); ! if( consolFun.equalsIgnoreCase(CF_MAX) ) return src.getAggregate( Source.AGG_MAXIMUM ); ! else if ( consolFun.equalsIgnoreCase(CF_MIN) ) return src.getAggregate( Source.AGG_MINIMUM ); ! else if ( consolFun.equalsIgnoreCase(CF_LAST) ) return src.getAggregate( Source.AGG_LAST); ! else if ( consolFun.equalsIgnoreCase(CF_FIRST) ) return src.getAggregate( Source.AGG_FIRST ); ! else if ( consolFun.equalsIgnoreCase(CF_TOTAL) ) return src.getAggregate( Source.AGG_TOTAL ); ! else if ( consolFun.equalsIgnoreCase(CF_AVERAGE) ) return src.getAggregate( Source.AGG_AVERAGE ); else *************** *** 342,346 **** * @param sourceName Source name * @param consolFun Consolidation function to be used for calculation ("AVERAGE", ! * "MIN", "MAX", "LAST" or "TOTAL" (since 1.3.1) * @param format Format string. For example: "speed is @5.2 @sbits/sec@c", * "temperature = @0 degrees" --- 346,351 ---- * @param sourceName Source name * @param consolFun Consolidation function to be used for calculation ("AVERAGE", ! * "MIN", "MAX", "LAST" or "TOTAL" (since 1.3.1) - These constants are conveniently ! * defined in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class. * @param format Format string. For example: "speed is @5.2 @sbits/sec@c", * "temperature = @0 degrees" *************** *** 367,371 **** * @param sourceName Source name * @param consolFun Consolidation function to be used for calculation ("AVERAGE", ! * "MIN", "MAX", "LAST" or "TOTAL" (since 1.3.1) * @param format Format string. For example: "speed is @5.2 @sbits/sec@c", * "temperature = @0 degrees" --- 372,377 ---- * @param sourceName Source name * @param consolFun Consolidation function to be used for calculation ("AVERAGE", ! * "MIN", "MAX", "LAST" or "TOTAL" (since 1.3.1) - These constants are conveniently ! * defined in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class. * @param format Format string. For example: "speed is @5.2 @sbits/sec@c", * "temperature = @0 degrees" Index: FetchSource.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/FetchSource.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** FetchSource.java 25 Jul 2004 12:28:49 -0000 1.10 --- FetchSource.java 21 Sep 2004 08:42:10 -0000 1.11 *************** *** 39,43 **** * @author Arne Vandamme (cob...@jr...) */ ! class FetchSource { // ================================================================ --- 39,43 ---- * @author Arne Vandamme (cob...@jr...) */ ! class FetchSource implements ConsolFuns { // ================================================================ *************** *** 50,54 **** protected static final int MAX_CF = 4; ! protected static final String[] cfNames = new String[] { "AVERAGE", "MAX", "MIN", "LAST" }; private RrdDb rrd; --- 50,56 ---- protected static final int MAX_CF = 4; ! protected static final String[] cfNames = new String[] { ! CF_AVERAGE, CF_MAX, CF_MIN, CF_LAST ! }; private RrdDb rrd; *************** *** 131,141 **** protected void addSource( String consolFunc, String dsName, String name ) throws RrdException { ! if ( consolFunc.equalsIgnoreCase("AVERAGE") || consolFunc.equalsIgnoreCase("AVG") ) datasources[AVG].add( new String[] { dsName, name } ); ! else if ( consolFunc.equalsIgnoreCase("MAX") || consolFunc.equalsIgnoreCase("MAXIMUM") ) datasources[MAX].add( new String[] { dsName, name } ); ! else if ( consolFunc.equalsIgnoreCase("MIN") || consolFunc.equalsIgnoreCase("MINIMUM") ) datasources[MIN].add( new String[] { dsName, name } ); ! else if ( consolFunc.equalsIgnoreCase("LAST") ) datasources[LAST].add( new String[] { dsName, name } ); else --- 133,143 ---- protected void addSource( String consolFunc, String dsName, String name ) throws RrdException { ! if ( consolFunc.equalsIgnoreCase(CF_AVERAGE) || consolFunc.equalsIgnoreCase("AVG") ) datasources[AVG].add( new String[] { dsName, name } ); ! else if ( consolFunc.equalsIgnoreCase(CF_MAX) || consolFunc.equalsIgnoreCase("MAXIMUM") ) datasources[MAX].add( new String[] { dsName, name } ); ! else if ( consolFunc.equalsIgnoreCase(CF_MIN) || consolFunc.equalsIgnoreCase("MINIMUM") ) datasources[MIN].add( new String[] { dsName, name } ); ! else if ( consolFunc.equalsIgnoreCase(CF_LAST) ) datasources[LAST].add( new String[] { dsName, name } ); else Index: Gprint.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/Gprint.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Gprint.java 11 Jul 2004 22:04:13 -0000 1.7 --- Gprint.java 21 Sep 2004 08:42:10 -0000 1.8 *************** *** 32,35 **** --- 32,36 ---- import org.jrobin.core.RrdException; import org.jrobin.core.XmlWriter; + import org.jrobin.core.ConsolFuns; /** *************** *** 39,43 **** * @author Sasa Markovic (sa...@jr...) */ ! class Gprint extends Comment { // ================================================================ --- 40,44 ---- * @author Sasa Markovic (sa...@jr...) */ ! class Gprint extends Comment implements ConsolFuns { // ================================================================ *************** *** 66,71 **** * Constructs a Gprint object based on a string of text (with a specific placement * marker in), a source from which to retrieve a value, and a consolidation function that ! * specifies which value to retrieve. Possible consolidation functions are <code>AVERAGE, MAX, MIN, FIRST, LAST</code> ! * and <code>TOTAL</code>. * @param sourceName Name of the datasource from which to retrieve the consolidated value. * @param consolFunc Consolidation function to use. --- 67,74 ---- * Constructs a Gprint object based on a string of text (with a specific placement * marker in), a source from which to retrieve a value, and a consolidation function that ! * specifies which value to retrieve. Possible consolidation functions are ! * <code>"AVERAGE", "MAX", "MIN", "FIRST", "LAST"</code> ! * and <code>"TOTAL"</code> - these string constants are conveniently defined ! * in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class. * @param sourceName Name of the datasource from which to retrieve the consolidated value. * @param consolFunc Consolidation function to use. *************** *** 82,96 **** this.sourceName = sourceName; ! if ( consolFunc.equalsIgnoreCase("AVERAGE") || consolFunc.equalsIgnoreCase("AVG") ) aggregate = Source.AGG_AVERAGE; ! else if ( consolFunc.equalsIgnoreCase("MAX") || consolFunc.equalsIgnoreCase("MAXIMUM") ) aggregate = Source.AGG_MAXIMUM; ! else if ( consolFunc.equalsIgnoreCase("MIN") || consolFunc.equalsIgnoreCase("MINIMUM") ) aggregate = Source.AGG_MINIMUM; ! else if ( consolFunc.equalsIgnoreCase("LAST") ) aggregate = Source.AGG_LAST; ! else if ( consolFunc.equalsIgnoreCase("FIRST") ) aggregate = Source.AGG_FIRST; ! else if ( consolFunc.equalsIgnoreCase("TOTAL") ) aggregate = Source.AGG_TOTAL; else --- 85,99 ---- this.sourceName = sourceName; ! if ( consolFunc.equalsIgnoreCase(CF_AVERAGE) || consolFunc.equalsIgnoreCase("AVG") ) aggregate = Source.AGG_AVERAGE; ! else if ( consolFunc.equalsIgnoreCase(CF_MAX) || consolFunc.equalsIgnoreCase("MAXIMUM") ) aggregate = Source.AGG_MAXIMUM; ! else if ( consolFunc.equalsIgnoreCase(CF_MIN) || consolFunc.equalsIgnoreCase("MINIMUM") ) aggregate = Source.AGG_MINIMUM; ! else if ( consolFunc.equalsIgnoreCase(CF_LAST) ) aggregate = Source.AGG_LAST; ! else if ( consolFunc.equalsIgnoreCase(CF_FIRST) ) aggregate = Source.AGG_FIRST; ! else if ( consolFunc.equalsIgnoreCase(CF_TOTAL) ) aggregate = Source.AGG_TOTAL; else Index: RrdGraphDef.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdGraphDef.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** RrdGraphDef.java 11 Jul 2004 22:04:13 -0000 1.19 --- RrdGraphDef.java 21 Sep 2004 08:42:10 -0000 1.20 *************** *** 907,911 **** * @param sourceName Graph source name * @param consolFun Consolidation function to be used for calculation ("AVERAGE", ! * "MIN", "MAX", "LAST" or "TOTAL" (since 1.3.1) * @param format Format string. For example: "speed is @5.2 @sbits/sec@c", * "temperature = @0 degrees" --- 907,912 ---- * @param sourceName Graph source name * @param consolFun Consolidation function to be used for calculation ("AVERAGE", ! * "MIN", "MAX", "LAST" or "TOTAL" (since 1.3.1) - these string constants are conveniently ! * defined in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class. * @param format Format string. For example: "speed is @5.2 @sbits/sec@c", * "temperature = @0 degrees" *************** *** 926,930 **** * @param sourceName Graph source name * @param consolFun Consolidation function to be used for calculation ("AVERAGE", "MIN", "MAX", "LAST" ! * or "TOTAL" (since 1.3.1) * @param format Format string. For example: "speed is @5.2 @sbits/sec@c", "temperature = @0 degrees" * @param base Base value for the formatting, defaults to the graphing base value --- 927,932 ---- * @param sourceName Graph source name * @param consolFun Consolidation function to be used for calculation ("AVERAGE", "MIN", "MAX", "LAST" ! * or "TOTAL" (since 1.3.1) - these string constants are conveniently defined ! * in the {@link org.jrobin.core.ConsolFuns ConsolFuns} class. * @param format Format string. For example: "speed is @5.2 @sbits/sec@c", "temperature = @0 degrees" * @param base Base value for the formatting, defaults to the graphing base value |