Update of /cvsroot/jrobin/src/jrobin/core In directory sc8-pr-cvs1:/tmp/cvs-serv23539/jrobin/core Modified Files: ArcState.java Archive.java Datasource.java Header.java Robin.java RrdDb.java RrdException.java Log Message: More methods (getters) exposed. Necessary for jrobin.inspector package (but could be useful for other developers too) Index: ArcState.java =================================================================== RCS file: /cvsroot/jrobin/src/jrobin/core/ArcState.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ArcState.java 24 Sep 2003 11:32:24 -0000 1.2 --- ArcState.java 6 Oct 2003 08:50:59 -0000 1.3 *************** *** 25,32 **** import java.io.IOException; ! /** ! * ! */ ! class ArcState implements RrdUpdater { private Archive parentArc; --- 25,30 ---- import java.io.IOException; ! // TODO: Fix javadoc, class made public ! public class ArcState implements RrdUpdater { private Archive parentArc; *************** *** 64,68 **** } ! long getNanSteps() throws IOException { return nanSteps.get(); } --- 62,66 ---- } ! public long getNanSteps() throws IOException { return nanSteps.get(); } *************** *** 72,76 **** } ! double getAccumValue() throws IOException { return accumValue.get(); } --- 70,74 ---- } ! public double getAccumValue() throws IOException { return accumValue.get(); } Index: Archive.java =================================================================== RCS file: /cvsroot/jrobin/src/jrobin/core/Archive.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Archive.java 29 Sep 2003 13:27:52 -0000 1.3 --- Archive.java 6 Oct 2003 08:50:59 -0000 1.4 *************** *** 25,33 **** import java.io.IOException; ! /** ! * ! */ ! class Archive implements RrdUpdater { ! RrdDb parentDb; // definition private RrdString consolFun; --- 25,31 ---- import java.io.IOException; ! // TODO: FIX JAVADOC, CLASS MADE PUBLIC ! public class Archive implements RrdUpdater { ! private RrdDb parentDb; // definition private RrdString consolFun; *************** *** 92,96 **** } ! long getArcStep() throws IOException { long step = parentDb.getHeader().getStep(); return step * steps.get(); --- 90,94 ---- } ! public long getArcStep() throws IOException { long step = parentDb.getHeader().getStep(); return step * steps.get(); *************** *** 187,207 **** } ! String getConsolFun() throws IOException { return consolFun.get(); } ! double getXff() throws IOException { return xff.get(); } ! int getSteps() throws IOException { return steps.get(); } ! int getRows() throws IOException{ return rows.get(); } ! long getStartTime() throws IOException { long endTime = getEndTime(); long arcStep = getArcStep(); --- 185,205 ---- } ! public String getConsolFun() throws IOException { return consolFun.get(); } ! public double getXff() throws IOException { return xff.get(); } ! public int getSteps() throws IOException { return steps.get(); } ! public int getRows() throws IOException{ return rows.get(); } ! public long getStartTime() throws IOException { long endTime = getEndTime(); long arcStep = getArcStep(); *************** *** 210,217 **** } ! long getEndTime() throws IOException { long arcStep = getArcStep(); long lastUpdateTime = parentDb.getHeader().getLastUpdateTime(); return Util.normalize(lastUpdateTime, arcStep); } --- 208,223 ---- } ! public long getEndTime() throws IOException { long arcStep = getArcStep(); long lastUpdateTime = parentDb.getHeader().getLastUpdateTime(); return Util.normalize(lastUpdateTime, arcStep); + } + + public ArcState getArcState(int dsIndex) { + return states[dsIndex]; + } + + public Robin getRobin(int dsIndex) { + return robins[dsIndex]; } Index: Datasource.java =================================================================== RCS file: /cvsroot/jrobin/src/jrobin/core/Datasource.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Datasource.java 29 Sep 2003 13:27:53 -0000 1.3 --- Datasource.java 6 Oct 2003 08:50:59 -0000 1.4 *************** *** 28,32 **** * */ ! class Datasource implements RrdUpdater { private RrdDb parentDb; // definition --- 28,32 ---- * */ ! public class Datasource implements RrdUpdater { private RrdDb parentDb; // definition *************** *** 89,110 **** } ! String getDsName() throws IOException { return dsName.get(); } ! String getDsType() throws IOException { return dsType.get(); } ! long getHeartbeat() throws IOException { return heartbeat.get(); } ! double getMinValue() throws IOException { return minValue.get(); } ! double getMaxValue() throws IOException { return maxValue.get(); } --- 89,122 ---- } ! public String getDsName() throws IOException { return dsName.get(); } ! public String getDsType() throws IOException { return dsType.get(); } ! public long getHeartbeat() throws IOException { return heartbeat.get(); } ! public double getMinValue() throws IOException { return minValue.get(); } ! public double getMaxValue() throws IOException { return maxValue.get(); + } + + public double getLastValue() throws IOException { + return lastValue.get(); + } + + public double getAccumValue() throws IOException { + return accumValue.get(); + } + + public long getNanSeconds() throws IOException { + return nanSeconds.get(); } Index: Header.java =================================================================== RCS file: /cvsroot/jrobin/src/jrobin/core/Header.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Header.java 24 Sep 2003 11:32:24 -0000 1.2 --- Header.java 6 Oct 2003 08:50:59 -0000 1.3 *************** *** 25,32 **** import java.io.IOException; /** * */ ! class Header implements RrdUpdater { static final String SIGNATURE = "JRobin, version 0.1"; static final String RRDTOOL_VERSION = "0001"; --- 25,34 ---- import java.io.IOException; + // TODO: Fix javadoc, class made public! + /** * */ ! public class Header implements RrdUpdater { static final String SIGNATURE = "JRobin, version 0.1"; static final String RRDTOOL_VERSION = "0001"; *************** *** 39,45 **** private RrdLong lastUpdateTime; ! Header(RrdDb parentDb) throws IOException { this.parentDb = parentDb; signature = new RrdString(this); step = new RrdLong(this); dsCount = new RrdInt(this); --- 41,50 ---- private RrdLong lastUpdateTime; ! Header(RrdDb parentDb) throws IOException, RrdException { this.parentDb = parentDb; signature = new RrdString(this); + if(!signature.get().equals(SIGNATURE)) { + throw new RrdException("Not a JRobin RRD file"); + } step = new RrdLong(this); dsCount = new RrdInt(this); *************** *** 70,90 **** } ! String getSignature() throws IOException { return signature.get(); } ! long getLastUpdateTime() throws IOException { return lastUpdateTime.get(); } ! long getStep() throws IOException { return step.get(); } ! int getDsCount() throws IOException { return dsCount.get(); } ! int getArcCount() throws IOException { return arcCount.get(); } --- 75,95 ---- } ! public String getSignature() throws IOException { return signature.get(); } ! public long getLastUpdateTime() throws IOException { return lastUpdateTime.get(); } ! public long getStep() throws IOException { return step.get(); } ! public int getDsCount() throws IOException { return dsCount.get(); } ! public int getArcCount() throws IOException { return arcCount.get(); } Index: Robin.java =================================================================== RCS file: /cvsroot/jrobin/src/jrobin/core/Robin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Robin.java 4 Sep 2003 13:26:41 -0000 1.1 --- Robin.java 6 Oct 2003 08:50:59 -0000 1.2 *************** *** 25,32 **** import java.io.IOException; ! /** ! * ! */ ! class Robin implements RrdUpdater { private Archive parentArc; --- 25,30 ---- import java.io.IOException; ! // TODO: Fix javadoc, class made public ! public class Robin implements RrdUpdater { private Archive parentArc; *************** *** 50,54 **** } ! double[] getValues() throws IOException { double[] result = new double[rows]; int start = pointer.get(); --- 48,52 ---- } ! public double[] getValues() throws IOException { double[] result = new double[rows]; int start = pointer.get(); Index: RrdDb.java =================================================================== RCS file: /cvsroot/jrobin/src/jrobin/core/RrdDb.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RrdDb.java 29 Sep 2003 11:25:05 -0000 1.5 --- RrdDb.java 6 Oct 2003 08:50:59 -0000 1.6 *************** *** 135,154 **** public RrdDb(String path) throws IOException, RrdException { ! initializeSetup(path); ! // restore header ! header = new Header(this); ! // restore datasources ! int dsCount = header.getDsCount(); ! datasources = new Datasource[dsCount]; ! for(int i = 0; i < dsCount; i++) { ! datasources[i] = new Datasource(this); } ! // restore archives ! int arcCount = header.getArcCount(); ! archives = new Archive[arcCount]; ! for(int i = 0; i < arcCount; i++) { ! archives[i] = new Archive(this); } - finalizeSetup(false); } --- 135,159 ---- public RrdDb(String path) throws IOException, RrdException { ! try { ! initializeSetup(path); ! // restore header ! header = new Header(this); ! // restore datasources ! int dsCount = header.getDsCount(); ! datasources = new Datasource[dsCount]; ! for(int i = 0; i < dsCount; i++) { ! datasources[i] = new Datasource(this); ! } ! // restore archives ! int arcCount = header.getArcCount(); ! archives = new Archive[arcCount]; ! for(int i = 0; i < arcCount; i++) { ! archives[i] = new Archive(this); ! } ! finalizeSetup(false); } ! catch(RuntimeException e) { ! throw new RrdException(e); } } *************** *** 238,243 **** } ! Header getHeader() { return header; } --- 243,257 ---- } ! // TODO: ADD JAVADOC for methods made public! ! public Header getHeader() { return header; + } + + public Datasource getDatasource(int dsIndex) { + return datasources[dsIndex]; + } + + public Archive getArchive(int arcIndex) { + return archives[arcIndex]; } Index: RrdException.java =================================================================== RCS file: /cvsroot/jrobin/src/jrobin/core/RrdException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RrdException.java 4 Sep 2003 13:26:41 -0000 1.1 --- RrdException.java 6 Oct 2003 08:50:59 -0000 1.2 *************** *** 41,43 **** --- 41,47 ---- } + public RrdException(Exception e) { + super(e); + } + } |