|
From: <sa...@us...> - 2003-10-06 10:45:19
|
Update of /cvsroot/jrobin/src/jrobin/core
In directory sc8-pr-cvs1:/tmp/cvs-serv6772/jrobin/core
Modified Files:
ArcState.java Archive.java Datasource.java Header.java
Robin.java RrdDb.java
Log Message:
Javadoc added for classes and methods made public
Index: ArcState.java
===================================================================
RCS file: /cvsroot/jrobin/src/jrobin/core/ArcState.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ArcState.java 6 Oct 2003 08:50:59 -0000 1.3
--- ArcState.java 6 Oct 2003 10:45:04 -0000 1.4
***************
*** 25,29 ****
import java.io.IOException;
! // TODO: Fix javadoc, class made public
public class ArcState implements RrdUpdater {
private Archive parentArc;
--- 25,35 ----
import java.io.IOException;
! /**
! * Class to represent internal RRD archive state for a single datasource. Objects of this
! * class are never manipulated directly, it's up to JRobin framework to manage
! * internal arcihve states.<p>
! *
! * @author <a href="mailto:sa...@eu...">Sasa Markovic</a>
! */
public class ArcState implements RrdUpdater {
private Archive parentArc;
***************
*** 50,53 ****
--- 56,63 ----
}
+ /**
+ * Returns the underlying RrdFile object.
+ * @return Underlying RrdFile object.
+ */
public RrdFile getRrdFile() {
return parentArc.getParentDb().getRrdFile();
***************
*** 62,65 ****
--- 72,81 ----
}
+ /**
+ * Returns the number of currently accumulated NaN steps.
+ *
+ * @return Number of currently accumulated NaN steps.
+ * @throws IOException Thrown in case of IO specific error
+ */
public long getNanSteps() throws IOException {
return nanSteps.get();
***************
*** 70,75 ****
--- 86,106 ----
}
+ /**
+ * Returns the value accumulated so far.
+ *
+ * @return Accumulated value
+ * @throws IOException Thrown in case of IO specific error
+ */
public double getAccumValue() throws IOException {
return accumValue.get();
+ }
+
+ /**
+ * Returns the Archive object to which this ArcState object belongs.
+ *
+ * @return Parent Archive object.
+ */
+ public Archive getParent() {
+ return parentArc;
}
Index: Archive.java
===================================================================
RCS file: /cvsroot/jrobin/src/jrobin/core/Archive.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Archive.java 6 Oct 2003 08:50:59 -0000 1.4
--- Archive.java 6 Oct 2003 10:45:04 -0000 1.5
***************
*** 25,29 ****
import java.io.IOException;
! // TODO: FIX JAVADOC, CLASS MADE PUBLIC
public class Archive implements RrdUpdater {
private RrdDb parentDb;
--- 25,39 ----
import java.io.IOException;
! /**
! * Class to represent single RRD archive in a RRD file with its internal state.
! * Normally, you don't need methods to manipulate archive objects directly
! * because JRobin framework does it automatically for you.<p>
! *
! * Each archive object consists of three parts: archive definition, archive state objects
! * (one state object for each datasource) and round robin archives (one round robin for
! * each datasource). API (read-only) is provided to access each of theese parts.<p>
! *
! * @author <a href="mailto:sa...@eu...">Sasa Markovic</a>
! */
public class Archive implements RrdUpdater {
private RrdDb parentDb;
***************
*** 90,93 ****
--- 100,110 ----
}
+ /**
+ * Returns archive time step in seconds. Archive step is equal to RRD file step
+ * multiplied with the number of archive steps.
+ *
+ * @return Archive time step in seconds
+ * @throws IOException Thrown in case of IO error
+ */
public long getArcStep() throws IOException {
long step = parentDb.getHeader().getStep();
***************
*** 111,114 ****
--- 128,135 ----
}
+ /**
+ * Returns the underlying RrdFile object.
+ * @return Underlying RrdFile object
+ */
public RrdFile getRrdFile() {
return parentDb.getRrdFile();
***************
*** 185,204 ****
--- 206,250 ----
}
+ /**
+ * Returns archive consolidation function (AVERAGE, MIN, MAX or LAST).
+ * @return Archive consolidation function.
+ * @throws IOException Thrown in case of IO related error
+ */
public String getConsolFun() throws IOException {
return consolFun.get();
}
+ /**
+ * Returns archive X-files factor.
+ * @return Archive X-files factor (between 0 and 1).
+ * @throws IOException Thrown in case of IO related error
+ */
public double getXff() throws IOException {
return xff.get();
}
+ /**
+ * Returns the number of archive steps.
+ * @return Number of archive steps.
+ * @throws IOException Thrown in case of IO related error
+ */
public int getSteps() throws IOException {
return steps.get();
}
+ /**
+ * Returns the number of archive rows.
+ * @return Number of archive rows.
+ * @throws IOException Thrown in case of IO related error
+ */
public int getRows() throws IOException{
return rows.get();
}
+ /**
+ * Returns current starting timestamp. This value is not constant.
+ * @return Timestamp corresponding to the first archive row
+ * @throws IOException Thrown in case of IO related error
+ */
public long getStartTime() throws IOException {
long endTime = getEndTime();
***************
*** 208,211 ****
--- 254,262 ----
}
+ /**
+ * Returns current ending timestamp. This value is not constant.
+ * @return Timestamp corresponding to the last archive row
+ * @throws IOException Thrown in case of IO related error
+ */
public long getEndTime() throws IOException {
long arcStep = getArcStep();
***************
*** 214,221 ****
--- 265,285 ----
}
+ /**
+ * Returns the underlying archive state object. Each datasource has its
+ * corresponding ArcState object (archive states are managed independently
+ * for each RRD datasource).
+ * @param dsIndex Datasource index
+ * @return Underlying archive state object
+ */
public ArcState getArcState(int dsIndex) {
return states[dsIndex];
}
+ /**
+ * Returns the underlying round robin archive. Robins are used to store actual
+ * archive values on a per-datasource basis.
+ * @param dsIndex Index of the datasource in the RRD file.
+ * @return Underlying round robin archive for the given datasource.
+ */
public Robin getRobin(int dsIndex) {
return robins[dsIndex];
Index: Datasource.java
===================================================================
RCS file: /cvsroot/jrobin/src/jrobin/core/Datasource.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Datasource.java 6 Oct 2003 08:50:59 -0000 1.4
--- Datasource.java 6 Oct 2003 10:45:04 -0000 1.5
***************
*** 26,30 ****
--- 26,37 ----
/**
+ * Class to represent single datasource within RRD file. Each datasource object holds the
+ * following information: datasource definition (once set, never changed) and
+ * datasource state variables (changed whenever RRD file gets updated).<p>
+ *
+ * Normally, you don't need to manipluate Datasource objects directly, it's up to
+ * JRobin framework to do it for you.
*
+ * @author <a href="mailto:sa...@eu...">Sasa Markovic</a>
*/
public class Datasource implements RrdUpdater {
***************
*** 85,120 ****
--- 92,178 ----
}
+ /**
+ * Returns the underlying RrdFile object.
+ * @return Underlying RrdFile object.
+ */
public RrdFile getRrdFile() {
return parentDb.getRrdFile();
}
+ /**
+ * Returns datasource name.
+ * @return Datasource name
+ * @throws IOException Thrown in case of IO related error
+ */
public String getDsName() throws IOException {
return dsName.get();
}
+ /**
+ * Returns datasource type (GAUGE, COUNTER, DERIVE, ABSOLUTE).
+ *
+ * @return Datasource type.
+ * @throws IOException Thrown in case of IO related error
+ */
public String getDsType() throws IOException {
return dsType.get();
}
+ /**
+ * Returns datasource heartbeat
+ *
+ * @return Datasource heartbeat
+ * @throws IOException Thrown in case of IO related error
+ */
public long getHeartbeat() throws IOException {
return heartbeat.get();
}
+ /**
+ * Returns mimimal allowed value of the datasource.
+ *
+ * @return Minimal value allowed.
+ * @throws IOException Thrown in case of IO related error
+ */
public double getMinValue() throws IOException {
return minValue.get();
}
+ /**
+ * Returns maximal allowed value of the datasource.
+ *
+ * @return Maximal value allowed.
+ * @throws IOException Thrown in case of IO related error
+ */
public double getMaxValue() throws IOException {
return maxValue.get();
}
+ /**
+ * Returns last known value of the datasource.
+ *
+ * @return Last datasource value.
+ * @throws IOException Thrown in case of IO related error
+ */
public double getLastValue() throws IOException {
return lastValue.get();
}
+ /**
+ * Returns value this datasource accumulated so far.
+ *
+ * @return Accumulated datasource value.
+ * @throws IOException Thrown in case of IO related error
+ */
public double getAccumValue() throws IOException {
return accumValue.get();
}
+ /**
+ * Returns the number of accumulated NaN seconds.
+ *
+ * @return Accumulated NaN seconds.
+ * @throws IOException Thrown in case of IO related error
+ */
public long getNanSeconds() throws IOException {
return nanSeconds.get();
Index: Header.java
===================================================================
RCS file: /cvsroot/jrobin/src/jrobin/core/Header.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Header.java 6 Oct 2003 08:50:59 -0000 1.3
--- Header.java 6 Oct 2003 10:45:04 -0000 1.4
***************
*** 25,32 ****
import java.io.IOException;
- // TODO: Fix javadoc, class made public!
-
/**
*
*/
public class Header implements RrdUpdater {
--- 25,37 ----
import java.io.IOException;
/**
+ * Class to represent RRD file header. Header information is mainly static (once set, it
+ * cannot be changed), with the exception of last update time (this value is changed whenever
+ * RRD file gets updated).<p>
+ *
+ * Normally, you don't need to manipulate the Header object directly - JRobin framework
+ * does it for you.<p>
*
+ * @author <a href="mailto:sa...@eu...">Sasa Markovic</a>*
*/
public class Header implements RrdUpdater {
***************
*** 75,94 ****
--- 80,131 ----
}
+ /**
+ * Returns RRD file signature. The returned string will be always
+ * of the form <b><i>JRobin, version x.x</i></b>. Note: RRD file format did not
+ * change since Jrobin 1.0.0 release (and probably never will).
+ *
+ * @return RRD file signature
+ * @throws IOException Thrown in case of IO specific error
+ */
public String getSignature() throws IOException {
return signature.get();
}
+ /**
+ * Returns the last update time of the RRD file.
+ *
+ * @return Timestamp (Unix epoch, no milliseconds) corresponding to the last update time.
+ * @throws IOException Thrown in case of IO specific error
+ */
public long getLastUpdateTime() throws IOException {
return lastUpdateTime.get();
}
+ /**
+ * Returns primary RRD file time step.
+ *
+ * @return Primary time step in seconds
+ * @throws IOException Thrown in case of IO specific error
+ */
public long getStep() throws IOException {
return step.get();
}
+ /**
+ * Returns the number of datasources defined in the RRD file.
+ *
+ * @return Number of datasources defined
+ * @throws IOException Thrown in case of IO specific error
+ */
public int getDsCount() throws IOException {
return dsCount.get();
}
+ /**
+ * Returns the number of archives defined in the RRD file.
+ *
+ * @return Number of archives defined
+ * @throws IOException Thrown in case of IO specific error
+ */
public int getArcCount() throws IOException {
return arcCount.get();
***************
*** 108,111 ****
--- 145,153 ----
}
+ /**
+ * Returns the underlying RrdFile object.
+ *
+ * @return Underlying RrdFile object.
+ */
public RrdFile getRrdFile() {
return parentDb.getRrdFile();
Index: Robin.java
===================================================================
RCS file: /cvsroot/jrobin/src/jrobin/core/Robin.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Robin.java 6 Oct 2003 08:50:59 -0000 1.2
--- Robin.java 6 Oct 2003 10:45:04 -0000 1.3
***************
*** 25,36 ****
import java.io.IOException;
! // TODO: Fix javadoc, class made public
public class Robin implements RrdUpdater {
-
private Archive parentArc;
-
private RrdInt pointer;
private RrdDouble values;
-
private int rows;
--- 25,44 ----
import java.io.IOException;
! /**
! * Class to represent archive values for a single datasource. Robin class is the heart of
! * the so-called "round robin database" concept. Basically, each Robin object is a
! * fixed length array of double values. Each double value reperesents consolidated archive
! * value for the specific timestamp. When the underlying array of double values gets completely
! * filled, new values will replace the oldest entries.<p>
! *
! * Robin object does not hold values in memory - such object could be quite large.
! * Instead of it, Robin stores all values on the disk and reads them only when necessary.
! *
! * @author <a href="mailto:sa...@eu...">Sasa Markovic</a>
! */
public class Robin implements RrdUpdater {
private Archive parentArc;
private RrdInt pointer;
private RrdDouble values;
private int rows;
***************
*** 48,51 ****
--- 56,65 ----
}
+ /**
+ * Fetches all Robin archive values from the disk.
+ *
+ * @return Array of double archive values, starting from the oldest one.
+ * @throws IOException Thrown in case of IO specific error.
+ */
public double[] getValues() throws IOException {
double[] result = new double[rows];
***************
*** 63,66 ****
--- 77,84 ----
}
+ /**
+ * Returns the underlying RrdFile object.
+ * @return Underlying RrdFile object
+ */
public RrdFile getRrdFile() {
return parentArc.getRrdFile();
***************
*** 77,83 ****
}
! double getValue(int index) throws IOException {
assert(index < rows);
return values.get((pointer.get() + index) % rows);
}
--- 95,124 ----
}
! /**
! * Returns the i-th value from the Robin archive.
! * @param index Value index
! * @return Value stored in the i-th position (the oldest value has zero index)
! */
! public double getValue(int index) throws IOException {
assert(index < rows);
return values.get((pointer.get() + index) % rows);
+ }
+
+ /**
+ * Returns the Archive object to which this Robin object belongs.
+ *
+ * @return Parent Archive object
+ */
+ public Archive getParent() {
+ return parentArc;
+ }
+
+ /**
+ * Returns the size of the underlying array of archive values.
+ *
+ * @return Number of stored values
+ */
+ public int getSize() {
+ return rows;
}
Index: RrdDb.java
===================================================================
RCS file: /cvsroot/jrobin/src/jrobin/core/RrdDb.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** RrdDb.java 6 Oct 2003 08:50:59 -0000 1.6
--- RrdDb.java 6 Oct 2003 10:45:04 -0000 1.7
***************
*** 243,255 ****
}
! // 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];
--- 243,268 ----
}
! /**
! * Returns RRD file header.
! * @return Header object
! */
public Header getHeader() {
return header;
}
+ /**
+ * Returns Datasource object for the given datasource index.
+ * @param dsIndex Datasource index (zero based)
+ * @return Datasource object
+ */
public Datasource getDatasource(int dsIndex) {
return datasources[dsIndex];
}
+ /**
+ * Returns Archive object for the given archive index.
+ * @param arcIndex Archive index (zero based)
+ * @return Archive object
+ */
public Archive getArchive(int arcIndex) {
return archives[arcIndex];
|