Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@

import java.io.File;
import java.lang.reflect.Constructor;
import java.util.Map;
import java.util.Properties;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
import org.hibernate.boot.cfgxml.internal.ConfigLoader;
import org.hibernate.boot.cfgxml.spi.LoadedConfig;
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
import org.hibernate.tool.api.metadata.MetadataDescriptor;
import org.hibernate.tool.api.metadata.MetadataDescriptorFactory;
import org.hibernate.tool.api.metadata.MetadataConstants;
Expand Down Expand Up @@ -55,7 +59,7 @@ public JDBCConfigurationTask() {
setDescription("JDBC Configuration (for reverse engineering)");
}
protected MetadataDescriptor createMetadataDescriptor() {
Properties properties = loadPropertiesFile();
Properties properties = loadProperties();
RevengStrategy res = createReverseEngineeringStrategy();
properties.put(MetadataConstants.PREFER_BASIC_COMPOSITE_IDS, preferBasicCompositeIds);
return MetadataDescriptorFactory
Expand Down Expand Up @@ -121,8 +125,8 @@ public void setDetectManyToMany(boolean b) {
public void setDetectOptimisticLock(boolean b) {
detectOptimisticLock = b;
}
private RevengStrategy loadreverseEngineeringStrategy(final String className, RevengStrategy delegate)

private RevengStrategy loadreverseEngineeringStrategy(final String className, RevengStrategy delegate)
throws BuildException {
try {
Class<?> clazz = ReflectionUtil.classForName(className);
Expand All @@ -146,4 +150,21 @@ private RevengStrategy loadreverseEngineeringStrategy(final String className, Re
throw new BuildException("Could not create or find " + className + " with one argument delegate constructor", e);
}
}

private Map<String, Object> loadCfgXmlFile() {
return new ConfigLoader(new BootstrapServiceRegistryBuilder().build())
.loadConfigXmlFile(getConfigurationFile())
.getConfigurationValues();
}

private Properties loadProperties() {
Properties result = new Properties();
if (getPropertyFile() != null) {
result.putAll(loadPropertiesFile());
}
if (getConfigurationFile() != null) {
result.putAll(loadCfgXmlFile());
}
return result;
}
}