/** * Tests for already loaded plugins on given path. * * @param pluginPath the path to investigate * @return id of plugin or null if not loaded */ protected String idForPath(Path pluginPath) { for (PluginWrapper plugin : plugins.values()) { if (plugin.getPluginPath().equals(pluginPath)) { return plugin.getPluginId(); } } return null; }
@Override public boolean deletePlugin(String pluginId) { checkPluginId(pluginId); PluginWrapper pluginWrapper = getPlugin(pluginId); PluginState pluginState = stopPlugin(pluginId); if (PluginState.STARTED == pluginState) { log.error("Failed to stop plugin '{}' on delete", pluginId); return false; } if (!unloadPlugin(pluginId)) { log.error("Failed to unload plugin '{}' on delete", pluginId); return false; } try { pluginWrapper.getPlugin().delete(); } catch (PluginException e) { log.error(e.getMessage(), e); return false; } Path pluginPath = pluginWrapper.getPluginPath(); return pluginRepository.deletePluginPath(pluginPath); }
/** * Tests for already loaded plugins on given path. * * @param pluginPath the path to investigate * @return id of plugin or null if not loaded */ protected String idForPath(Path pluginPath) { for (PluginWrapper plugin : plugins.values()) { if (plugin.getPluginPath().equals(pluginPath)) { return plugin.getPluginId(); } } return null; }
@Override public boolean deletePlugin(String pluginId) { checkPluginId(pluginId); PluginWrapper pluginWrapper = getPlugin(pluginId); PluginState pluginState = stopPlugin(pluginId); if (PluginState.STARTED == pluginState) { log.error("Failed to stop plugin '{}' on delete", pluginId); return false; } if (!unloadPlugin(pluginId)) { log.error("Failed to unload plugin '{}' on delete", pluginId); return false; } try { pluginWrapper.getPlugin().delete(); } catch (PluginException e) { log.error(e.getMessage(), e); return false; } Path pluginPath = pluginWrapper.getPluginPath(); return pluginRepository.deletePluginPath(pluginPath); }