};
//TODO requires rework to put all the changes that a service may introduce into one transaction
//the solution is to put the loop into the apply method... But it would be some fine amount of work
for (final ConfigBeanDefaultValue configBeanDefaultValue : values) {
final ConfigBeanProxy parent = configModularityUtils.getOwningObject(configBeanDefaultValue.getLocation());
if (parent == null) continue;
ConfigurationPopulator populator = null;
if (replaceSystemProperties)
try {
populator = new ConfigurationPopulator(
configModularityUtils.replacePropertiesWithCurrentValue(
configBeanDefaultValue.getXmlConfiguration(), configBeanDefaultValue)
, doc, parent);
} catch (Exception e) {
LOG.log(Level.SEVERE, ConfigApiLoggerInfo.CFG_EXT_ADD_FAILED, e);
}
else {
//Check that parent is not null!
populator = new ConfigurationPopulator(configBeanDefaultValue.getXmlConfiguration(), doc, parent);
}
populator.run(configParser);
synchronized (configModularityUtils) {
boolean oldValue = configModularityUtils.isIgnorePersisting();
try {
Class configBeanClass = configModularityUtils.getClassForFullName(configBeanDefaultValue.getConfigBeanClassName());
final ConfigBeanProxy pr = doc.getRoot().createProxy(configBeanClass);
configModularityUtils.setIgnorePersisting(true);
ConfigSupport.apply(new SingleConfigCode<ConfigBeanProxy>() {
public Object run(ConfigBeanProxy param) throws PropertyVetoException, TransactionFailure {
configModularityUtils.setConfigBean(pr, configBeanDefaultValue, param);
return param;