List of usage examples for org.apache.commons.configuration PropertiesConfigurationLayout setHeaderComment
public void setHeaderComment(String comment)
From source file:com.francetelecom.clara.cloud.logicalmodel.LogicalConfigServiceUtils.java
public void dumpConfigContent(StructuredLogicalConfigServiceContent content, Writer writer) throws InvalidConfigServiceException { try {//from ww w. j a v a2 s . c om ValidatorUtil.validate(content); } catch (TechnicalException e) { throw new InvalidConfigServiceException("Invalid structured content:" + e, e); } PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); PropertiesConfigurationLayout layout = propertiesConfiguration.getLayout(); layout.setLineSeparator("\n"); String headerComment = content.getHeaderComment(); if (headerComment != null) { layout.setHeaderComment(headerComment); } for (ConfigEntry configEntry : content.configEntries) { String key = configEntry.getKey(); propertiesConfiguration.addProperty(key, configEntry.getValue()); String comment = configEntry.getComment(); layout.setSeparator(key, "="); if (comment != null) { layout.setComment(key, comment); } } try { propertiesConfiguration.save(writer); } catch (ConfigurationException e) { throw new InvalidConfigServiceException("Invalid structured content or output:" + e, e); } }