org.opennms.netmgt.dao.support
Class DefaultRrdDao

java.lang.Object
  extended by org.opennms.netmgt.dao.support.DefaultRrdDao
All Implemented Interfaces:
RrdDao, org.springframework.beans.factory.InitializingBean

public class DefaultRrdDao
extends java.lang.Object
implements RrdDao, org.springframework.beans.factory.InitializingBean

Author:
DJ Gregor

Constructor Summary
DefaultRrdDao()
           
 
Method Summary
 void afterPropertiesSet()
           
 java.io.InputStream createGraph(java.lang.String command, java.io.File workDir)
          Create an RRD graph.
 int getGraphLeftOffset()
          Gets the offset of the left side of the graph box from the left side of the image.
 int getGraphRightOffset()
          Gets the offset of the right side of the graph box from the right side of the image.
 int getGraphTopOffsetWithText()
          Gets the offset of the top of the graph box from the top of the image.
 java.lang.Double getLastFetchValue(org.opennms.netmgt.model.OnmsAttribute attribute, int interval)
          This method issues an round robin fetch command to retrieve the last value of the data source stored in the specified RRD file.
 java.lang.Double getLastFetchValue(org.opennms.netmgt.model.OnmsAttribute attribute, int interval, int range)
          This method issues an round robin fetch command to retrieve the last value of the data source stored in the specified RRD file.
 double getPrintValue(org.opennms.netmgt.model.OnmsAttribute attribute, java.lang.String cf, long start, long end)
          Get the value for an attribute over a period of time.
 double[] getPrintValues(org.opennms.netmgt.model.OnmsAttribute attribute, java.lang.String rraConsolidationFunction, long startTimeInMillis, long endTimeInMillis, java.lang.String... printFunctions)
          Get the value for an attribute over a period of time.
 java.io.File getRrdBaseDirectory()
           
 java.lang.String getRrdBinaryPath()
           
 org.opennms.netmgt.rrd.RrdStrategy getRrdStrategy()
           
 void setRrdBaseDirectory(java.io.File rrdBaseDirectory)
           
 void setRrdBinaryPath(java.lang.String rrdBinaryPath)
           
 void setRrdStrategy(org.opennms.netmgt.rrd.RrdStrategy rrdStrategy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRrdDao

public DefaultRrdDao()
Method Detail

getPrintValue

public double getPrintValue(org.opennms.netmgt.model.OnmsAttribute attribute,
                            java.lang.String cf,
                            long start,
                            long end)
Description copied from interface: RrdDao
Get the value for an attribute over a period of time.

Specified by:
getPrintValue in interface RrdDao
Parameters:
attribute - the attribute
cf - consolidation function (usually "AVERAGE")
start - start time in milliseconds
end - end time in milliseconds
Returns:
value

getPrintValues

public double[] getPrintValues(org.opennms.netmgt.model.OnmsAttribute attribute,
                               java.lang.String rraConsolidationFunction,
                               long startTimeInMillis,
                               long endTimeInMillis,
                               java.lang.String... printFunctions)
Description copied from interface: RrdDao
Get the value for an attribute over a period of time.

Specified by:
getPrintValues in interface RrdDao
Parameters:
attribute - the attribute
rraConsolidationFunction - consolidation function (usually "AVERAGE")
startTimeInMillis - start time in milliseconds
endTimeInMillis - end time in milliseconds
Returns:
value

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

getRrdStrategy

public org.opennms.netmgt.rrd.RrdStrategy getRrdStrategy()

setRrdStrategy

public void setRrdStrategy(org.opennms.netmgt.rrd.RrdStrategy rrdStrategy)

getRrdBaseDirectory

public java.io.File getRrdBaseDirectory()

setRrdBaseDirectory

public void setRrdBaseDirectory(java.io.File rrdBaseDirectory)

getRrdBinaryPath

public java.lang.String getRrdBinaryPath()

setRrdBinaryPath

public void setRrdBinaryPath(java.lang.String rrdBinaryPath)

createGraph

public java.io.InputStream createGraph(java.lang.String command,
                                       java.io.File workDir)
                                throws org.springframework.dao.DataRetrievalFailureException
Create an RRD graph.

Specified by:
createGraph in interface RrdDao
Parameters:
command - RRD graph command
workDir - RRD files are relative to this directory
Returns:
PNG graph image
Throws:
org.springframework.dao.DataRetrievalFailureException - if the graph could not be created
See Also:
RrdDao.createGraph(java.lang.String, java.io.File)

getGraphTopOffsetWithText

public int getGraphTopOffsetWithText()
Description copied from interface: RrdDao
Gets the offset of the top of the graph box from the top of the image.

Specified by:
getGraphTopOffsetWithText in interface RrdDao
Returns:
offset in pixels
See Also:
RrdDao.getGraphTopOffsetWithText()

getGraphLeftOffset

public int getGraphLeftOffset()
Description copied from interface: RrdDao
Gets the offset of the left side of the graph box from the left side of the image.

Specified by:
getGraphLeftOffset in interface RrdDao
Returns:
offset in pixels
See Also:
RrdDao.getGraphLeftOffset()

getGraphRightOffset

public int getGraphRightOffset()
Description copied from interface: RrdDao
Gets the offset of the right side of the graph box from the right side of the image.

Specified by:
getGraphRightOffset in interface RrdDao
Returns:
offset in pixels
See Also:
RrdDao.getGraphRightOffset()

getLastFetchValue

public java.lang.Double getLastFetchValue(org.opennms.netmgt.model.OnmsAttribute attribute,
                                          int interval)
                                   throws org.springframework.dao.DataAccessResourceFailureException
Description copied from interface: RrdDao
This method issues an round robin fetch command to retrieve the last value of the data source stored in the specified RRD file. NOTE: This method assumes that each RRD file contains a single data source.

Specified by:
getLastFetchValue in interface RrdDao
Parameters:
attribute - The attribute for which fetch the last value. Must be a RrdGraphAttribute.
interval - Fetch interval. This should equal RRD step size.
Returns:
Retrived value or null if some errors occur
Throws:
org.springframework.dao.DataAccessResourceFailureException

getLastFetchValue

public java.lang.Double getLastFetchValue(org.opennms.netmgt.model.OnmsAttribute attribute,
                                          int interval,
                                          int range)
                                   throws org.springframework.dao.DataAccessResourceFailureException
Description copied from interface: RrdDao
This method issues an round robin fetch command to retrieve the last value of the data source stored in the specified RRD file. NOTE: This method assumes that each RRD file contains a single data source.

Specified by:
getLastFetchValue in interface RrdDao
Parameters:
attribute - The attribute for which fetch the last value. Must be a RrdGraphAttribute.
interval - Fetch interval in milliseconds. This should equal the RRD step size.
range - Interval in milliseconds for how long we should look back in time for a non-NaN value. This should a multiple of the RRD step size.
Returns:
Retrived value or null if some errors occur
Throws:
org.springframework.dao.DataAccessResourceFailureException


Copyright © 2007. All Rights Reserved.