/** * Load in a single property data source, or a "config.xml" descriptor file (specifying multiple * data sources). Properties are added to the global composite property data set. * * <p> * * <p>N.B. Due to underlying Jakarta (commons configuration) implementation, any previously loaded * properties (with duplicate keys) will override subsequently loaded properties. ie clients * should load in override (eg user) data before loading default (eg core) data. * * <p> * * <p>N.B. Also system properties are currently loaded before any calls to loadPropertyData, so * they take precedence over everything. * * @param listName the path name of the property data source. If the name ends in "config.xml" * then the file is treated as a Jakarta commons configuration descriptor file. If the file * ends in ".xml" it is loaded as a Jakarta XML property configuration file. Otherwise it is * loaded as a legacy flat-file key-value pair plain text property file. N.B. Although Jakarta * supports other data sources, eg JDBC, these are not yet supported via this method. * @throws ConfigurationException * @see gda.configuration.properties.PropertiesConfig#loadPropertyData(java.lang.String) */ @Override public void loadPropertyData(String listName) throws ConfigurationException { Configuration userConfig = null; if (listName.contains(".xml")) { if (listName.endsWith("config.xml")) { // ***** // FIXME 'ConfigurationFactory' should be replaced with the new and improved // 'DefaultConfigurationBuilder' // ***** // create a JCC configuration factory from a JCC config descriptor // file and make a JCC configuration interface/object from it ConfigurationFactory factory = new ConfigurationFactory(); // README - fix to get relative paths in config.xml working. // See comment for this method for explanation. configFactoryBasePathBugWorkaround(factory, listName); // now try to load in config.xml - relative paths should now work factory.setConfigurationFileName(listName); userConfig = factory.getConfiguration(); } else { // load a JCC XML-format property file userConfig = new XMLConfiguration(listName); } } else { if (listName.contains(".properties")) { // load a classic java properties flat-textfile, // containing just name-value pairs - with extended JCC syntax userConfig = new PropertiesConfiguration(listName); } } if (userConfig != null) { config.addConfiguration(userConfig); configMap.put(listName, userConfig); } }