|
|
@ -186,11 +186,9 @@ public abstract class AbstractPluginManager implements PluginManager { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
PluginWrapper pluginWrapper = loadPluginFromPath(pluginPath); |
|
|
|
PluginWrapper pluginWrapper = loadPluginFromPath(pluginPath); |
|
|
|
// TODO uninstalled plugin dependencies?
|
|
|
|
|
|
|
|
getUnresolvedPlugins().remove(pluginWrapper); |
|
|
|
|
|
|
|
getResolvedPlugins().add(pluginWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
firePluginStateEvent(new PluginStateEvent(this, pluginWrapper, null)); |
|
|
|
// try to resolve the loaded plugin together with other possible plugins that depend on this plugin
|
|
|
|
|
|
|
|
resolvePlugins(); |
|
|
|
|
|
|
|
|
|
|
|
return pluginWrapper.getDescriptor().getPluginId(); |
|
|
|
return pluginWrapper.getDescriptor().getPluginId(); |
|
|
|
} catch (PluginException e) { |
|
|
|
} catch (PluginException e) { |
|
|
@ -224,7 +222,6 @@ public abstract class AbstractPluginManager implements PluginManager { |
|
|
|
log.debug("Found {} possible plugins: {}", pluginPaths.size(), pluginPaths); |
|
|
|
log.debug("Found {} possible plugins: {}", pluginPaths.size(), pluginPaths); |
|
|
|
|
|
|
|
|
|
|
|
// load plugins from plugin paths
|
|
|
|
// load plugins from plugin paths
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
for (Path pluginPath : pluginPaths) { |
|
|
|
for (Path pluginPath : pluginPaths) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
loadPluginFromPath(pluginPath); |
|
|
|
loadPluginFromPath(pluginPath); |
|
|
@ -233,7 +230,7 @@ public abstract class AbstractPluginManager implements PluginManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// resolve 'unresolvedPlugins'
|
|
|
|
// resolve plugins
|
|
|
|
try { |
|
|
|
try { |
|
|
|
resolvePlugins(); |
|
|
|
resolvePlugins(); |
|
|
|
} catch (PluginException e) { |
|
|
|
} catch (PluginException e) { |
|
|
@ -739,7 +736,7 @@ public abstract class AbstractPluginManager implements PluginManager { |
|
|
|
// If exact versions are not allowed in requires, rewrite to >= expression
|
|
|
|
// If exact versions are not allowed in requires, rewrite to >= expression
|
|
|
|
requires = ">=" + requires; |
|
|
|
requires = ">=" + requires; |
|
|
|
} |
|
|
|
} |
|
|
|
if (systemVersion.equals("0.0.0") || versionManager.satisfies(requires, systemVersion)) { |
|
|
|
if (systemVersion.equals("0.0.0") || versionManager.checkVersionConstraint(systemVersion, requires)) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -757,9 +754,9 @@ public abstract class AbstractPluginManager implements PluginManager { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void resolvePlugins() throws PluginException { |
|
|
|
protected void resolvePlugins() throws PluginException { |
|
|
|
// retrieves the plugins descriptors from "unresolvedPlugins" list
|
|
|
|
// retrieves the plugins descriptors
|
|
|
|
List<PluginDescriptor> descriptors = new ArrayList<>(); |
|
|
|
List<PluginDescriptor> descriptors = new ArrayList<>(); |
|
|
|
for (PluginWrapper plugin : unresolvedPlugins) { |
|
|
|
for (PluginWrapper plugin : plugins.values()) { |
|
|
|
descriptors.add(plugin.getDescriptor()); |
|
|
|
descriptors.add(plugin.getDescriptor()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -784,11 +781,12 @@ public abstract class AbstractPluginManager implements PluginManager { |
|
|
|
// move plugins from "unresolved" to "resolved"
|
|
|
|
// move plugins from "unresolved" to "resolved"
|
|
|
|
for (String pluginId : sortedPlugins) { |
|
|
|
for (String pluginId : sortedPlugins) { |
|
|
|
PluginWrapper pluginWrapper = plugins.get(pluginId); |
|
|
|
PluginWrapper pluginWrapper = plugins.get(pluginId); |
|
|
|
unresolvedPlugins.remove(pluginWrapper); |
|
|
|
if (unresolvedPlugins.remove(pluginWrapper)) { |
|
|
|
resolvedPlugins.add(pluginWrapper); |
|
|
|
resolvedPlugins.add(pluginWrapper); |
|
|
|
log.info("Plugin '{}' resolved", getPluginLabel(pluginWrapper.getDescriptor())); |
|
|
|
log.info("Plugin '{}' resolved", getPluginLabel(pluginWrapper.getDescriptor())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected synchronized void firePluginStateEvent(PluginStateEvent event) { |
|
|
|
protected synchronized void firePluginStateEvent(PluginStateEvent event) { |
|
|
|
for (PluginStateListener listener : pluginStateListeners) { |
|
|
|
for (PluginStateListener listener : pluginStateListeners) { |
|
|
@ -918,6 +916,7 @@ public abstract class AbstractPluginManager implements PluginManager { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* The plugin label is used in logging and it's a string in format {@code pluginId@pluginVersion}. |
|
|
|
* The plugin label is used in logging and it's a string in format {@code pluginId@pluginVersion}. |
|
|
|
|
|
|
|
* |
|
|
|
* @param pluginDescriptor |
|
|
|
* @param pluginDescriptor |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|