net.i2p.router.web

## Class GraphGenerator

- java.lang.Object
- - net.i2p.router.web.GraphGenerator

- All Implemented Interfaces:
    Runnable, ClientApp

      public class GraphGenerator
      extends Object
      implements Runnable, ClientApp

  A thread started by RouterConsoleRunner that checks the configuration for stats to be tracked via jrobin, and adds or deletes RRDs as necessary. This also contains methods to generate xml, png or svg image output. The rendering for graphs is in GraphRenderer. To control memory, the number of simultaneous renderings is limited.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_DATABASES`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GraphGenerator(RouterContext ctx)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `countGraphs()`
    `String` | `getDisplayName()` The display name of the ClientApp, used in user interfaces.
    `List<GraphListener>` | `getListeners()` List of GraphListener instances
    `String` | `getName()` The generic name of the ClientApp, used for registration, e.g.
    `ClientAppState` | `getState()` The current state of the ClientApp.
    `boolean` | `getXML(Rate rate, OutputStream out)`
    `static GraphGenerator` | `instance()`
    `static GraphGenerator` | `instance(I2PAppContext ctx)`
    `static boolean` | `isDisabled(I2PAppContext ctx)`
    `Set<Rate>` | `parseSpecs(String specs)`
    `boolean` | `renderPng(Rate rate, OutputStream out)`
    `boolean` | `renderPng(Rate rate, OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, int end, boolean showCredit)` This does the single data graphs.
    `boolean` | `renderRatePng(OutputStream out, int width, int height, boolean hideLegend, boolean hideGrid, boolean hideTitle, boolean showEvents, int periodCount, int end, boolean showCredit)` This does the two-data bandwidth graph only.
    `void` | `run()`
    `(package private) void` | `setDisabled()` Disable graph generation until restart See GraphRenderer.render()
    `(package private) static void` | `setDisabled(I2PAppContext ctx)` Disable graph generation until restart See GraphRenderer.render()
    `void` | `shutdown(String[] args)` Does nothing, we aren't tracked
    `void` | `startup()` Does nothing, we aren't tracked
    `void` | `stop()`

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

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

- - ### Field Detail

    - #### DEFAULT_DATABASES

          public static final String DEFAULT_DATABASES

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GraphGenerator

          public GraphGenerator(RouterContext ctx)

  - ### Method Detail

    - #### countGraphs

          public int countGraphs()

    - #### getDisplayName

          public String getDisplayName()

      Description copied from interface: `ClientApp`
      The display name of the ClientApp, used in user interfaces. The app must translate.
      Specified by:
        `getDisplayName` in interface `ClientApp`
      Returns:
        non-null

    - #### getListeners

          public List<GraphListener> getListeners()

      List of GraphListener instances

    - #### getName

          public String getName()

      Description copied from interface: `ClientApp`
      The generic name of the ClientApp, used for registration, e.g. "console". Do not translate.
      Specified by:
        `getName` in interface `ClientApp`
      Returns:
        non-null

    - #### getState

          public ClientAppState getState()

      Description copied from interface: `ClientApp`
      The current state of the ClientApp.
      Specified by:
        `getState` in interface `ClientApp`
      Returns:
        non-null

    - #### getXML

          public boolean getXML(Rate rate,
                                OutputStream out)
                         throws IOException

      Throws:
        `IOException`

    - #### instance

          public static GraphGenerator instance()

      Returns:
        null if disabled

    - #### instance

          public static GraphGenerator instance(I2PAppContext ctx)

      Returns:
        null if disabled

    - #### isDisabled

          public static boolean isDisabled(I2PAppContext ctx)

    - #### parseSpecs

          public Set<Rate> parseSpecs(String specs)

      Parameters:
        `specs` - statName.period,statName.period,statName.period
      Returns:
        list of Rate objects

    - #### renderPng

          public boolean renderPng(Rate rate,
                                   OutputStream out)
                            throws IOException

      Throws:
        `IOException`

    - #### renderPng

          public boolean renderPng(Rate rate,
                                   OutputStream out,
                                   int width,
                                   int height,
                                   boolean hideLegend,
                                   boolean hideGrid,
                                   boolean hideTitle,
                                   boolean showEvents,
                                   int periodCount,
                                   int end,
                                   boolean showCredit)
                            throws IOException

      This does the single data graphs. For the two-data bandwidth graph see renderRatePng(). Synchronized to conserve memory.
      Parameters:
        `end` - number of periods before now
      Returns:
        success
      Throws:
        `IOException`

    - #### renderRatePng

          public boolean renderRatePng(OutputStream out,
                                       int width,
                                       int height,
                                       boolean hideLegend,
                                       boolean hideGrid,
                                       boolean hideTitle,
                                       boolean showEvents,
                                       int periodCount,
                                       int end,
                                       boolean showCredit)
                                throws IOException

      This does the two-data bandwidth graph only. For all other graphs see renderPng() above. Synchronized to conserve memory.
      Parameters:
        `end` - number of periods before now
      Returns:
        success
      Throws:
        `IOException`

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### setDisabled

          void setDisabled()

      Disable graph generation until restart See GraphRenderer.render()

    - #### setDisabled

          static void setDisabled(I2PAppContext ctx)

      Disable graph generation until restart See GraphRenderer.render()

    - #### shutdown

          public void shutdown(String[] args)

      Does nothing, we aren't tracked
      Specified by:
        `shutdown` in interface `ClientApp`
      Parameters:
        `args` - generally null but could be stopArgs from clients.config

    - #### startup

          public void startup()

      Does nothing, we aren't tracked
      Specified by:
        `startup` in interface `ClientApp`

    - #### stop

          public void stop()