org.jrobin.core
Class FetchRequest

java.lang.Object
  extended by org.jrobin.core.FetchRequest

public class FetchRequest
extends Object

Class to represent fetch request. For the complete explanation of all fetch parameters consult RRDTool's rrdfetch man page. You cannot create FetchRequest directly (no public constructor is provided). Use createFetchRequest() method of your RrdDb object.


Method Summary
 String dump()
          Dumps the content of fetch request using the syntax of RRDTool's fetch command.
 FetchPoint[] fetch()
          Deprecated. As of version 1.2.0 replaced with fetchData().
 FetchData fetchData()
          Returns data from the underlying RRD and puts it in a single FetchData object.
 String getConsolFun()
          Returns consolitation function to be used during the fetch process.
 long getFetchEnd()
          Returns ending timestamp to be used for the fetch request.
 long getFetchStart()
          Returns starting timestamp to be used for the fetch request.
 String[] getFilter()
          Returns request filter.
 RrdDb getParentDb()
          Returns the underlying RrdDb object.
 long getResolution()
          Returns fetch resolution to be used for the fetch request.
 void setFilter(String filter)
          Sets request filter in order to fetch data only for a single datasource (datasource name).
 void setFilter(String[] filter)
          Sets request filter in order to fetch data only for the specified array of datasources (datasource names).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setFilter

public void setFilter(String[] filter)
Sets request filter in order to fetch data only for the specified array of datasources (datasource names). If not set (or set to null), fetched data will containt values of all datasources defined in the corresponding RRD. To fetch data only from selected datasources, specify an array of datasource names as method argument.

Parameters:
filter - Array of datsources (datsource names) to fetch data from.

setFilter

public void setFilter(String filter)
Sets request filter in order to fetch data only for a single datasource (datasource name). If not set (or set to null), fetched data will containt values of all datasources defined in the corresponding RRD. To fetch data for a single datasource only, specify an array of datasource names as method argument.

Parameters:
filter - Array of datsources (datsource names) to fetch data from.

getFilter

public String[] getFilter()
Returns request filter. See setFilter() for complete explanation.

Returns:
Request filter (array of datasource names), null if not set.

getConsolFun

public String getConsolFun()
Returns consolitation function to be used during the fetch process.

Returns:
Consolidation function.

getFetchStart

public long getFetchStart()
Returns starting timestamp to be used for the fetch request.

Returns:
Starting timstamp in seconds.

getFetchEnd

public long getFetchEnd()
Returns ending timestamp to be used for the fetch request.

Returns:
Ending timestamp in seconds.

getResolution

public long getResolution()
Returns fetch resolution to be used for the fetch request.

Returns:
Fetch resolution in seconds.

dump

public String dump()
Dumps the content of fetch request using the syntax of RRDTool's fetch command.

Returns:
Fetch request dump.

fetch

public FetchPoint[] fetch()
                   throws RrdException,
                          IOException
Deprecated. As of version 1.2.0 replaced with fetchData().

Returns data from the underlying RRD as an array of FetchPoint objects. Each fetch point object represents RRD datasource values for the specific timestamp. Timestamp difference between consecutive fecth points is guaranteed to be constant.

Returns:
Array of fetch points.
Throws:
RrdException - Thrown in case of JRobin specific error.
IOException - Thrown in case of I/O error.

fetchData

public FetchData fetchData()
                    throws RrdException,
                           IOException
Returns data from the underlying RRD and puts it in a single FetchData object. Use this method instead of deprecated fetch() method.

Returns:
FetchPoint object filled with timestamps and datasource values.
Throws:
RrdException - Thrown in case of JRobin specific error.
IOException - Thrown in case of I/O error.

getParentDb

public RrdDb getParentDb()
Returns the underlying RrdDb object.

Returns:
RrdDb object used to create this FetchRequest object.