org.rrd4j.core

## Class RrdDb.Builder

- java.lang.Object
- - org.rrd4j.core.RrdDb.Builder

- Enclosing class:
    RrdDb

      public static class RrdDb.Builder
      extends Object

  Builder for `RrdDb` instances.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RrdDb` | `build()` Builds or imports a `RrdDb` instance.
    `void` | `doimport()` Import an external rrd data, import definition must have been done using `setExternalPath(String)` or `setImporter(DataImporter)`.
    `RrdDb.Builder` | `readOnly()` Set the rrd as readonly
    `RrdDb.Builder` | `setBackendFactory(RrdBackendFactory factory)`
    `RrdDb.Builder` | `setExternalPath(String externalPath)` Set when the builder will be used to import external data with a predefined source: XML or RRDTool.
    `RrdDb.Builder` | `setImporter(DataImporter importer)` Set when the builder will be used to import external data with a custom source.
    `RrdDb.Builder` | `setPath(String path)`
    `RrdDb.Builder` | `setPath(URI uri)`
    `RrdDb.Builder` | `setPool(RrdDbPool pool)` Set the pool that will be used and set usePool to true.
    `(package private) RrdDb.Builder` | `setPoolInternal(RrdDbPool pool)` Internal method used to memorize the pool, without generating a loop
    `RrdDb.Builder` | `setReadOnly(boolean readOnly)`
    `RrdDb.Builder` | `setRrdDef(RrdDef rrdDef)`
    `RrdDb.Builder` | `setRrdToolImporter(String externalPath)` Set when the builder will be used to import a RRDTool file.
    `RrdDb.Builder` | `setUsePool(boolean usePool)`
    `RrdDb.Builder` | `usePool()` Activate the pool usage.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### build

          public RrdDb build()
                      throws IOException

      Builds or imports a `RrdDb` instance.
      Returns:
        a new build RrdDb
      Throws:
        `IOException` - in case of I/O error.
        `IllegalArgumentException` - if the builder settings were incomplete
        `IllegalStateException` - if the thread was interrupted in pool usage

    - #### doimport

          public void doimport()
                        throws IOException

      Import an external rrd data, import definition must have been done using `setExternalPath(String)` or `setImporter(DataImporter)`.

      It can be used when it's not need to keep a reference to the rrd.

      Throws:
        `IOException` - in case of I/O error.
        `IllegalArgumentException` - if the builder settings were incomplete
        `IllegalStateException` - if the thread was interrupted in pool usage

    - #### readOnly

          public RrdDb.Builder readOnly()

      Set the rrd as readonly
      Returns:
        the same builder.

    - #### setBackendFactory

          public RrdDb.Builder setBackendFactory(RrdBackendFactory factory)

      Parameters:
        `factory` - The backend factory to use for that rrd.
      Returns:
        the same builder.

    - #### setExternalPath

          public RrdDb.Builder setExternalPath(String externalPath)

      Set when the builder will be used to import external data with a predefined source: XML or RRDTool.
      Parameters:
        `externalPath` - an URI-like indication of RRD data to import
      Returns:
        the same builder.

    - #### setImporter

          public RrdDb.Builder setImporter(DataImporter importer)

      Set when the builder will be used to import external data with a custom source.
      Parameters:
        `importer` - a custom import
      Returns:
        the same builder.

    - #### setPath

          public RrdDb.Builder setPath(String path)

    - #### setPath

          public RrdDb.Builder setPath(URI uri)

    - #### setPool

          public RrdDb.Builder setPool(RrdDbPool pool)

      Set the pool that will be used and set usePool to true.
      Parameters:
        `pool` - true if a pool is going to be used
      Returns:
        the same builder.

    - #### setPoolInternal

          RrdDb.Builder setPoolInternal(RrdDbPool pool)

      Internal method used to memorize the pool, without generating a loop
      Parameters:
        `pool` -
      Returns:
        the Builder

    - #### setReadOnly

          public RrdDb.Builder setReadOnly(boolean readOnly)

      Parameters:
        `readOnly` - true if the rrd is to be read only
      Returns:
        the same builder.

    - #### setRrdDef

          public RrdDb.Builder setRrdDef(RrdDef rrdDef)

      Parameters:
        `rrdDef` - a `RrdDef` to a new rrd file.
      Returns:
        the same builder.

    - #### setRrdToolImporter

          public RrdDb.Builder setRrdToolImporter(String externalPath)
                                           throws IOException

      Set when the builder will be used to import a RRDTool file.
      Parameters:
        `externalPath` - the path to a RRDTool file
      Returns:
        the same builder.
      Throws:
        `IOException` - if the RRDTool file can‘t be read

    - #### setUsePool

          public RrdDb.Builder setUsePool(boolean usePool)

    - #### usePool

          public RrdDb.Builder usePool()

      Activate the pool usage. If the pool is not declared using `setPool(RrdDbPool)`, the singleton instance will be used.
      Returns:
        the same builder.