Exemplo n.º 1
0
 /**
  * Disable in plugins.config
  *
  * @since 0.8.13
  */
 public static void disablePlugin(String appName) {
   Properties props = pluginProperties();
   String prop = PREFIX + appName + ENABLED;
   if (Boolean.parseBoolean(props.getProperty(prop, "true"))) {
     props.setProperty(prop, "false");
     storePluginProperties(props);
   }
 }
Exemplo n.º 2
0
 /** this shouldn't throw anything */
 static void startPlugins(RouterContext ctx) {
   Log log = ctx.logManager().getLog(PluginStarter.class);
   Properties props = pluginProperties();
   for (Map.Entry<Object, Object> e : props.entrySet()) {
     String name = (String) e.getKey();
     if (name.startsWith(PREFIX) && name.endsWith(ENABLED)) {
       if (Boolean.parseBoolean((String) e.getValue())) {
         String app = name.substring(PREFIX.length(), name.lastIndexOf(ENABLED));
         // plugins could have been started after update
         if (isPluginRunning(app, ctx)) continue;
         try {
           if (!startPlugin(ctx, app)) log.error("Failed to start plugin: " + app);
         } catch (Throwable t) {
           log.error("Failed to start plugin: " + app, t);
         }
       }
     }
   }
 }
Exemplo n.º 3
0
 /**
  * Is the plugin enabled in plugins.config? Default true
  *
  * @since 0.8.13
  */
 public static boolean isPluginEnabled(String appName) {
   Properties props = pluginProperties();
   String prop = PREFIX + appName + ENABLED;
   return Boolean.parseBoolean(props.getProperty(prop, "true"));
 }