org.jrobin.core
Interface RrdDataSet

All Known Implementing Classes:
ExportData, FetchData

public interface RrdDataSet

Interface to represent a JRobin dataset. A dataset is nothing but a table of datasources, indexed by equidistant timestamps. A dataset allows access to the internal datasources with aggregatoin methods.


Method Summary
 java.lang.String exportXml()
          Dumps the dataset to XML.
 void exportXml(java.io.OutputStream outputStream)
          Dumps fetch data to output stream in XML format.
 void exportXml(java.lang.String filepath)
          Dumps dataset to file in XML format.
 double getAggregate(java.lang.String dsName, java.lang.String consolFun)
          Returns aggregated value from the dataset for a single datasource.
 int getColumnCount()
          Returns the number of columns in this dataset.
 int getDsIndex(java.lang.String dsName)
          Retrieve the table index number of a datasource by name.
 java.lang.String[] getDsNames()
          Returns array of the names of all datasources in the set.
 long getFirstTimestamp()
          Returns the first timestamp in the dataset.
 long getLastTimestamp()
          Returns the last timestamp in the dataset.
 int getRowCount()
          Returns the number of rows in this dataset.
 long getStep()
          Returns the step of these datasources.
 long[] getTimestamps()
          Returns an array of timestamps covering the whole range specified in the dataset object.
 double[][] getValues()
          Returns all values for all datasources, the returned values correspond to the timestamps returned with the getTimestamps() method.
 double[] getValues(int dsIndex)
          Returns all values for a single datasource, the returned values correspond to the timestamps returned with the getTimestamps() method.
 double[] getValues(java.lang.String dsName)
          Returns all values for a single datasource, the returned values correspond to the timestamps returned with the getTimestamps() method.
 

Method Detail

getRowCount

int getRowCount()
Returns the number of rows in this dataset.

Returns:
Number of rows (data samples).

getColumnCount

int getColumnCount()
Returns the number of columns in this dataset.

Returns:
Number of columns (datasources).

getTimestamps

long[] getTimestamps()
Returns an array of timestamps covering the whole range specified in the dataset object.

Returns:
Array of equidistant timestamps.

getValues

double[] getValues(int dsIndex)
Returns all values for a single datasource, the returned values correspond to the timestamps returned with the getTimestamps() method.

Parameters:
dsIndex - Datasource index.
Returns:
Array of single datasource values.

getValues

double[][] getValues()
Returns all values for all datasources, the returned values correspond to the timestamps returned with the getTimestamps() method.

Returns:
Two-dimensional aray of all datasource values.

getValues

double[] getValues(java.lang.String dsName)
                   throws RrdException
Returns all values for a single datasource, the returned values correspond to the timestamps returned with the getTimestamps() method.

Parameters:
dsName - Datasource name.
Returns:
Array of single datasource values.
Throws:
RrdException - Thrown if no matching datasource name is found.

getFirstTimestamp

long getFirstTimestamp()
Returns the first timestamp in the dataset.

Returns:
The smallest timestamp.

getLastTimestamp

long getLastTimestamp()
Returns the last timestamp in the dataset.

Returns:
The biggest timestamp.

getDsNames

java.lang.String[] getDsNames()
Returns array of the names of all datasources in the set.

Returns:
Array of datasource names.

getDsIndex

int getDsIndex(java.lang.String dsName)
               throws RrdException
Retrieve the table index number of a datasource by name. Names are case sensitive.

Parameters:
dsName - Name of the datasource for which to find the index.
Returns:
Index number of the datasource in the value table.
Throws:
RrdException - Thrown if the given datasource name cannot be found in the dataset.

getStep

long getStep()
Returns the step of these datasources.

Returns:
Step as long.

getAggregate

double getAggregate(java.lang.String dsName,
                    java.lang.String consolFun)
                    throws RrdException
Returns aggregated value from the dataset for a single datasource.

Parameters:
dsName - Datasource name
consolFun - Consolidation function to be applied to set datasource values datasource. Valid consolidation functions are MIN, MAX, LAST and AVERAGE
Returns:
MIN, MAX, LAST or AVERAGE value calculated from the dataset for the given datasource name
Throws:
RrdException - Thrown if the given datasource name cannot be found in the dataset.

exportXml

void exportXml(java.io.OutputStream outputStream)
               throws RrdException,
                      java.io.IOException
Dumps fetch data to output stream in XML format.

Parameters:
outputStream - Output stream to dump dataset to
Throws:
RrdException - Thrown in case of JRobin specific error.
java.io.IOException - Thrown in case of I/O error

exportXml

void exportXml(java.lang.String filepath)
               throws RrdException,
                      java.io.IOException
Dumps dataset to file in XML format.

Parameters:
filepath - Path to destination file
Throws:
RrdException - Thrown in case of JRobin specific error.
java.io.IOException - Thrown in case of I/O error

exportXml

java.lang.String exportXml()
                           throws RrdException,
                                  java.io.IOException
Dumps the dataset to XML.

Returns:
XML string format of the dataset.
Throws:
RrdException - Thrown in case of JRobin specific error.
java.io.IOException - Thrown in case of an I/O related error.