/** * Dumps configuration to string. * * @param configuration a configuration. * @return a configuration dump string. */ public static String dumpConfiguration(org.apache.commons.configuration2.Configuration configuration) { StringWriter sw = new StringWriter(); ConfigurationUtils.dump(configuration, new PrintWriter(sw)); return sw.toString(); }
protected HierarchicalConfiguration<ImmutableNode> cloneConfiguration(IConfig config) { // Clone configuration. final IConfig iconfig = (IConfig) config; final HierarchicalConfiguration<ImmutableNode> apacheConfig = iconfig.getConfig(); final Configuration clonedConfig = ConfigurationUtils.cloneConfiguration(apacheConfig); @SuppressWarnings("unchecked") final HierarchicalConfiguration<ImmutableNode> clonedHierachicalConfig = (HierarchicalConfiguration<ImmutableNode>) clonedConfig; return clonedHierachicalConfig; }
public void setBuilder(ReloadingCombinedConfigurationBuilder builder) throws ConfigurationException { this.builder = builder; this.configuration = ConfigurationUtils.unmodifiableConfiguration(builder.getConfiguration()); }
/** * Call this method to trigger a configuration reload, but only if the file has changed and the timeout since last reload has passed * @throws ConfigurationException */ public void reloadIfNeeded() throws ConfigurationException { // TODO Doesn't seem to work builder.getReloadingController().checkForReloading(null); this.configuration = ConfigurationUtils.unmodifiableConfiguration(builder.getConfiguration()); }