From 74865ee6da538e7133a1860124613e645388cd6b Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Sat, 20 Oct 2018 23:37:30 +0300 Subject: [PATCH] Resolve #242 --- .../main/java/org/pf4j/AbstractPluginManager.java | 7 +++++++ pf4j/src/main/java/org/pf4j/Plugin.java | 13 +++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java index f2578d8..4d4503f 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java @@ -303,6 +303,13 @@ public abstract class AbstractPluginManager implements PluginManager { return false; } + try { + pluginWrapper.getPlugin().delete(); + } catch (PluginException e) { + log.error(e.getMessage(), e); + return false; + } + Path pluginPath = pluginWrapper.getPluginPath(); return pluginRepository.deletePluginPath(pluginPath); diff --git a/pf4j/src/main/java/org/pf4j/Plugin.java b/pf4j/src/main/java/org/pf4j/Plugin.java index 6233b44..b648b64 100644 --- a/pf4j/src/main/java/org/pf4j/Plugin.java +++ b/pf4j/src/main/java/org/pf4j/Plugin.java @@ -57,15 +57,24 @@ public class Plugin { } /** - * Start method is called by the application when the plugin is loaded. + * This method is called by the application when the plugin is started. + * See {@link PluginManager#startPlugin(String)}. */ public void start() throws PluginException { } /** - * Stop method is called by the application when the plugin is unloaded. + * This method is called by the application when the plugin is stopped. + * See {@link PluginManager#stopPlugin(String)}. */ public void stop() throws PluginException { } + /** + * This method is called by the application when the plugin is deleted. + * See {@link PluginManager#deletePlugin(String)}. + */ + public void delete() throws PluginException { + } + } -- 2.39.5