public class JniRrdStrategy extends Object implements RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
Modifier and Type | Class and Description |
---|---|
static class |
JniRrdStrategy.CreateCommand |
Constructor and Description |
---|
JniRrdStrategy()
Initialized the JNI Interface
|
Modifier and Type | Method and Description |
---|---|
void |
closeFile(StringBuffer rrd)
The 'closes' the rrd file.
|
JniRrdStrategy.CreateCommand |
createDefinition(String creator,
String directory,
String rrdName,
int step,
List<RrdDataSource> dataSources,
List<String> rraList)
Create a round robin database definition from the supplied parameters.
|
void |
createFile(JniRrdStrategy.CreateCommand createCommand,
Map<String,String> attributeMappings)
Creates a the rrd file from the rrdDefinition.
|
InputStream |
createGraph(String command,
File workDir)
Creates an InputStream representing the bytes of a graph created from
round robin data.
|
RrdGraphDetails |
createGraphReturnDetails(String command,
File workDir)
Creates an RrdGraphDetails object representing the graph created from
round robin data.
|
Double |
fetchLastValue(String rrdFile,
String ds,
int interval)
Fetches the last value from the round robin database with the given name.
|
Double |
fetchLastValue(String rrdFile,
String ds,
String consolidationFunction,
int interval)
Fetches the last value from the round robin database with the given name.
|
Double |
fetchLastValueInRange(String rrdFile,
String ds,
int interval,
int range)
Fetches the last value from the round robin database with the given name
within a time range.
|
Properties |
getConfigurationProperties()
getConfigurationProperties
|
String |
getDefaultFileExtension()
getDefaultFileExtension
|
int |
getGraphLeftOffset()
getGraphLeftOffset
|
int |
getGraphRightOffset()
getGraphRightOffset
|
int |
getGraphTopOffsetWithText()
getGraphTopOffsetWithText
|
String |
getStats()
No stats are kept for this implementation.
|
StringBuffer |
openFile(String fileName)
Opens the round robin database with the supplied name.
|
void |
promoteEnqueuedFiles(Collection<String> rrdFiles)
In the event that this is a queuing implementation of the RrdStrategy.
|
void |
setConfigurationProperties(Properties configurationParameters)
setConfigurationProperties
|
void |
updateFile(StringBuffer rrd,
String owner,
String data)
Updates the supplied round robin database with the given timestamp:value
point
|
public Properties getConfigurationProperties()
getConfigurationProperties
Properties
object.public void setConfigurationProperties(Properties configurationParameters)
setConfigurationProperties
setConfigurationProperties
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
configurationParameters
- a Properties
object.public void closeFile(StringBuffer rrd) throws Exception
closeFile
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
rrd
- a StringBuffer
object.Exception
- if any.public JniRrdStrategy.CreateCommand createDefinition(String creator, String directory, String rrdName, int step, List<RrdDataSource> dataSources, List<String> rraList) throws Exception
createDefinition
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
creator
- - A string representing who is creating this file for use in
log msgsdirectory
- - The directory to create the file inrrdName
- - The name to use for the round robin databasestep
- - the step for the databasedataSources
- - the data sources to use for round robin databaserraList
- - a List of the round robin archives to create in the
database. defines after which time the data is condensed to a
defined lower stepException
- If an error occurs while creating the definitionpublic void createFile(JniRrdStrategy.CreateCommand createCommand, Map<String,String> attributeMappings) throws Exception
createFile
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
createCommand
- a String
object.attributeMappings
- a Map
that represents the mapping of
attributeId to rrd track names. default there is only one
track per datasource, but it is possible to store multiple
tracks in one datasourceException
- if any.public StringBuffer openFile(String fileName) throws Exception
openFile
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
fileName
- the name of the associated rrd fileException
- if an error occurs opening the filepublic void updateFile(StringBuffer rrd, String owner, String data) throws Exception
updateFile
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
rrd
- an rrd object created using openFileowner
- the owner of the rrddata
- a string of the form Exception
- if an error occurs updating the filepublic Double fetchLastValue(String rrdFile, String ds, int interval) throws NumberFormatException, RrdException
fetchLastValue
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
rrdFile
- a name the represents a round robin databaseds
- a name the represents a data source to be usedinterval
- a step interval of the round robin databaseNumberFormatException
- if any.RrdException
- if any.public Double fetchLastValue(String rrdFile, String ds, String consolidationFunction, int interval)
fetchLastValue
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
rrdFile
- a name the represents a round robin databaseds
- a name the represents a data source to be usedconsolidationFunction
- a String
object.interval
- a step interval of the round robin databasepublic Double fetchLastValueInRange(String rrdFile, String ds, int interval, int range) throws NumberFormatException, RrdException
fetchLastValueInRange
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
rrdFile
- a name the represents a round robin databaseds
- a name the represents a data source to be usedinterval
- a step interval of the round robin databaserange
- an acceptable range for which the last value will be returnedNumberFormatException
- if any.RrdException
- if any.public InputStream createGraph(String command, File workDir) throws IOException, RrdException
createGraph
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
command
- the command needed to create the graphworkDir
- the directory that all referenced files are relative toIOException
- if an IOError occursRrdException
- if an RRD error occurspublic String getStats()
getStats
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
String
object.public int getGraphLeftOffset()
getGraphLeftOffset
getGraphLeftOffset
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
public int getGraphRightOffset()
getGraphRightOffset
getGraphRightOffset
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
public int getGraphTopOffsetWithText()
getGraphTopOffsetWithText
getGraphTopOffsetWithText
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
public String getDefaultFileExtension()
getDefaultFileExtension
getDefaultFileExtension
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
String
object.public RrdGraphDetails createGraphReturnDetails(String command, File workDir) throws IOException, RrdException
createGraphReturnDetails
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
command
- the command needed to create the graphworkDir
- the directory that all referenced files are relative toIOException
- if an IOError occursRrdException
- if an RRD error occurspublic void promoteEnqueuedFiles(Collection<String> rrdFiles)
promoteEnqueuedFiles
in interface RrdStrategy<JniRrdStrategy.CreateCommand,StringBuffer>
rrdFiles
- a Collection
object.Copyright © 2015. All rights reserved.