## org.jrobin.graph
Class FetchSourceList

    java.lang.Object
      org.jrobin.graph.FetchSourceList

public class FetchSourceList
extends java.lang.Object

A FetchSourceList represents a number of RRD datasources, to be used with RrdGraphDef for Graph generation.

Constructor Summary
`FetchSourceList(int defaultSize)` Creates a new FetchSourceList with the specified default size.
`FetchSourceList(int defaultSize, boolean persistent, boolean lockOpener)` Creates a new FetchSourceList with the specified default size.
`FetchSourceList(int defaultSize, boolean persistent, boolean lockOpener, RrdOpener rrdOpener)` Creates a new FetchSourceList with the specified default size.

Method Summary
`void` `add(java.lang.String name, java.lang.String file, java.lang.String dsName, java.lang.String consolFunc)` Adds a datasource for graphing purposes to the list, see `RrdExportDef.datasource( java.lang.String, java.lang.String, java.lang.String, java.lang.String )`.
`void` `add(java.lang.String name, java.lang.String file, java.lang.String dsName, java.lang.String consolFunc, java.lang.String backend)` Adds a datasource for graphing purposes to the list, see `RrdExportDef.datasource( java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String )`.
`void` `clear()` Clears up the FetchSourceList for new use.
`int` `defCount()` Returns the number of Defs represented by the different FetchSources.
`protected org.jrobin.graph.FetchSource` `get(int index)` Returns the FetchSource for the given index.
`long` `getLastUpdateTime()` Returns the highest last update time in seconds of the datasources represented by the list.
`RrdOpener` `getRrdOpener()`
`void` `lockOpener()` This locks the RrdOpener in the FetchSourceList.
`void` `openAll()` Retrieves (opens) all RrdDb instances related to the different FetchSources.
`void` `releaseAll()` Releases all RrdDb instances for the FetchSources.
`void` `setPersistent(boolean persistent)` Sets the persistency state of the FetchSourceList.
`void` `setRrdOpener(RrdOpener rrdOpener)` Sets the internal RrdOpener object to use for RrdDb retrieval.
`int` `size()` Returns the number of FetchSources hold in the list.
`void` `unlockOpener()` Unlocks the RrdOpener object, means calls to setRrdOpener() can change the internal rrdOpener object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FetchSourceList

    public FetchSourceList(int defaultSize)

  Creates a new FetchSourceList with the specified default size. The size of the actual list is not limited to this number, and the list will expand automatically if necessary. The default size should be a ballpark figure for the number of different RrdDb that will be used (usually a RrdDb corresponds with a single RRD file).

Parameters:
  `defaultSize` - Default size of the FetchSourceList.

### FetchSourceList

    public FetchSourceList(int defaultSize,
                           boolean persistent,
                           boolean lockOpener)

  Creates a new FetchSourceList with the specified default size. The size of the actual list is not limited to this number, and the list will expand automatically if necessary. The default size should be a ballpark figure for the number of different RrdDb that will be used (usually a RrdDb corresponds with a single RRD file).

Parameters:
  `defaultSize` - Default size of the FetchSourceList.
  `persistent` - True if the list is persistent, false if not.

### FetchSourceList

    public FetchSourceList(int defaultSize,
                           boolean persistent,
                           boolean lockOpener,
                           RrdOpener rrdOpener)

  Creates a new FetchSourceList with the specified default size. The size of the actual list is not limited to this number, and the list will expand automatically if necessary. The default size should be a ballpark figure for the number of different RrdDb that will be used (usually a RrdDb corresponds with a single RRD file).

Parameters:
  `defaultSize` - Default size of the FetchSourceList.
  `persistent` - True if the list is persistent, false if not.
  `rrdOpener` - Reference to the RrdOpener object that will be used for RrdDb retrieval.

Method Detail

### setRrdOpener

    public void setRrdOpener(RrdOpener rrdOpener)

  Sets the internal RrdOpener object to use for RrdDb retrieval.

  Parameters:
    `rrdOpener` - Reference to the corresponding RrdOpener instance.

### getRrdOpener

    public RrdOpener getRrdOpener()

