commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 31119] New: - [configuration] Configuration type conversion
Date Wed, 08 Sep 2004 15:27:14 GMT
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


Mime
View raw message