Skip to content

Commit

Permalink
Plugins: Allow to place "extracted" plugins under the plugins direc…
Browse files Browse the repository at this point in the history
…tory, closes elastic#428.
  • Loading branch information
kimchy committed Oct 14, 2010
1 parent 8d533e8 commit e0488fa
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -164,6 +164,23 @@ private void loadPluginsIntoClassLoader() {
File[] pluginsFiles = pluginsFile.listFiles();
for (File pluginFile : pluginsFiles) {
if (!pluginFile.getName().endsWith(".zip")) {
if (pluginFile.isDirectory()) {
logger.trace("--- adding expanded plugin [" + pluginFile.getAbsolutePath() + "]");
try {
// add the root
addURL.invoke(classLoader, pluginFile.toURI().toURL());
// if there are jars in it, add it as well
for (File jarToAdd : pluginFile.listFiles()) {
if (!(jarToAdd.getName().endsWith(".jar") || jarToAdd.getName().endsWith(".zip"))) {
continue;
}
addURL.invoke(classLoader, jarToAdd.toURI().toURL());
}
} catch (Exception e) {
logger.warn("failed to add plugin [" + pluginFile + "]", e);
}
}

continue;
}
if (logger.isTraceEnabled()) {
Expand Down

0 comments on commit e0488fa

Please sign in to comment.