}
@Override
public void setInto(Configuration conf) {
if (conf instanceof OpenJPAConfiguration) {
OpenJPAConfiguration oconf = (OpenJPAConfiguration) conf;
Object persistenceVersion = getProperties().get(PersistenceUnitInfoImpl.PERSISTENCE_VERSION);
if (persistenceVersion == null) {
oconf.setSpecification(SPEC_JPA);
} else {
// Set the spec level based on the persistence version
oconf.setSpecification("jpa " + persistenceVersion.toString());
}
// we merge several persistence.xml elements into the
// MetaDataFactory property implicitly. if the user has a
// global openjpa.xml with this property set, its value will
// get overwritten by our implicit setting. so instead, combine
// the global value with our settings
String orig = oconf.getMetaDataFactory();
if (!StringUtils.isEmpty(orig)) {
String key = ProductDerivations.getConfigurationKey("MetaDataFactory", getProperties());
Object override = getProperties().get(key);
if (override instanceof String)
addProperty(key, Configurations.combinePlugins(orig, (String) override));
}
}
super.setInto(conf, null);
// At this point user properties have been loaded into the configuration. Apply any modifications based off
// those.
if (conf instanceof OpenJPAConfiguration) {
OpenJPAConfiguration oconf = (OpenJPAConfiguration) conf;
// If the datacache is enabled, make sure we have a RemoteCommitProvider
String dc = oconf.getDataCache();
String rcp = oconf.getRemoteCommitProvider();
// If the datacache is set and is something other than false
if (dc != null && dc.equals("false") == false) {
// If RCP is null or empty, set it to sjvm.
if (rcp == null || (rcp != null && rcp.equals("") == false)) {
oconf.setRemoteCommitProvider("sjvm");
}
}
}
Log log = conf.getConfigurationLog();