From: Arne V. <cob...@us...> - 2004-06-29 09:34:54
|
Update of /cvsroot/jrobin/src/org/jrobin/graph In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4435/org/jrobin/graph Modified Files: FetchSource.java FetchSourceList.java Grapher.java RrdGraph.java RrdGraphDef.java TimeAxisLabel.java Log Message: JRobin 1.4.0 - Moved RrdOpener to core package - Fixed Javadoc comments - Fixed 0 end timestamp Index: Grapher.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/Grapher.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Grapher.java 9 Jun 2004 07:35:36 -0000 1.13 --- Grapher.java 29 Jun 2004 09:34:39 -0000 1.14 *************** *** 379,383 **** if ( changingEndTime ) { ! endTime = src.getLastSampleTime( endTime ); if ( endTime > finalEndTime ) --- 379,383 ---- if ( changingEndTime ) { ! endTime = src.getLastSampleTime( startTime, endTime, graphDef.getResolution() ); if ( endTime > finalEndTime ) Index: FetchSourceList.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/FetchSourceList.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FetchSourceList.java 9 Jun 2004 07:43:15 -0000 1.1 --- FetchSourceList.java 29 Jun 2004 09:34:39 -0000 1.2 *************** *** 31,34 **** --- 31,35 ---- import org.jrobin.core.RrdException; import org.jrobin.core.RrdDb; + import org.jrobin.core.RrdOpener; /** *************** *** 248,253 **** /** ! * Adds a datasource for graphing purposes to the list, ! * {@see RrdGraphDef#datasource( java.lang.String, java.lang.String, * java.lang.String, java.lang.String, java.lang.String )}. --- 249,254 ---- /** ! * Adds a datasource for graphing purposes to the list, see ! * {@link RrdGraphDef#datasource( java.lang.String, java.lang.String, * java.lang.String, java.lang.String, java.lang.String )}. *************** *** 278,283 **** /** ! * Adds a datasource for graphing purposes to the list, ! * {@see RrdGraphDef#datasource( java.lang.String, java.lang.String, * java.lang.String, java.lang.String )}. * --- 279,284 ---- /** ! * Adds a datasource for graphing purposes to the list, see ! * {@link RrdGraphDef#datasource( java.lang.String, java.lang.String, * java.lang.String, java.lang.String )}. * Index: RrdGraph.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdGraph.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RrdGraph.java 9 Jun 2004 07:35:36 -0000 1.9 --- RrdGraph.java 29 Jun 2004 09:34:39 -0000 1.10 *************** *** 25,29 **** package org.jrobin.graph; - import javax.swing.JPanel; import java.util.Iterator; import java.io.File; --- 25,28 ---- *************** *** 41,48 **** import java.awt.*; ! import org.jrobin.core.RrdDb; ! import org.jrobin.core.RrdDbPool; import org.jrobin.core.RrdException; - import org.jrobin.core.RrdBackendFactory; /** --- 40,45 ---- import java.awt.*; ! import org.jrobin.core.RrdOpener; import org.jrobin.core.RrdException; /** Index: TimeAxisLabel.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/TimeAxisLabel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TimeAxisLabel.java 1 Mar 2004 08:50:25 -0000 1.3 --- TimeAxisLabel.java 29 Jun 2004 09:34:39 -0000 1.4 *************** *** 53,60 **** if ( !super.isCompleteLine() ) { oList.add( "" ); ! oList.add( super.TKN_ACF ); oList.add( "" ); ! oList.add( super.TKN_ALF ); this.lineCount += 2; --- 53,60 ---- if ( !super.isCompleteLine() ) { oList.add( "" ); ! oList.add( TimeAxisLabel.TKN_ACF ); oList.add( "" ); ! oList.add( TimeAxisLabel.TKN_ALF ); this.lineCount += 2; Index: FetchSource.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/FetchSource.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FetchSource.java 9 Jun 2004 07:35:36 -0000 1.6 --- FetchSource.java 29 Jun 2004 09:34:39 -0000 1.7 *************** *** 53,56 **** --- 53,57 ---- private RrdDb rrd; + private RrdDef rrdDef; private String rrdFile; // Holds the name of the RRD file *************** *** 172,176 **** String[] dsNames, vNames; ! long rrdStep = rrd.getRrdDef().getStep(); FetchData[] result = new FetchData[datasources.length]; --- 173,177 ---- String[] dsNames, vNames; ! long rrdStep = rrdDef.getStep(); FetchData[] result = new FetchData[datasources.length]; *************** *** 182,186 **** dsSize = datasources[i].size(); ! if ( dsSize > 0 ) { // Set the list of ds names dsNames = new String[ dsSize ]; --- 183,188 ---- dsSize = datasources[i].size(); ! if ( dsSize > 0 ) ! { // Set the list of ds names dsNames = new String[ dsSize ]; *************** *** 223,227 **** if ( rrd == null ) { ! RrdOpener opener = listReference.getRrdOpener(); if ( opener == null ) --- 225,229 ---- if ( rrd == null ) { ! org.jrobin.core.RrdOpener opener = listReference.getRrdOpener(); if ( opener == null ) *************** *** 231,234 **** --- 233,238 ---- if ( rrd == null ) rrd = opener.getRrd( rrdFile, getRrdBackendFactory() ); + + rrdDef = rrd.getRrdDef(); } } *************** *** 263,267 **** if ( rrd != null ) { ! RrdOpener opener = listReference.getRrdOpener(); if ( opener == null ) --- 267,271 ---- if ( rrd != null ) { ! org.jrobin.core.RrdOpener opener = listReference.getRrdOpener(); if ( opener == null ) *************** *** 280,296 **** * timestamp of the last non-unknown sample! * * @param endTime Timestamp for which the last sample time should be calculated. * @return Last sample timestamp in seconds. * @throws IOException Thrown in case of fetching I/O error. * @throws RrdException Thrown in case of a JRobin specific error. */ ! protected long getLastSampleTime( long endTime ) throws RrdException, IOException { if ( rrd == null ) openRrd(); ! long step = rrd.getRrdDef().getStep(); ! return endTime = rrd.getLastUpdateTime() - (endTime % step) - step; } --- 284,313 ---- * timestamp of the last non-unknown sample! * + * @param startTime Timestamp for which the last sample time should be calculated. * @param endTime Timestamp for which the last sample time should be calculated. + * @param resolution Last timestamp for this particular fetch resolution. * @return Last sample timestamp in seconds. * @throws IOException Thrown in case of fetching I/O error. * @throws RrdException Thrown in case of a JRobin specific error. */ ! protected long getLastSampleTime( long startTime, long endTime, long resolution ) throws RrdException, IOException { if ( rrd == null ) openRrd(); ! long maxSampleTime = 0, sampleTime = 0; ! for ( int i = 0; i < datasources.length; i++ ) ! { ! if ( datasources[i].size() > 0 ) ! { ! sampleTime = rrd.findStartMatchArchive( cfNames[i], startTime, resolution ).getEndTime(); ! if ( sampleTime > maxSampleTime ) ! maxSampleTime = sampleTime; ! } ! } ! ! // Remove a single sample step (we'll add it again later on) ! return maxSampleTime - rrdDef.getStep(); } Index: RrdGraphDef.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/graph/RrdGraphDef.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RrdGraphDef.java 9 Jun 2004 07:35:36 -0000 1.15 --- RrdGraphDef.java 29 Jun 2004 09:34:39 -0000 1.16 *************** *** 586,590 **** /** ! * This sets the lower limit of the grid to the specified value {@see setGridRange}. * This is the equivalent of: <code>setGridRange( lower, Double.NaN, false );</code> * @param lower Lower limit. --- 586,590 ---- /** ! * This sets the lower limit of the grid to the specified value, see {@link RrdGraphDef#setGridRange(double, double, boolean)}. * This is the equivalent of: <code>setGridRange( lower, Double.NaN, false );</code> * @param lower Lower limit. *************** *** 704,708 **** * <p>Clears the list of RRD datasources for this GraphDef and sets it to the FetchSourceList * passed as aparameter. This does not alter any Cdef, Sdef or Pdef definitions. The datasources ! * should be passed on as a FetchSourceList {@see FetchSourceList}.</p> * @param datasourceList FetchSourceList of the datasources to use. */ --- 704,708 ---- * <p>Clears the list of RRD datasources for this GraphDef and sets it to the FetchSourceList * passed as aparameter. This does not alter any Cdef, Sdef or Pdef definitions. The datasources ! * should be passed on as a FetchSourceList {@link FetchSourceList}.</p> * @param datasourceList FetchSourceList of the datasources to use. */ *************** *** 1131,1137 **** /** ! * Exports RrdGraphDef (graph definition) object in XML format to string. ! * Generated code can be parsed with {@link RrdGraphDefTemplate} class ! * {@see exportXmlTemplate}. * * @return String representing graph definition in XML format --- 1131,1137 ---- /** ! * Exports RrdGraphDef (graph definition) object in XML format to string. ! * Generated code can be parsed with {@link RrdGraphDefTemplate} class, see ! * {@link RrdGraphDef#exportXmlTemplate()}. * * @return String representing graph definition in XML format *************** *** 1140,1143 **** --- 1140,1144 ---- return exportXmlTemplate(); } + /** * Exports RrdGraphDef (graph definition) object in XML format to string. |