org.jrobin.core

Class Datasource

public class Datasource extends Object implements RrdUpdater, DsTypes

Class to represent single datasource within RRD. Each datasource object holds the following information: datasource definition (once set, never changed) and datasource state variables (changed whenever RRD gets updated).

Normally, you don't need to manipluate Datasource objects directly, it's up to JRobin framework to do it for you.

Method Summary
voidcopyStateTo(RrdUpdater other)
Copies object's internal state to another Datasource object.
doublegetAccumValue()
Returns value this datasource accumulated so far.
intgetDsIndex()
Returns index of this Datasource object in the RRD.
StringgetDsName()
Returns datasource name.
StringgetDsType()
Returns datasource type (GAUGE, COUNTER, DERIVE, ABSOLUTE).
longgetHeartbeat()
Returns datasource heartbeat
doublegetLastValue()
Returns last known value of the datasource.
doublegetMaxValue()
Returns maximal allowed value for this datasource.
doublegetMinValue()
Returns mimimal allowed value for this datasource.
longgetNanSeconds()
Returns the number of accumulated NaN seconds.
RrdAllocatorgetRrdAllocator()
Required to implement RrdUpdater interface.
RrdBackendgetRrdBackend()
Returns the underlying storage (backend) object which actually performs all I/O operations.
voidsetDsName(String newDsName)
Sets datasource name to a new value
voidsetDsType(String newDsType)
voidsetHeartbeat(long heartbeat)
Sets datasource heartbeat to a new value.
voidsetMaxValue(double maxValue, boolean filterArchivedValues)
Sets maximum allowed value for this datasource.
voidsetMinMaxValue(double minValue, double maxValue, boolean filterArchivedValues)
Sets min/max values allowed for this datasource.
voidsetMinValue(double minValue, boolean filterArchivedValues)
Sets minimum allowed value for this datasource.

Method Detail

copyStateTo

public void copyStateTo(RrdUpdater other)
Copies object's internal state to another Datasource object.

Parameters: other New Datasource object to copy state to

Throws: IOException Thrown in case of I/O error RrdException Thrown if supplied argument is not a Datasource object

getAccumValue

public double getAccumValue()
Returns value this datasource accumulated so far.

Returns: Accumulated datasource value.

Throws: IOException Thrown in case of I/O error

getDsIndex

public int getDsIndex()
Returns index of this Datasource object in the RRD.

Returns: Datasource index in the RRD.

Throws: IOException Thrown in case of I/O error

getDsName

public String getDsName()
Returns datasource name.

Returns: Datasource name

Throws: IOException Thrown in case of I/O error

getDsType

public String getDsType()
Returns datasource type (GAUGE, COUNTER, DERIVE, ABSOLUTE).

Returns: Datasource type.

Throws: IOException Thrown in case of I/O error

getHeartbeat

public long getHeartbeat()
Returns datasource heartbeat

Returns: Datasource heartbeat

Throws: IOException Thrown in case of I/O error

getLastValue

public double getLastValue()
Returns last known value of the datasource.

Returns: Last datasource value.

Throws: IOException Thrown in case of I/O error

getMaxValue

public double getMaxValue()
Returns maximal allowed value for this datasource.

Returns: Maximal value allowed.

Throws: IOException Thrown in case of I/O error

getMinValue

public double getMinValue()
Returns mimimal allowed value for this datasource.

Returns: Minimal value allowed.

Throws: IOException Thrown in case of I/O error

getNanSeconds

public long getNanSeconds()
Returns the number of accumulated NaN seconds.

Returns: Accumulated NaN seconds.

Throws: IOException Thrown in case of I/O error

getRrdAllocator

public RrdAllocator getRrdAllocator()
Required to implement RrdUpdater interface. You should never call this method directly.

Returns: Allocator object

getRrdBackend

public RrdBackend getRrdBackend()
Returns the underlying storage (backend) object which actually performs all I/O operations.

Returns: I/O backend object

setDsName

public void setDsName(String newDsName)
Sets datasource name to a new value

Parameters: newDsName New datasource name

Throws: RrdException Thrown if invalid data source name is specified (name too long, or name already defined in the RRD IOException Thrown in case of I/O error

setDsType

public void setDsType(String newDsType)

setHeartbeat

public void setHeartbeat(long heartbeat)
Sets datasource heartbeat to a new value.

Parameters: heartbeat New heartbeat value

Throws: IOException Thrown in case of I/O error RrdException Thrown if invalid (non-positive) heartbeat value is specified.

setMaxValue

public void setMaxValue(double maxValue, boolean filterArchivedValues)
Sets maximum allowed value for this datasource. If filterArchivedValues argment is set to true, all archived values greater then maxValue will be fixed to NaN.

Parameters: maxValue New maximal value. Specify Double.NaN if no max value should be set. filterArchivedValues true, if archived datasource values should be fixed; false, otherwise.

Throws: IOException Thrown in case of I/O error RrdException Thrown if invalid maxValue was supplied (not greater then minValue)

setMinMaxValue

public void setMinMaxValue(double minValue, double maxValue, boolean filterArchivedValues)
Sets min/max values allowed for this datasource. If filterArchivedValues argment is set to true, all archived values less then minValue or greater then maxValue will be fixed to NaN.

Parameters: minValue New minimal value. Specify Double.NaN if no min value should be set. maxValue New maximal value. Specify Double.NaN if no max value should be set. filterArchivedValues true, if archived datasource values should be fixed; false, otherwise.

Throws: IOException Thrown in case of I/O error RrdException Thrown if invalid min/max values were supplied

setMinValue

public void setMinValue(double minValue, boolean filterArchivedValues)
Sets minimum allowed value for this datasource. If filterArchivedValues argment is set to true, all archived values less then minValue will be fixed to NaN.

Parameters: minValue New minimal value. Specify Double.NaN if no minimal value should be set filterArchivedValues true, if archived datasource values should be fixed; false, otherwise.

Throws: IOException Thrown in case of I/O error RrdException Thrown if invalid minValue was supplied (not less then maxValue)