mirror of https://github.com/apache/openjpa.git
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:
parent
d490f545c4
commit
0bc4acc2af
|
@ -95,7 +95,7 @@ public class Bootstrap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BrokerFactory invokeFactory (ConfigurationProvider conf,
|
private static BrokerFactory invokeFactory(ConfigurationProvider conf,
|
||||||
ClassLoader loader, String methodName)
|
ClassLoader loader, String methodName)
|
||||||
throws InvocationTargetException, NoSuchMethodException,
|
throws InvocationTargetException, NoSuchMethodException,
|
||||||
IllegalAccessException {
|
IllegalAccessException {
|
||||||
|
|
|
@ -165,7 +165,8 @@ public class OpenJPAPersistence
|
||||||
* overrides.
|
* overrides.
|
||||||
*/
|
*/
|
||||||
public static OpenJPAEntityManagerFactory getEntityManagerFactory(Map map) {
|
public static OpenJPAEntityManagerFactory getEntityManagerFactory(Map map) {
|
||||||
ConfigurationProvider cp = new MapConfigurationProvider(map);
|
ConfigurationProvider cp = new PersistenceProductDerivation.
|
||||||
|
ConfigurationProviderImpl(map);
|
||||||
try {
|
try {
|
||||||
return toEntityManagerFactory(Bootstrap.getBrokerFactory(cp, null));
|
return toEntityManagerFactory(Bootstrap.getBrokerFactory(cp, null));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -355,11 +355,18 @@ public class PersistenceProductDerivation
|
||||||
/**
|
/**
|
||||||
* Custom configuration provider.
|
* Custom configuration provider.
|
||||||
*/
|
*/
|
||||||
private static class ConfigurationProviderImpl
|
public static class ConfigurationProviderImpl
|
||||||
extends MapConfigurationProvider {
|
extends MapConfigurationProvider {
|
||||||
|
|
||||||
private String _source;
|
private String _source;
|
||||||
|
|
||||||
|
public ConfigurationProviderImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigurationProviderImpl(Map props) {
|
||||||
|
super(props);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the source of information in this provider.
|
* Set the source of information in this provider.
|
||||||
*/
|
*/
|
||||||
|
@ -374,8 +381,10 @@ public class PersistenceProductDerivation
|
||||||
super.setInto(conf, null);
|
super.setInto(conf, null);
|
||||||
|
|
||||||
Log log = conf.getConfigurationLog();
|
Log log = conf.getConfigurationLog();
|
||||||
if (log.isTraceEnabled())
|
if (log.isTraceEnabled()) {
|
||||||
log.trace(_loc.get("conf-load", _source, getProperties()));
|
String src = (_source == null) ? "?" : _source;
|
||||||
|
log.trace(_loc.get("conf-load", src, getProperties()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue