protected Set<Plugin> loadPlugins(String pluginPath) { final File pluginDir = new File(pluginPath); final Set<Plugin> plugins = new HashSet<>(); final PluginLoader pluginLoader = new PluginLoader(pluginDir); for (Plugin plugin : pluginLoader.loadPlugins()) { final PluginMetaData metadata = plugin.metadata(); if (capabilities().containsAll(metadata.getRequiredCapabilities())) { if (version.sameOrHigher(metadata.getRequiredVersion())) { plugins.add(plugin); } else { LOG.error( "Plugin \"" + metadata.getName() + "\" requires version " + metadata.getRequiredVersion() + " - not loading!"); } } else { LOG.debug( "Skipping plugin \"{}\" because some capabilities are missing ({}).", metadata.getName(), Sets.difference(plugin.metadata().getRequiredCapabilities(), capabilities())); } } LOG.info("Loaded plugins: " + plugins); return plugins; }
private PluginBindings installPluginConfigAndBindings(String pluginPath) { final Set<Plugin> plugins = loadPlugins(pluginPath); final PluginBindings pluginBindings = new PluginBindings(plugins); for (final Plugin plugin : plugins) { for (final PluginModule pluginModule : plugin.modules()) { for (final PluginConfigBean configBean : pluginModule.getConfigBeans()) { jadConfig.addConfigurationBean(configBean); } } } return pluginBindings; }