Package org.opennms.netmgt.rrd
Class NullRrdStrategy
- java.lang.Object
-
- org.opennms.netmgt.rrd.NullRrdStrategy
-
- All Implemented Interfaces:
RrdStrategy<java.lang.Object,java.lang.Object>
public class NullRrdStrategy extends java.lang.Object implements RrdStrategy<java.lang.Object,java.lang.Object>
ARrdStrategyimplementation that does nothing. Used in cases where an instance ofRrdStrategyis required but no implementations are available.
-
-
Constructor Summary
Constructors Constructor Description NullRrdStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseFile(java.lang.Object rrd)This closes the supplied round robin databasejava.lang.ObjectcreateDefinition(java.lang.String creator, java.lang.String directory, java.lang.String rrdName, int step, java.util.List<RrdDataSource> dataSources, java.util.List<java.lang.String> rraList)Create a round robin database definition from the supplied parameters.voidcreateFile(java.lang.Object rrdDef)Creates the round robin database defined by the supplied definition.java.io.InputStreamcreateGraph(java.lang.String command, java.io.File workDir)Creates an InputStream representing the bytes of a graph created from round robin data.RrdGraphDetailscreateGraphReturnDetails(java.lang.String command, java.io.File workDir)Creates an RrdGraphDetails object representing the graph created from round robin data.java.lang.DoublefetchLastValue(java.lang.String rrdFile, java.lang.String ds, int interval)Fetches the last value from the round robin database with the given name.java.lang.DoublefetchLastValue(java.lang.String rrdFile, java.lang.String ds, java.lang.String consolidationFunction, int interval)Fetches the last value from the round robin database with the given name.java.lang.DoublefetchLastValueInRange(java.lang.String rrdFile, java.lang.String ds, int interval, int range)Fetches the last value from the round robin database with the given name within a time range.java.lang.StringgetDefaultFileExtension()Get the file extension appropriate for files of this typeintgetGraphLeftOffset()Returns the number of pixels that the leftt-hand side of the graph is offset from the left side of the created image.intgetGraphRightOffset()Returns the number of pixels that the right-hand side of the graph is offset from the right side of the created image.intgetGraphTopOffsetWithText()Returns the number of pixels that the top of the graph is offset from the top of the created image if there is single line of header text.java.lang.StringgetStats()Provides the round robin database an opportunity to contribute statistics information to the logs file.java.lang.ObjectopenFile(java.lang.String fileName)Opens the round robin database with the supplied name.voidpromoteEnqueuedFiles(java.util.Collection<java.lang.String> rrdFiles)In the event that this is a queuing implementation of the RrdStrategy.voidsetConfigurationProperties(java.util.Properties configurationParameters)setConfigurationPropertiesvoidupdateFile(java.lang.Object rrd, java.lang.String owner, java.lang.String data)Updates the supplied round robin database with the given timestamp:value point
-
-
-
Method Detail
-
setConfigurationProperties
public void setConfigurationProperties(java.util.Properties configurationParameters)
Description copied from interface:RrdStrategysetConfigurationProperties
- Specified by:
setConfigurationPropertiesin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
configurationParameters- aPropertiesobject.
-
closeFile
public void closeFile(java.lang.Object rrd)
Description copied from interface:RrdStrategyThis closes the supplied round robin database- Specified by:
closeFilein interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
rrd- an rrd object created using openFile
-
createDefinition
public java.lang.Object createDefinition(java.lang.String creator, java.lang.String directory, java.lang.String rrdName, int step, java.util.List<RrdDataSource> dataSources, java.util.List<java.lang.String> rraList)Description copied from interface:RrdStrategyCreate a round robin database definition from the supplied parameters. This definition is used in the createFile call to create the actual file.- Specified by:
createDefinitionin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
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 step- Returns:
- an object representing the definition of an round robin database. Can be null if the database exists already.
-
createFile
public void createFile(java.lang.Object rrdDef)
Description copied from interface:RrdStrategyCreates the round robin database defined by the supplied definition. Should be able to handle rrdDef being null.- Specified by:
createFilein interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
rrdDef- an round robin database definition created using the createDefinition call.
-
createGraph
public java.io.InputStream createGraph(java.lang.String command, java.io.File workDir)Description copied from interface:RrdStrategyCreates an InputStream representing the bytes of a graph created from round robin data. It accepts an rrdtool graph command. The underlying implementation converts this command to a format appropriate for it .- Specified by:
createGraphin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
command- the command needed to create the graphworkDir- the directory that all referenced files are relative to- Returns:
- an input stream representing the bytes of a graph image as a PNG file
-
createGraphReturnDetails
public RrdGraphDetails createGraphReturnDetails(java.lang.String command, java.io.File workDir)
Description copied from interface:RrdStrategyCreates an RrdGraphDetails object representing the graph created from round robin data. It accepts an rrdtool graph command. The underlying implementation converts this command to a format appropriate for it .- Specified by:
createGraphReturnDetailsin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
command- the command needed to create the graphworkDir- the directory that all referenced files are relative to- Returns:
- details for the graph including an InputStream, any PRINTed lines, and graph dimensions.
-
fetchLastValue
public java.lang.Double fetchLastValue(java.lang.String rrdFile, java.lang.String ds, int interval)Description copied from interface:RrdStrategyFetches the last value from the round robin database with the given name. The interval passed in should be the interval associated with the round robin database.- Specified by:
fetchLastValuein interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
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 database- Returns:
- The last value as a Double (if the last value didn't exist returns a Double.NaN)
-
fetchLastValueInRange
public java.lang.Double fetchLastValueInRange(java.lang.String rrdFile, java.lang.String ds, int interval, int range)Description copied from interface:RrdStrategyFetches the last value from the round robin database with the given name within a time range. The interval passed in should be the interval associated with the round robin database. The range should be the amount of "lag" acceptable for an update to be considered valid. Range must be a multiple of the RRD interval.- Specified by:
fetchLastValueInRangein interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
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 returned- Returns:
- The last value as a Double (if the last value didn't exist returns a Double.NaN)
-
getStats
public java.lang.String getStats()
Description copied from interface:RrdStrategyProvides the round robin database an opportunity to contribute statistics information to the logs file.- Specified by:
getStatsin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Returns:
- a non-null string representing any statistics to be included in the logs
-
openFile
public java.lang.Object openFile(java.lang.String fileName)
Description copied from interface:RrdStrategyOpens the round robin database with the supplied name. It is assumed the name refers to a round robin database appropriate for this strategy implementation- Specified by:
openFilein interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
fileName- the name of the associated rrd file- Returns:
- an open rrd reference that can by used in calls to updateFile and closeFile
-
updateFile
public void updateFile(java.lang.Object rrd, java.lang.String owner, java.lang.String data)Description copied from interface:RrdStrategyUpdates the supplied round robin database with the given timestamp:value point- Specified by:
updateFilein interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
rrd- an rrd object created using openFileowner- the owner of the rrddata- a string of the form:
-
getGraphLeftOffset
public int getGraphLeftOffset()
Description copied from interface:RrdStrategyReturns the number of pixels that the leftt-hand side of the graph is offset from the left side of the created image. The offset should always be positive.- Specified by:
getGraphLeftOffsetin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Returns:
- offset in pixels. Should always be positive.
-
getGraphRightOffset
public int getGraphRightOffset()
Description copied from interface:RrdStrategyReturns the number of pixels that the right-hand side of the graph is offset from the right side of the created image. The offset should always be negative.- Specified by:
getGraphRightOffsetin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Returns:
- offset in pixels. Should always be negative.
-
getGraphTopOffsetWithText
public int getGraphTopOffsetWithText()
Description copied from interface:RrdStrategyReturns the number of pixels that the top of the graph is offset from the top of the created image if there is single line of header text. The offset should always be negative.- Specified by:
getGraphTopOffsetWithTextin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Returns:
- offset in pixels. Should always be negative.
-
getDefaultFileExtension
public java.lang.String getDefaultFileExtension()
Description copied from interface:RrdStrategyGet the file extension appropriate for files of this type- Specified by:
getDefaultFileExtensionin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Returns:
- a
Stringobject.
-
fetchLastValue
public java.lang.Double fetchLastValue(java.lang.String rrdFile, java.lang.String ds, java.lang.String consolidationFunction, int interval)Description copied from interface:RrdStrategyFetches the last value from the round robin database with the given name. The interval passed in should be the interval associated with the round robin database.- Specified by:
fetchLastValuein interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
rrdFile- a name the represents a round robin databaseds- a name the represents a data source to be usedconsolidationFunction- aStringobject.interval- a step interval of the round robin database- Returns:
- The last value as a Double (if the last value didn't exist returns a Double.NaN)
-
promoteEnqueuedFiles
public void promoteEnqueuedFiles(java.util.Collection<java.lang.String> rrdFiles)
Description copied from interface:RrdStrategyIn the event that this is a queuing implementation of the RrdStrategy. This method causes all queued but not yet written data to be to the rrd files as soon as possible.- Specified by:
promoteEnqueuedFilesin interfaceRrdStrategy<java.lang.Object,java.lang.Object>- Parameters:
rrdFiles- aCollectionobject.
-
-