You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/09/08 17:27:14 UTC

DO NOT REPLY [Bug 31119] New: - [configuration] Configuration type conversion

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31119>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31119

[configuration] Configuration type conversion

           Summary: [configuration] Configuration type conversion
           Product: Commons
           Version: Nightly Builds
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Configuration
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: smanux@lfjr.net


Currently there is no easy way to change the format used to store file based
configurations, a XML configuration cannot be saved as a properties file. One
has to copy manually all the properties to a new configuration. 

Oliver Heger suggested separating the persistence mechanism from the
Configuration objects. For example:

Configuration config = XMLConfigurationLoader.load("config.xml");
PropertiesConfigurationWriter.save(config, "config.properties");

An other way is to provide a method to copy all the properties from a
configuration to another one, either as a copy(Configuration, Configuration)
method in ConfigurationUtils, as an addAll(Configuration) method in the
Configuration interface or as a special constructor:

Configuration config = new XMLConfiguration("config.xml");
Configuration config2 = new PropertiesConfiguration(config);
config2.save("config.properties");

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org