public static Properties getPluginProperties(String plugin) { ArgsHolder.PluginParam pluginParam = ArgsHolder.getPluginParams().get(plugin); Properties properties = new Properties(); File pluginDir = pluginParam != null && pluginParam.getPath() != null ? new File(pluginParam.getPath()) : new File(Directories.PLUGINS_DIR, plugin); File confDir = new File(pluginDir, "conf"); File file = new File(confDir, PROPERTIES_FILE); if (!file.exists()) { log.warn("Could not find a plugin descriptor : " + file); return properties; } try { loadProperties(properties, file); } catch (IOException e) { log.error(String.format("Exception while loading plugin specific properties file %s.", PROPERTIES_FILE), e); } return properties; }
Path tempConfigDir = null; if (pluginParam != null) { if (pluginParam.getPath() != null) { File extDir = new File(pluginParam.getPath()); if (extDir.exists() && extDir.isDirectory()) { addConfAndLib(classpathBuilder, extDir); if (pp.getPath() != null) { command.add(ArgsHolder.ADD_PLUGIN).add(pp.getPath());
ArgsHolder.PluginParam plugin1 = pluginParams.get("plugin1"); assertNotNull(plugin1); assertEquals("/foo/plugin1", plugin1.getPath()); List<String> configFiles1 = plugin1.getConfigFiles(); assertTrue(configFiles1.contains("/foo/config.xml")); assertEquals("/bar/plugin2", plugin2.getPath()); List<String> configFiles2 = plugin2.getConfigFiles(); assertTrue(configFiles2.contains("/bar/config.xml"));