if (descriptor == null) {
throw new ConfigurationException("The form descriptor is not set!");
}
synchronized (AbstractComplementaryConfigurableAction.configurations) {
Source resource = null;
try {
resource = resolver.resolve(descriptor);
conf = (ConfigurationHelper) AbstractComplementaryConfigurableAction.configurations.get(resource.getSystemId());
if (conf == null || (reloadable && conf.lastModified != resource.getLastModified())) {
getLogger().debug("(Re)Loading " + descriptor);
if (conf == null) {
conf = new ConfigurationHelper();
}
SAXConfigurationHandler builder = new SAXConfigurationHandler();
resource.toSAX(builder);
conf.lastModified = resource.getLastModified();
conf.configuration = builder.getConfiguration();
AbstractComplementaryConfigurableAction.configurations.put(resource.getSystemId(), conf);
} else {
getLogger().debug("Using cached configuration for " + descriptor);
}
} catch (Exception e) {
getLogger().error("Could not configure Database mapping environment", e);
throw new ConfigurationException("Error trying to load configurations for resource: "
+ (resource == null ? "null" : resource.getSystemId()));
} finally {
if (resource != null) resource.recycle();
}
}
return conf.configuration;
}