OpenNMS API 1.2.3

org.opennms.netmgt.rrd
Class Interface

java.lang.Object
  extended byorg.opennms.netmgt.rrd.Interface

public final class Interface
extends java.lang.Object

This is a singleton class which provides an interface through which RRD (Round Robin Database) functions (rrd_create(), rrd_update(), and others) can be accessed from Java code.

 The native method 'launch()' takes a single argument which is a 
  RRD command string of similar format to what RRDtool takes.  Please
  note the following examples:
  
  	"create test.rrd --start N DS:ifOctetsIn:COUNTER:600:U:U \
        	RRA:AVERAGE:0.5:1:24"
 
  	"update test.rrd --template:ifOctetsIn N:123456789"
  
  Refer to www.rrdtool.org for additional examples and information on 
  the format of rrdtool command strings.
  
  Currently only 'create', 'update', and 'fetch' commands are supported.
 

Version:
1.1.1.1
Author:
Mike , OpenNMS

Field Summary
private static boolean m_loaded
          This member is set to true if the 'jrrd' library (libjrrd.so on linux/unix) has has been loaded.
private static Interface m_singleton
          The singleton instance of the interface
 
Constructor Summary
private Interface()
          Constructor.
 
Method Summary
static Interface getInstance()
          Return the singleton instance of this class.
static void init()
          Load the jrrd library and create the singleton instance of the interface.
static java.lang.String[] launch(java.lang.String cmd)
          Native method implemented in C which provides an interface to the lower-level RRD functions WARNING: The RRD C api (rrd_update(), rrd_create(), etc...) relies on getopt() & therefore is not thread safe.
static void main(java.lang.String[] argv)
          Debug purposes only
static void reload()
          Reload the jrrd library and create the singleton instance of the interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_singleton

private static Interface m_singleton
The singleton instance of the interface


m_loaded

private static boolean m_loaded
This member is set to true if the 'jrrd' library (libjrrd.so on linux/unix) has has been loaded.

Constructor Detail

Interface

private Interface()
           throws java.lang.SecurityException,
                  java.lang.UnsatisfiedLinkError
Constructor. Responsible for loading the jrrd shared/dynamic link library which contains the implementation of the 'launch()' native method.

Throws:
java.lang.SecurityException - if we don't have permission to load the library
java.lang.UnsatisfiedLinkError - if the library doesn't exist
Method Detail

launch

public static java.lang.String[] launch(java.lang.String cmd)
Native method implemented in C which provides an interface to the lower-level RRD functions WARNING: The RRD C api (rrd_update(), rrd_create(), etc...) relies on getopt() & therefore is not thread safe. This method is therefore synchronized in order to prevent more than one thread access at a time.

Parameters:
cmd - RRDtool style command string to be executed. Currently supported RRD commands are: 'create' - calls rrd_create() 'update' - calls rrd_update() 'fetch' - calls rrd_fetch()
Returns:
array of Java String objects In the case of rrd_fetch() the returned String array has the following characteristics: String[0] = error text if command failed or NULL if successful String[1] = for 'fetch' cmd: data source names String[2..n] = for 'fetch' cmd: retrieved data rows for each interval between start and end parms

init

public static void init()
                 throws java.lang.SecurityException,
                        java.lang.UnsatisfiedLinkError
Load the jrrd library and create the singleton instance of the interface.

Throws:
java.lang.SecurityException - if we don't have permission to load the library
java.lang.UnsatisfiedLinkError - if the library doesn't exist

reload

public static void reload()
                   throws java.lang.SecurityException,
                          java.lang.UnsatisfiedLinkError
Reload the jrrd library and create the singleton instance of the interface.

Throws:
java.lang.SecurityException - if we don't have permission to load the library
java.lang.UnsatisfiedLinkError - if the library doesn't exist

getInstance

public static Interface getInstance()
Return the singleton instance of this class.

Returns:
The current instance.
Throws:
java.lang.IllegalStateException - Thrown if the interface has not yet been initialized.

main

public static void main(java.lang.String[] argv)
Debug purposes only


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.