public String serialize() { PropertiesConfiguration propConfig = new PropertiesConfiguration(); propConfig.copy(compositeConfig); StringWriter writer = new StringWriter(); try { propConfig.save(writer); } catch (ConfigurationException e) { // this should never happen throw new IllegalStateException(e); } return writer.toString(); }
public String serialize() { PropertiesConfiguration propConfig = new PropertiesConfiguration(); propConfig.copy(this); StringWriter writer = new StringWriter(); try { propConfig.save(writer); } catch (ConfigurationException e) { // this should never happen throw new IllegalStateException(e); } return writer.toString(); }
@Override public synchronized String currentConfig() { PropertiesConfiguration saver = new PropertiesConfiguration(); StringWriter writer = new StringWriter(); saver.copy(config); try { saver.save(writer); } catch (Exception e) { throw new MetricsConfigException("Error stringify config", e); } return writer.toString(); }
static String toString(Configuration c) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { PrintStream ps = new PrintStream(buffer, false, "UTF-8"); PropertiesConfiguration tmp = new PropertiesConfiguration(); tmp.copy(c); tmp.save(ps); return buffer.toString("UTF-8"); } catch (Exception e) { throw new MetricsConfigException(e); } } }
static String toString(Configuration c) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { PrintStream ps = new PrintStream(buffer, false, "UTF-8"); PropertiesConfiguration tmp = new PropertiesConfiguration(); tmp.copy(c); tmp.save(ps); return buffer.toString("UTF-8"); } catch (Exception e) { throw new MetricsConfigException(e); } } }
@Override public synchronized String currentConfig() { PropertiesConfiguration saver = new PropertiesConfiguration(); StringWriter writer = new StringWriter(); saver.copy(config); try { saver.save(writer); } catch (Exception e) { throw new MetricsConfigException("Error stringify config", e); } return writer.toString(); }
@Override public synchronized String currentConfig() { PropertiesConfiguration saver = new PropertiesConfiguration(); StringWriter writer = new StringWriter(); saver.copy(config); try { saver.save(writer); } catch (Exception e) { throw new MetricsConfigException("Error stringify config", e); } return writer.toString(); }
static String toString(Configuration c) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); try { PrintStream ps = new PrintStream(buffer, false, "UTF-8"); PropertiesConfiguration tmp = new PropertiesConfiguration(); tmp.copy(c); tmp.save(ps); return buffer.toString("UTF-8"); } catch (Exception e) { throw new MetricsConfigException(e); } } }
public static InputStream getKylinPropertiesAsInputSteam() { File propFile = getKylinProperties(); if (propFile == null || !propFile.exists()) { logger.error("fail to locate kylin.properties"); throw new RuntimeException("fail to locate kylin.properties"); } File overrideFile = new File(propFile.getParentFile(), propFile.getName() + ".override"); if (overrideFile.exists()) { try { PropertiesConfiguration conf = new PropertiesConfiguration(); conf.load(propFile); PropertiesConfiguration override = new PropertiesConfiguration(); override.load(overrideFile); conf.copy(override); ByteArrayOutputStream bout = new ByteArrayOutputStream(); conf.save(bout); return new ByteArrayInputStream(bout.toByteArray()); } catch (ConfigurationException e) { throw new RuntimeException(e); } } try { return new FileInputStream(propFile); } catch (FileNotFoundException e) { logger.error("this should not happen"); throw new RuntimeException(e); } }
static void dump(String header, Configuration c, PrintStream out) { PropertiesConfiguration p = new PropertiesConfiguration(); p.copy(c); if (header != null) { out.println(header); } try { p.save(out); } catch (Exception e) { throw new RuntimeException("Error saving config", e); } }
static void dump(String header, Configuration c, PrintStream out) { PropertiesConfiguration p = new PropertiesConfiguration(); p.copy(c); if (header != null) { out.println(header); } try { p.save(out); } catch (Exception e) { throw new RuntimeException("Error saving config", e); } }
XMLConfiguration conf1 = new XMLConfiguration("table1.xml"); XMLConfiguration conf2 = new XMLConfiguration("table2.xml"); // Create and initialize the node combiner NodeCombiner combiner = new UnionCombiner(); combiner.addListNode("table"); // mark table as list node // this is needed only if there are ambiguities // Construct the combined configuration CombinedConfiguration cc = new CombinedConfiguration(combiner); cc.addConfiguration(conf1, "tab1"); cc.addConfiguration(conf2); PropertiesConfiguration config = new PropertiesConfiguration("usergui.properties"); config.copy(cc); config.save();
config.copy(pride.getLocalConfiguration()); Collection<ExportedModule> exportedModules = Collections2.transform(pride.getModules(), new Function<Module, ExportedModule>() { @Override