public class JRobinRrdStrategy extends Object implements RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>
| Constructor and Description |
|---|
JRobinRrdStrategy()
Initialized the RrdDb to use the FILE factory because the NIO factory
uses too much memory for our implementation.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addVdefDs(org.jrobin.graph.RrdGraphDef graphDef,
String sourceName,
String[] rhs,
double start,
double end,
Map<String,List<String>> defs) |
void |
closeFile(org.jrobin.core.RrdDb rrdFile)
Closes the JRobin RrdDb.
|
org.jrobin.core.RrdDef |
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(org.jrobin.core.RrdDef rrdDef)
Creates the JRobin RrdDb from the def by opening the file and then
closing.
|
InputStream |
createGraph(String command,
File workDir)
Creates an InputStream representing the bytes of a graph created from
round robin data.
|
protected org.jrobin.graph.RrdGraphDef |
createGraphDef(File workDir,
String[] inputArray)
createGraphDef
|
RrdGraphDetails |
createGraphReturnDetails(String command,
File workDir)
Creates an RrdGraphDetails object representing the graph created from
round robin data.
|
static char[] |
escapeIfNotPathSepInDEF(char encountered,
char escaped,
StringBuffer currToken)
escapeIfNotPathSepInDEF
|
Double |
fetchLastValue(String fileName,
String ds,
int interval)
Fetches the last value from the round robin database with the given name.
|
Double |
fetchLastValue(String fileName,
String ds,
String consolidationFunction,
int interval)
Fetches the last value from the round robin database with the given name.
|
Double |
fetchLastValueInRange(String fileName,
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()
This implementation does not track any stats.
|
org.jrobin.core.RrdDb |
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
|
static String[] |
tokenizeWithQuotingAndEscapes(String line,
String delims,
boolean processQuoted)
tokenizeWithQuotingAndEscapes
|
static String[] |
tokenizeWithQuotingAndEscapes(String line,
String delims,
boolean processQuoted,
String tokens)
|
void |
updateFile(org.jrobin.core.RrdDb rrdFile,
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<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>configurationParameters - a Properties object.public void closeFile(org.jrobin.core.RrdDb rrdFile)
throws Exception
closeFile in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>rrdFile - a RrdDb object.Exception - if any.public org.jrobin.core.RrdDef createDefinition(String creator, String directory, String rrdName, int step, List<RrdDataSource> dataSources, List<String> rraList) throws Exception
createDefinition in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>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(org.jrobin.core.RrdDef rrdDef)
throws Exception
createFile in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>rrdDef - a RrdDef object.Exception - if any.public org.jrobin.core.RrdDb openFile(String fileName) throws Exception
openFile in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>fileName - the name of the associated rrd fileException - if an error occurs opening the filepublic void updateFile(org.jrobin.core.RrdDb rrdFile,
String owner,
String data)
throws Exception
updateFile in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>rrdFile - 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 fileName, String ds, int interval) throws NumberFormatException, RrdException
fetchLastValue in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>fileName - 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 fileName, String ds, String consolidationFunction, int interval) throws RrdException
fetchLastValue in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>fileName - 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 databaseRrdException - if any.public Double fetchLastValueInRange(String fileName, String ds, int interval, int range) throws NumberFormatException, RrdException
fetchLastValueInRange in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>fileName - 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<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>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 RrdGraphDetails createGraphReturnDetails(String command, File workDir) throws IOException, RrdException
createGraphReturnDetails in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>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<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>rrdFiles - a Collection object.protected org.jrobin.graph.RrdGraphDef createGraphDef(File workDir, String[] inputArray) throws org.jrobin.core.RrdException
createGraphDef
public String getStats()
getStats in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>String object.public int getGraphLeftOffset()
getGraphLeftOffset
getGraphLeftOffset in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>public int getGraphRightOffset()
getGraphRightOffset
getGraphRightOffset in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>public int getGraphTopOffsetWithText()
getGraphTopOffsetWithText
getGraphTopOffsetWithText in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>public String getDefaultFileExtension()
getDefaultFileExtension
getDefaultFileExtension in interface RrdStrategy<org.jrobin.core.RrdDef,org.jrobin.core.RrdDb>String object.public static String[] tokenizeWithQuotingAndEscapes(String line, String delims, boolean processQuoted)
tokenizeWithQuotingAndEscapes
public static String[] tokenizeWithQuotingAndEscapes(String line, String delims, boolean processQuoted, String tokens)
line - the string to tokenizedelims - a string containing zero or more characters to treat as a delimiterprocessQuoted - whether or not to process escaped values inside quotestokens - custom escaped tokens to pass through, escaped. For example, if tokens contains "lsg", then \l, \s, and \g
will be passed through unescaped.String objects.public static char[] escapeIfNotPathSepInDEF(char encountered,
char escaped,
StringBuffer currToken)
escapeIfNotPathSepInDEF
encountered - a char.escaped - a char.currToken - a StringBuffer object.Copyright © 2020. All rights reserved.