Decebal Suiu 6 years ago
parent
commit
6f2f721959
  1. 8
      pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
  2. 5
      pf4j/src/main/java/org/pf4j/PluginManager.java

8
pf4j/src/main/java/org/pf4j/AbstractPluginManager.java

@ -173,25 +173,19 @@ public abstract class AbstractPluginManager implements PluginManager {
} }
@Override @Override
public String loadPlugin(Path pluginPath) { public String loadPlugin(Path pluginPath) throws PluginException {
if ((pluginPath == null) || Files.notExists(pluginPath)) { if ((pluginPath == null) || Files.notExists(pluginPath)) {
throw new IllegalArgumentException(String.format("Specified plugin %s does not exist!", pluginPath)); throw new IllegalArgumentException(String.format("Specified plugin %s does not exist!", pluginPath));
} }
log.debug("Loading plugin from '{}'", pluginPath); log.debug("Loading plugin from '{}'", pluginPath);
try {
PluginWrapper pluginWrapper = loadPluginFromPath(pluginPath); PluginWrapper pluginWrapper = loadPluginFromPath(pluginPath);
// try to resolve the loaded plugin together with other possible plugins that depend on this plugin // try to resolve the loaded plugin together with other possible plugins that depend on this plugin
resolvePlugins(); resolvePlugins();
return pluginWrapper.getDescriptor().getPluginId(); return pluginWrapper.getDescriptor().getPluginId();
} catch (PluginException e) {
log.error(e.getMessage(), e);
}
return null;
} }
/** /**

5
pf4j/src/main/java/org/pf4j/PluginManager.java

@ -70,9 +70,10 @@ public interface PluginManager {
* *
* @param pluginPath the plugin location * @param pluginPath the plugin location
* @return the pluginId of the installed plugin as specified in * @return the pluginId of the installed plugin as specified in
* its {@linkplain PluginDescriptor metadata}; or {@code null} * its {@linkplain PluginDescriptor metadata}
* @throws PluginException if load of plugin fails
*/ */
String loadPlugin(Path pluginPath); String loadPlugin(Path pluginPath) throws PluginException;
/** /**
* Start all active plugins. * Start all active plugins.

Loading…
Cancel
Save