Package org.jrobin.core
Class DsDef
- java.lang.Object
-
- org.jrobin.core.DsDef
-
- All Implemented Interfaces:
DsTypes
public class DsDef extends Object implements DsTypes
Class to represent single data source definition within the RRD. Datasource definition consists of the following five elements:- data source name
- data soruce type
- heartbeat
- minimal value
- maximal value
For the complete explanation of all source definition parameters, see RRDTool's rrdcreate man page.
- Author:
- Sasa Markovic
-
-
Field Summary
Fields Modifier and Type Field Description static String[]
DS_TYPES
array of valid source types(package private) static String
FORCE_ZEROS_FOR_NANS_SUFFIX
-
Fields inherited from interface org.jrobin.core.DsTypes
DT_ABSOLUTE, DT_COUNTER, DT_DERIVE, DT_GAUGE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
dump()
Returns string representing source definition (RRDTool format).boolean
equals(Object obj)
Checks if two datasource definitions are equal.(package private) boolean
exactlyEqual(DsDef def)
String
getDsName()
Returns data source name.String
getDsType()
Returns source type.long
getHeartbeat()
Returns source heartbeat.double
getMaxValue()
Returns maximal calculated source value.double
getMinValue()
Returns minimal calculated source value.int
hashCode()
static boolean
isValidDsType(String dsType)
Checks if function argument represents valid source type.String
toString()
-
-
-
Field Detail
-
DS_TYPES
public static final String[] DS_TYPES
array of valid source types
-
FORCE_ZEROS_FOR_NANS_SUFFIX
static final String FORCE_ZEROS_FOR_NANS_SUFFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DsDef
public DsDef(String dsName, String dsType, long heartbeat, double minValue, double maxValue) throws RrdException
Creates new data source definition object. This object should be passed as argument toaddDatasource()
method ofRrdDb
object.For the complete explanation of all source definition parameters, see RRDTool's rrdcreate man page.
IMPORTANT NOTE: If datasource name ends with '!', corresponding archives will never store NaNs as datasource values. In that case, NaN datasource values will be silently replaced with zeros by the framework.
- Parameters:
dsName
- Data source name.dsType
- Data source type. Valid values are "COUNTER", "GAUGE", "DERIVE" and "ABSOLUTE" (these string constants are conveniently defined in theDsTypes
class).heartbeat
- HearbeatminValue
- Minimal value. UseDouble.NaN
if unknown.maxValue
- Maximal value. UseDouble.NaN
if unknown.- Throws:
RrdException
- Thrown if any parameter has illegal value.
-
-
Method Detail
-
getDsName
public String getDsName()
Returns data source name.- Returns:
- Data source name.
-
getDsType
public String getDsType()
Returns source type.- Returns:
- Source type ("COUNTER", "GAUGE", "DERIVE" or "ABSOLUTE").
-
getHeartbeat
public long getHeartbeat()
Returns source heartbeat.- Returns:
- Source heartbeat.
-
getMinValue
public double getMinValue()
Returns minimal calculated source value.- Returns:
- Minimal value.
-
getMaxValue
public double getMaxValue()
Returns maximal calculated source value.- Returns:
- Maximal value.
-
isValidDsType
public static boolean isValidDsType(String dsType)
Checks if function argument represents valid source type.- Parameters:
dsType
- Source type to be checked.- Returns:
true
ifdsType
is valid type,false
otherwise.
-
dump
public String dump()
Returns string representing source definition (RRDTool format).- Returns:
- String containing all data source definition parameters.
-
equals
public boolean equals(Object obj)
Checks if two datasource definitions are equal. Source definitions are treated as equal if they have the same source name. It is not possible to create RRD with two equal archive definitions.
-
exactlyEqual
boolean exactlyEqual(DsDef def)
-
-