I have a hierarchy of property files which are available in various folders in 
my file system. The file names are same but the folders are named based on the 
base group and specific group id and.

I have a requirement of creating group based configurations of all the 
available property files. Based on the user login I need load their respective 
group and if not available at that level it would go to the base group and get 
the key.

I am trying use the 
MultiFileConfigurationBuilder<http://commons.apache.org/proper/commons-configuration/xref/org/apache/commons/configuration2/builder/combined/MultiFileConfigurationBuilder.html>
 and trying to set the pattern to combine the configurations. To the pattern I 
would set the group id and get the configuration and merge with that of the 
base group.

But the pattern does not seem to be working. Is it possible to load and merge 
the configurations just only using the config.xml files?

Please let me know if you have a better approach.

Parameters params = new Parameters();
           MultiFileBuilderParameters multiParam = 
params.multiFile().setFilePattern("${GROUP_ID}/ 
app_settings.properties").setManagedBuilderParameters(params.fileBased().setBasePath("C:/a_container/MyApp/"));
           MultiFileConfigurationBuilder<PropertiesConfiguration> builder = new 
MultiFileConfigurationBuilder(
                     PropertiesConfiguration.class).configure(multiParam);
     Map<String, Object> params1 = new HashedMap<String, Object>();
           params1.put("GROUP_ID", "987987");
           builder.setParameters(params1);
           Configuration conf = builder.getConfiguration();
           sopAllKeys((FileBasedConfiguration) conf);

Regards,
Ashok

_____________
The information contained in this message is proprietary and/or confidential. 
If you are not the intended recipient, please: (i) delete the message and all 
copies; (ii) do not disclose, distribute or use the message in any manner; and 
(iii) notify the sender immediately. In addition, please be aware that any 
message addressed to our domain is subject to archiving and review by persons 
other than the intended recipient. Thank you.

Reply via email to