net.i2p.router.startup

## Class ClientAppConfig

- java.lang.Object
- - net.i2p.router.startup.ClientAppConfig

-     public class ClientAppConfig
      extends Object

  Contains a really simple ClientApp "structure" and some static methods so they can be used both by LoadClientAppsJob and by the configuration page in the router console.

       clients.config format:

       Lines are of the form clientApp.x.prop=val, where x is the app number.
       App numbers MUST start with 0 and be consecutive.

       Properties are as follows:
              main: Full class name. Required. The main() method in this
                    class will be run.
              name: Name to be displayed on console.
              args: Arguments to the main class, separated by spaces or tabs.
                    Arguments containing spaces or tabs may be quoted with ' or "
              delay: Seconds before starting, default 120
              onBoot: {true|false}, default false, forces a delay of 0,
                      overrides delay setting
              startOnLoad: {true|false} Is the client to be run at all?
                          Default true

       The following additional properties are used only by plugins:
              stopargs: Arguments to stop the client.
              uninstallargs: Arguments to stop the client.
              classpath: Additional classpath elements for the client,
                         separated by commas.

       The following substitutions are made in the args, stopargs,
       uninstallargs, and classpath lines, for plugins only:
              $I2P: The base I2P install directory
              $CONFIG: The user's configuration directory (e.g. ~/.i2p)
              $PLUGIN: This plugin's directory (e.g. ~/.i2p/plugins/foo)

       All properties except "main" are optional.
       Lines starting with "#" are comments.

       If the delay is less than zero, the client is run immediately,
       in the same thread, so that exceptions may be propagated to the console.
       In this case, the client should either throw an exception, return quickly,
       or spawn its own thread.
       If the delay is greater than or equal to zero, it will be run
       in a new thread, and exceptions will be logged but not propagated
       to the console.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `String` | `args`
    `String` | `className`
    `String` | `classpath`
    `String` | `clientName`
    `(package private) File` | `configFile`
    `long` | `delay`
    `boolean` | `disabled`
    `String` | `stopargs`
    `String` | `uninstallargs`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientAppConfig(String cl, String client, String a, long d, boolean dis)`
    `ClientAppConfig(String cl, String client, String a, long d, boolean dis, String cp, String sa, String ua)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static File` | `configDir(I2PAppContext ctx)`
    `static File` | `configFile(I2PAppContext ctx)`
    `static boolean` | `deleteClientAppConfig(ClientAppConfig cac)` This works for both split and non-split config.
    `boolean` | `equals(Object o)` Matches on class, args, and name only
    `static List<ClientAppConfig>` | `getClientApps(File cfgFile)`
    `static List<ClientAppConfig>` | `getClientApps(RouterContext ctx)`
    `int` | `hashCode()`
    `static boolean` | `isSplitConfig(I2PAppContext ctx)`
    `static void` | `writeClientAppConfig(I2PAppContext ctx, ClientAppConfig app)` Classpath and stopargs not supported.
    `static void` | `writeClientAppConfig(I2PAppContext ctx, List<ClientAppConfig> apps)` Classpath and stopargs not supported.

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

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

- - ### Field Detail

    - #### args

          public String args

    - #### className

          public String className

    - #### classpath

          public final String classpath

    - #### clientName

          public String clientName

    - #### configFile

          File configFile

    - #### delay

          public final long delay

    - #### disabled

          public boolean disabled

    - #### stopargs

          public final String stopargs

    - #### uninstallargs

          public final String uninstallargs

  - ### Constructor Detail

    - #### ClientAppConfig

          public ClientAppConfig(String cl,
                                 String client,
                                 String a,
                                 long d,
                                 boolean dis)

    - #### ClientAppConfig

          public ClientAppConfig(String cl,
                                 String client,
                                 String a,
                                 long d,
                                 boolean dis,
                                 String cp,
                                 String sa,
                                 String ua)

  - ### Method Detail

    - #### configDir

          public static File configDir(I2PAppContext ctx)

    - #### configFile

          public static File configFile(I2PAppContext ctx)

    - #### deleteClientAppConfig

          public static boolean deleteClientAppConfig(ClientAppConfig cac)
                                               throws IOException

      This works for both split and non-split config. If this is the only config in the file, the file will be deleted; otherwise the file will be saved with the remaining configs.
      Returns:
        success
      Throws:
        `IllegalArgumentException` - if cac has a null configfile
        `IOException`

    - #### equals

          public boolean equals(Object o)

      Matches on class, args, and name only
      Overrides:
        `equals` in class `Object`

    - #### getClientApps

          public static List<ClientAppConfig> getClientApps(File cfgFile)
                                                     throws IOException

      Throws:
        `IOException`

    - #### getClientApps

          public static List<ClientAppConfig> getClientApps(RouterContext ctx)

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### isSplitConfig

          public static boolean isSplitConfig(I2PAppContext ctx)

    - #### writeClientAppConfig

          public static void writeClientAppConfig(I2PAppContext ctx,
                                                  ClientAppConfig app)
                                           throws IOException

      Classpath and stopargs not supported. All other apps in the file will be deleted. Do not use if multiple apps in a single file - use writeClientAppConfig(ctx, apps). If app.configFile is null, a new file will be created and assigned.
      Throws:
        `IOException`

    - #### writeClientAppConfig

          public static void writeClientAppConfig(I2PAppContext ctx,
                                                  List<ClientAppConfig> apps)
                                           throws IOException

      Classpath and stopargs not supported. All other apps in the files will be deleted. Do not add apps with this method - use writeClientAppConfig(ctx, app). Do not delete apps with this method - use deleteClientAppConfig().
      Throws:
        `IOException`