OpenNMS API 1.2.9

## org.opennms.netmgt.rrd
Interface RrdStrategy

All Known Implementing Classes:
  JniRrdStrategy, JRobinRrdStrategy, QueuingRrdStrategy

interface RrdStrategy

Defines an abstract strategy for manipulating round robin database file. This is used by the RrdUtils to implement the appropriate behaviour

Method Summary
`void` `closeFile(java.lang.Object rrd)` This closes the supplied round robin database
`java.lang.Object` `createDefinition(java.lang.String creator, java.lang.String directory, java.lang.String dsName, int step, java.lang.String dsType, int dsHeartbeat, java.lang.String dsMin, java.lang.String dsMax, java.util.List rraList)` Create a round robin database definition from the supplied parameters.
`void` `createFile(java.lang.Object rrdDef)` Creates the round robin database defined by the supplied definition.
`java.io.InputStream` `createGraph(java.lang.String command, java.io.File workDir)` Creates an InputStream representing the bytes of a graph created from round robin data.
`java.lang.Double` `fetchLastValue(java.lang.String rrdFile, int interval)` Fetches the last value from the round robin database with the given name.
`java.lang.Double` `fetchLastValueInRange(java.lang.String rrdFile, int interval, int range)` Fetches the last value from the round robin database with the given name within a time range.
`java.lang.String` `getStats()` Provides the round robin database an opportunity to contribute statistics information to the logs file.
`void` `graphicsInitialize()` This Initializes the graphics subsystem only.
`void` `initialize()` Initialize the appropriate round robin system
`java.lang.Object` `openFile(java.lang.String fileName)` Opens the round robin database with the supplied name.
`void` `updateFile(java.lang.Object rrd, java.lang.String data)` Updates the supplied round robin database with the given timestamp:value point

Method Detail

### initialize

    public void initialize()
                    throws java.lang.Exception

  Initialize the appropriate round robin system

  Throws:
    `java.lang.Exception` - if an Error occurs

### graphicsInitialize

    public void graphicsInitialize()
                            throws java.lang.Exception

  This Initializes the graphics subsystem only. This is used by the web application to avoid the need for the JNI infrastructure in the webapp.

  Throws:
    `java.lang.Exception`

### createDefinition

    public java.lang.Object createDefinition(java.lang.String creator,
                                             java.lang.String directory,
                                             java.lang.String dsName,
                                             int step,
                                             java.lang.String dsType,
                                             int dsHeartbeat,
                                             java.lang.String dsMin,
                                             java.lang.String dsMax,
                                             java.util.List rraList)
                                      throws java.lang.Exception

  Create a round robin database definition from the supplied parameters. This definition is used in the createFile call to create the actual file.

  Parameters:
    `creator` - - A string representing who is creating this file for use in log msgs
    `directory` - - The directory to create the file in
    `dsName` - - The datasource name for use in the round robin database
    `step` - - the step for the database
    `dsType` - - the type for the datasource
    `dsHeartbeat` - - the heartbeat for the datasouce
    `dsMin` - - the minimum allowable value for the datasource
    `dsMax` - - the maximum allowable value for the datasouce
    `rraList` - - a List of the round robin archives to create in the database
  Returns:
    an object representing the definition of an round robin database
  Throws:
    `java.lang.Exception` - If an error occurs while creating the definition

### createFile

    public void createFile(java.lang.Object rrdDef)
                    throws java.lang.Exception

  Creates the round robin database defined by the supplied definition.

  Parameters:
    `rrdDef` - an round robin database definition created using the createDefinition call.
  Throws:
    `java.lang.Exception` - if an error occurs create the file

### openFile

    public java.lang.Object openFile(java.lang.String fileName)
                              throws java.lang.Exception

  Opens the round robin database with the supplied name. It is assumed the name refers to a round robin database appropriate for this strategy implementation

  Parameters:
    `fileName` - the name of the associated rrd file
  Returns:
    an open rrd reference that can by used in calls to updateFile and closeFile
  Throws:
    `java.lang.Exception` - if an error occurs opening the file

### updateFile

    public void updateFile(java.lang.Object rrd,
                           java.lang.String data)
                    throws java.lang.Exception

  Updates the supplied round robin database with the given timestamp:value point

  Parameters:
    `rrd` - an rrd object created using openFile
    `data` - a string of the form <timestamp>: <datavalue>
  Throws:
    `java.lang.Exception` - if an error occurs updating the file

### closeFile

    public void closeFile(java.lang.Object rrd)
                   throws java.lang.Exception

  This closes the supplied round robin database

  Parameters:
    `rrd` - an rrd object created using openFile
  Throws:
    `java.lang.Exception` - if an error occurs closing the file

### fetchLastValue

    public java.lang.Double fetchLastValue(java.lang.String rrdFile,
                                           int interval)
                                    throws java.lang.NumberFormatException,
                                           RrdException

  Fetches 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.

  Parameters:
    `rrdFile` - a name the represents a round robin database
    `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)
  Throws:
    `java.lang.NumberFormatException`
    `RrdException`

### fetchLastValueInRange

    public java.lang.Double fetchLastValueInRange(java.lang.String rrdFile,
                                                  int interval,
                                                  int range)
                                           throws java.lang.NumberFormatException,
                                                  RrdException

  Fetches 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.

  Parameters:
    `rrdFile` - a name the represents a round robin database
    `interval` - a step interval of the round robin database
    `range` - 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)
  Throws:
    `java.lang.NumberFormatException`
    `RrdException`

### createGraph

    public java.io.InputStream createGraph(java.lang.String command,
                                           java.io.File workDir)
                                    throws java.io.IOException,
                                           RrdException

  Creates 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 .

  Parameters:
    `command` - the command needed to create the graph
    `workDir` - the directory that all referenced files are relative to
  Returns:
    an input stream representing the bytes of a graph image as a PNG file
  Throws:
    `java.io.IOException` - if an IOError occurs
    `RrdException` - if an RRD error occurs

### getStats

    public java.lang.String getStats()

  Provides the round robin database an opportunity to contribute statistics information to the logs file.

  Returns:
    a non-null string representing any staticstics to be included in the logs

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.