### setPersistent

    public void setPersistent(boolean persistent)

  Sets the persistency state of the FetchSourceList. If the list is set as persistent, RrdDb's can be opened and retrieved, but not released, and the RrdOpener reference can not be changed. This is useful to avoid premature closing and reopening of datasources for performance reasons. Setting a FetchSourceList as persistent requires you to manually control releasing all datasources (all calls to openAll() will still succeed).

  Parameters:
    `persistent` - True if the list should behave as persistent.

### lockOpener

    public void lockOpener()

  This locks the RrdOpener in the FetchSourceList. Subsequent call so setRrdOpener() will be ignored until it is unlocked.

### unlockOpener

    public void unlockOpener()

  Unlocks the RrdOpener object, means calls to setRrdOpener() can change the internal rrdOpener object.

### size

    public int size()

  Returns the number of FetchSources hold in the list.

  Returns:
    Number of different FetchSources.

### defCount

    public int defCount()

  Returns the number of Defs represented by the different FetchSources.

  Returns:
    Number of Def definitions.

### openAll

    public void openAll()
                 throws RrdException,
                        java.io.IOException

  Retrieves (opens) all RrdDb instances related to the different FetchSources. It is safe to call this method multiple times in a row.

  Throws:
    `java.io.IOException` - Thrown in case of fetching I/O error.
    `RrdException` - Thrown in case of a JRobin specific error.

### releaseAll

    public void releaseAll()
                    throws RrdException,
                           java.io.IOException

  Releases all RrdDb instances for the FetchSources. It is safe to call this method multiple times in a row. In case of a persistent list, this method does nothing until persistency is removed.

  Throws:
    `java.io.IOException` - Thrown in case of fetching I/O error.
    `RrdException` - Thrown in case of a JRobin specific error.

### clear

    public void clear()
               throws RrdException,
                      java.io.IOException

  Clears up the FetchSourceList for new use. This removes persistency, releases all RrdDb instances, and clears the internal list of FetchSources. After clear() the list is empty.

  Throws:
    `java.io.IOException` - Thrown in case of fetching I/O error.
    `RrdException` - Thrown in case of a JRobin specific error.

### getLastUpdateTime

    public long getLastUpdateTime()
                           throws RrdException,
                                  java.io.IOException

  Returns the highest last update time in seconds of the datasources represented by the list. If the update time differs for different datasources, the highest overall timestamp will be returned.

  Returns:
    Last update time in seconds.
  Throws:
    `java.io.IOException` - Thrown in case of fetching I/O error.
    `RrdException` - Thrown in case of a JRobin specific error.

### add

    public void add(java.lang.String name,
                    java.lang.String file,
                    java.lang.String dsName,
                    java.lang.String consolFunc,
                    java.lang.String backend)
             throws RrdException

  Adds a datasource for graphing purposes to the list, see `RrdExportDef.datasource( java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String )`.

  Parameters:
    `name` - Internal datasource name, to be used in GraphDefs.
    `file` - Path to RRD file.
    `dsName` - Data source name defined in the RRD file.
    `consolFunc` - Consolidation function that will be used to extract data from the RRD file ("AVERAGE", "MIN", "MAX" or "LAST").
    `backend` - Name of the RrdBackendFactory that should be used for this RrdDb.
  Throws:
    `RrdException` - Thrown in case of a JRobin specific error.

### add

    public void add(java.lang.String name,
                    java.lang.String file,
                    java.lang.String dsName,
                    java.lang.String consolFunc)
             throws RrdException

  Adds a datasource for graphing purposes to the list, see `RrdExportDef.datasource( java.lang.String, java.lang.String, java.lang.String, java.lang.String )`.

  Parameters:
    `name` - Internal datasource name, to be used in GraphDefs.
    `file` - Path to RRD file.
    `dsName` - Data source name defined in the RRD file.
    `consolFunc` - Consolidation function that will be used to extract data from the RRD file ("AVERAGE", "MIN", "MAX" or "LAST").
  Throws:
    `RrdException` - Thrown in case of a JRobin specific error.

### get

    protected org.jrobin.graph.FetchSource get(int index)

  Returns the FetchSource for the given index.

  Parameters:
    `index` - Index of the FetchSource in the list.
  Returns:
    FetchSource instance.