use of org.pentaho.platform.config.PropertiesFileConfiguration in project pentaho-platform by pentaho.
the class PentahoSystemPluginManager method registerSettings.
private void registerSettings(IPlatformPlugin plugin, ClassLoader loader) {
IPluginResourceLoader resLoader = PentahoSystem.get(IPluginResourceLoader.class, null);
InputStream stream = resLoader.getResourceAsStream(loader, "settings.xml");
if (stream == null) {
// No settings.xml is fine
return;
}
Properties properties = new Properties();
try {
Document docFromStream = XmlDom4JHelper.getDocFromStream(stream);
for (Object element : docFromStream.getRootElement().elements()) {
Element ele = (Element) element;
String name = ele.getName();
String value = ele.getText();
properties.put("settings/" + name, value);
}
} catch (DocumentException | IOException e) {
logger.error("Error parsing settings.xml for plugin: " + plugin.getId(), e);
}
try {
systemConfig.registerConfiguration(new PropertiesFileConfiguration(plugin.getId(), properties));
} catch (IOException e) {
logger.error("Error registering settings.xml for plugin: " + plugin.getId(), e);
}
}
Aggregations