Class 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
    Since:
    0.7.12
    Author:
    zzz
    • Constructor Detail

    • Method Detail

      • pluginsEnabled

        public static boolean pluginsEnabled​(I2PAppContext ctx)
        Since:
        public since 0.9.33, was package private
      • run

        public void run()
        Specified by:
        run in interface Runnable
      • updateAll

        public static void updateAll​(RouterContext ctx)
        threaded
        Since:
        0.8.13, public since 0.9.33, was package private
      • startPlugins

        static void startPlugins​(RouterContext ctx)
        this shouldn't throw anything
      • 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
      • 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
      • 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
        Since:
        0.9.41
      • deletePlugin

        public static boolean deletePlugin​(RouterContext ctx,
                                           String appName)
                                    throws Exception
        Returns:
        true on success - caller should call stopPlugin() first
        Throws:
        Exception
        Since:
        public since 0.9.33, was package private
      • pluginProperties

        public static Properties pluginProperties()
        plugins.config this auto-adds a property for every dir in the plugin directory
      • isPluginEnabled

        public static boolean isPluginEnabled​(String appName)
        Is the plugin enabled in plugins.config? Default true
        Since:
        0.8.13
      • disablePlugin

        public static void disablePlugin​(String appName)
        Disable in plugins.config
        Since:
        0.8.13
      • 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
      • 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)
      • storePluginProperties

        public static void storePluginProperties​(Properties props)
        plugins.config
      • isPluginRunning

        public static boolean isPluginRunning​(String pluginName,
                                              RouterContext ctx)
      • isPluginRunning

        protected static boolean isPluginRunning​(String pluginName,
                                                 RouterContext ctx,
                                                 Server s)
        Since:
        0.9.41
      • 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...
        Since:
        moved from ConfigClientsHelper in 0.9.33