/** * Creates a copy of this configuration. The new configuration object will contain the same * properties as the original, but it will lose any connection to a source file (if one exists); * this includes setting the source URL, base path, and file name to <b>null</b>. This is done to * avoid race conditions if both the original and the copy are modified and then saved. * * @return the copy * @since 1.3 */ public Object clone() { AbstractFileConfiguration copy = (AbstractFileConfiguration) super.clone(); copy.setBasePath(null); copy.setFileName(null); copy.initReloadingStrategy(); return copy; }
private Configuration _addPropertiesSource( String sourceName, URL url, CompositeConfiguration loadedCompositeConfiguration) { try { Configuration newConfiguration = null; if (DatasourceURL.isDatasource(sourceName)) { newConfiguration = _addDatasourceProperties(sourceName); } else if (JndiURL.isJndi(sourceName)) { newConfiguration = _addJNDIProperties(sourceName); } else if (url != null) { newConfiguration = _addURLProperties(url, loadedCompositeConfiguration); } else { newConfiguration = _addFileProperties(sourceName, loadedCompositeConfiguration); } if (newConfiguration == null) { return newConfiguration; } loadedCompositeConfiguration.addConfiguration(newConfiguration); super.addConfiguration(newConfiguration); if (newConfiguration instanceof AbstractFileConfiguration) { AbstractFileConfiguration abstractFileConfiguration = (AbstractFileConfiguration) newConfiguration; URL abstractFileConfigurationURL = abstractFileConfiguration.getURL(); _loadedSources.add(abstractFileConfigurationURL.toString()); } else { _loadedSources.add(sourceName); } return newConfiguration; } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug("Configuration source " + sourceName + " ignored: " + e.getMessage()); } return null; } }