net.i2p.router.web

## Class PluginStarter

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

- All Implemented Interfaces:
    Runnable
  Direct Known Subclasses:
    PluginStopper

      public class PluginStarter
      extends Object
      implements Runnable

  Start/stop/delete plugins that are already installed Get properties of installed plugins Get or change settings in plugins.config

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected RouterContext` | `_context`
    `static String` | `DELETED`
    `static String` | `ENABLED`
    `static Map<String,String>` | `java9Blacklist` Plugin name to plugin version of plugins that do not work with Java 9+ Unmodifiable.
    `static Map<String,String>` | `jetty9Blacklist` Plugin name to plugin version of plugins that do not work with Jetty 9, but do not have a max-jetty-version=8.9999 set.
    `static String` | `PLUGIN_DIR`
    `static String` | `PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PluginStarter(RouterContext ctx)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `deletePlugin(RouterContext ctx, String appName)`
    `static void` | `disablePlugin(String appName)` Disable in plugins.config
    `static Map<String,String>` | `getPluginKeys(I2PAppContext ctx)` The signing keys from all the plugins
    `static List<String>` | `getPlugins()` all installed plugins whether enabled or not, but does NOT include plugins marked as deleted.
    `static boolean` | `isPluginEnabled(String appName)` Is the plugin enabled in plugins.config? Default true
    `static boolean` | `isPluginRunning(String pluginName, RouterContext ctx)`
    `protected static boolean` | `isPluginRunning(String pluginName, RouterContext ctx, Server s)`
    `static Properties` | `pluginProperties()` plugins.config this auto-adds a property for every dir in the plugin directory
    `static Properties` | `pluginProperties(I2PAppContext ctx, String appName)` plugin.config
    `static boolean` | `pluginsEnabled(I2PAppContext ctx)`
    `void` | `run()`
    `static boolean` | `startPlugin(RouterContext ctx, String appName)`
    `(package private) static void` | `startPlugins(RouterContext ctx)` this shouldn't throw anything
    `protected static boolean` | `stopPlugin(RouterContext ctx, Server s, String appName)`
    `static boolean` | `stopPlugin(RouterContext ctx, String appName)`
    `static void` | `storePluginProperties(Properties props)` plugins.config
    `static String` | `stripHTML(Properties props, String key)` Like in DataHelper but doesn't convert null to "" There's a lot worse things a plugin could do but...
    `static void` | `updateAll(RouterContext ctx)` threaded

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

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

- - ### Field Detail

    - #### _context

          protected RouterContext _context

    - #### DELETED

          public static final String DELETED

      See Also:
        Constant Field Values

    - #### ENABLED

          public static final String ENABLED

      See Also:
        Constant Field Values

    - #### java9Blacklist

          public static final Map<String,String> java9Blacklist

      Plugin name to plugin version of plugins that do not work with Java 9+ Unmodifiable.

    - #### jetty9Blacklist

          public static final Map<String,String> jetty9Blacklist

      Plugin name to plugin version of plugins that do not work with Jetty 9, but do not have a max-jetty-version=8.9999 set. Unmodifiable.

    - #### PLUGIN_DIR

          public static final String PLUGIN_DIR

      See Also:
        Constant Field Values

    - #### PREFIX

          public static final String PREFIX

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PluginStarter

          public PluginStarter(RouterContext ctx)

  - ### Method Detail

    - #### deletePlugin

          public static boolean deletePlugin(RouterContext ctx,
                                             String appName)
                                      throws Exception

      Returns:
        true on success - caller should call stopPlugin() first
      Throws:
        `Exception`

    - #### disablePlugin

          public static void disablePlugin(String appName)

      Disable in plugins.config

    - #### getPluginKeys

          public static Map<String,String> getPluginKeys(I2PAppContext ctx)

      The signing keys from all the plugins
      Returns:
        Map of key to keyname Last one wins if a dup (installer should prevent dups)

    - #### getPlugins

          public static List<String> getPlugins()

      all installed plugins whether enabled or not, but does NOT include plugins marked as deleted.
      Returns:
        non-null, sorted, modifiable

    - #### isPluginEnabled

          public static boolean isPluginEnabled(String appName)

      Is the plugin enabled in plugins.config? Default true

    - #### isPluginRunning

          public static boolean isPluginRunning(String pluginName,
                                                RouterContext ctx)

    - #### isPluginRunning

          protected static boolean isPluginRunning(String pluginName,
                                                   RouterContext ctx,
                                                   Server s)

    - #### pluginProperties

          public static Properties pluginProperties()

      plugins.config this auto-adds a property for every dir in the plugin directory

    - #### pluginProperties

          public static Properties pluginProperties(I2PAppContext ctx,
                                                    String appName)

      plugin.config

    - #### pluginsEnabled

          public static boolean pluginsEnabled(I2PAppContext ctx)

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### startPlugin

          public static boolean startPlugin(RouterContext ctx,
                                            String appName)
                                     throws Exception

      Returns:
        true on success
      Throws:
        `Exception` - just about anything, caller would be wise to catch Throwable

    - #### startPlugins

          static void startPlugins(RouterContext ctx)

      this shouldn't throw anything

    - #### stopPlugin

          protected static boolean stopPlugin(RouterContext ctx,
                                              Server s,
                                              String appName)
                                       throws Exception

      Returns:
        true on success
      Throws:
        `Exception` - just about anything, caller would be wise to catch Throwable

    - #### stopPlugin

          public static boolean stopPlugin(RouterContext ctx,
                                           String appName)
                                    throws Exception

      Returns:
        true on success
      Throws:
        `Exception` - just about anything, caller would be wise to catch Throwable

    - #### storePluginProperties

          public static void storePluginProperties(Properties props)

      plugins.config

    - #### stripHTML

          public static String stripHTML(Properties props,
                                         String key)

      Like in DataHelper but doesn't convert null to "" There's a lot worse things a plugin could do but...

    - #### updateAll

          public static void updateAll(RouterContext ctx)

      threaded