java.lang.Object
net.i2p.router.web.PluginStarter
net.i2p.router.web.PluginStopper
- All Implemented Interfaces:
Runnable
Stop all plugins that are installed and running.
Field Summary
Fields inherited from class PluginStarter
_context, DELETED, ENABLED, java9Blacklist, jetty9Blacklist, PLUGIN_DIR, PREFIXModifier and TypeFieldDescriptionprotected RouterContextThe router context the plugins are started in.static final StringValue of the enabled property marking a plugin as deleted.static final StringSuffix of the property recording whether a plugin starts at load, false, true, or deleted.Plugin name to plugin version of plugins that do not work with Java 9+ Unmodifiable.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 final StringDirectory under the router base holding the installed plugins.static final StringPrefix of every plugin property key.Constructor Summary
ConstructorsConstructorDescriptionPluginStopper(RouterContext ctx, Server server) Remembers the jetty server whose plugins are to be stopped.Method Summary
Modifier and TypeMethodDescriptionvoidrun()Stops every running plugin.private voidStop all running pluginsMethods inherited from class PluginStarter
deletePlugin, disablePlugin, getPluginKeys, getPlugins, isPluginEnabled, isPluginRunning, isPluginRunning, pluginProperties, pluginProperties, pluginsEnabled, startPlugin, startPlugins, stopPlugin, stopPlugin, storePluginProperties, stripHTML, updateAllModifier and TypeMethodDescriptionstatic booleandeletePlugin(RouterContext ctx, String appName) Uninstall a plugin: run its client apps' uninstall commands, unregister its themes (falling back to the default theme if it is the current one), remove its directory and drop its plugins.config entries.static voiddisablePlugin(String appName) Disable in plugins.config.The signing keys from all the plugins.All installed plugins whether enabled or not, but does NOT include plugins marked as deleted.static booleanisPluginEnabled(String appName) Is the plugin enabled in plugins.config? Default true.static booleanisPluginRunning(String pluginName, RouterContext ctx) Is any part of the plugin still up? Client threads, console webapps, queued client apps and registered client apps all count.protected static booleanisPluginRunning(String pluginName, RouterContext ctx, Server s) Is any part of the plugin still up? Client threads, console webapps, queued client apps and registered client apps all count.static PropertiesRead the plugins.config file, this auto-adds a property for every dir in the plugin directory.static PropertiespluginProperties(I2PAppContext ctx, String appName) Read the plugin.config file for a single plugin.static booleanHas the user allowed plugins to be started at all?static booleanstartPlugin(RouterContext ctx, String appName) Start a plugin: extract a pending update, enforce the min/max I2P, Java and Jetty version requirements, register its themes, client apps, console webapps, translation jars and summary bar link.(package private) static voidStart every plugin whose plugins.config entry is "true", skipping any that an update already started.static booleanstopPlugin(RouterContext ctx, String appName) Stop a plugin: shut down its client apps and console webapps, drop its summary bar link, and release its thread group, pending timers and ClassLoader cache.protected static booleanstopPlugin(RouterContext ctx, Server s, String appName) Stop a plugin using an already-located console server, so this also works during shutdown after the server has been unregistered.static voidstorePluginProperties(Properties props) Write the plugins.config file.static StringstripHTML(Properties props, String key) Like inDataHelperbut doesn't convert null to "" There's a lot worse things a plugin could do but...static voidupdateAll(RouterContext ctx) Starts the plugin update on a daemon thread, so the caller does not block.
Field Details
_server
The webapp server being stopped.
Constructor Details
PluginStopper
Remembers the jetty server whose plugins are to be stopped.- Parameters:
ctx- the router context the plugin starter works againstserver- the jetty server whose running plugins are to be stopped
Method Details
run
public void run()Stops every running plugin.- Specified by:
runin interfaceRunnable- Overrides:
runin classPluginStarter
stopPlugins
private void stopPlugins()Stop all running pluginsthis shouldn't throw anything.