Always use a ConfigurationProvider that supplies a spec.

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@454191 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
A. Abram White 2006-10-08 19:05:15 +00:00
parent d490f545c4
commit 0bc4acc2af
3 changed files with 15 additions and 5 deletions

View File

@ -95,7 +95,7 @@ public class Bootstrap {
}
}
private static BrokerFactory invokeFactory (ConfigurationProvider conf,
private static BrokerFactory invokeFactory(ConfigurationProvider conf,
ClassLoader loader, String methodName)
throws InvocationTargetException, NoSuchMethodException,
IllegalAccessException {

View File

@ -165,7 +165,8 @@ public class OpenJPAPersistence
* overrides.
*/
public static OpenJPAEntityManagerFactory getEntityManagerFactory(Map map) {
ConfigurationProvider cp = new MapConfigurationProvider(map);
ConfigurationProvider cp = new PersistenceProductDerivation.
ConfigurationProviderImpl(map);
try {
return toEntityManagerFactory(Bootstrap.getBrokerFactory(cp, null));
} catch (Exception e) {

View File

@ -355,11 +355,18 @@ public class PersistenceProductDerivation
/**
* Custom configuration provider.
*/
private static class ConfigurationProviderImpl
public static class ConfigurationProviderImpl
extends MapConfigurationProvider {
private String _source;
public ConfigurationProviderImpl() {
}
public ConfigurationProviderImpl(Map props) {
super(props);
}
/**
* Set the source of information in this provider.
*/
@ -374,8 +381,10 @@ public class PersistenceProductDerivation
super.setInto(conf, null);
Log log = conf.getConfigurationLog();
if (log.isTraceEnabled())
log.trace(_loc.get("conf-load", _source, getProperties()));
if (log.isTraceEnabled()) {
String src = (_source == null) ? "?" : _source;
log.trace(_loc.get("conf-load", src, getProperties()));
}
}
}