You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2019/10/03 22:29:23 UTC
[isis] 03/03: ISIS-2086: uses type-safe config for lookup of
ConnectionURL
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch ISIS-2086
in repository https://gitbox.apache.org/repos/asf/isis.git
commit bbc57e8e861999f567506a0c7050f9595029f5e3
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Oct 3 23:25:58 2019 +0100
ISIS-2086: uses type-safe config for lookup of ConnectionURL
---
.../java/org/apache/isis/jdo/persistence/DNStoreManagerType.java | 9 +++++----
.../isis/jdo/persistence/DataNucleusApplicationComponents5.java | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/DNStoreManagerType.java b/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/DNStoreManagerType.java
index fb395e7..fcb45e2 100644
--- a/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/DNStoreManagerType.java
+++ b/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/DNStoreManagerType.java
@@ -21,6 +21,7 @@ package org.apache.isis.jdo.persistence;
import java.util.Map;
import java.util.function.Function;
+import org.apache.isis.config.IsisConfiguration;
import org.datanucleus.PersistenceNucleusContext;
import org.datanucleus.api.jdo.JDOPersistenceManagerFactory;
import org.datanucleus.store.StoreManager;
@@ -42,13 +43,13 @@ enum DNStoreManagerType {
Other
;
- public static DNStoreManagerType typeOf(Map<String,String> datanucleusProps) {
+ public static DNStoreManagerType typeOf(Map<String, String> datanucleusProps, IsisConfiguration configuration) {
if(hasSecondaryDataStore(datanucleusProps)) {
return Federated;
}
- if(isKnownSchemaAwareStoreManagerIfNotFederated(datanucleusProps)) {
+ if(isKnownSchemaAwareStoreManagerIfNotFederated(configuration)) {
return SchemaAware;
}
@@ -91,12 +92,12 @@ enum DNStoreManagerType {
return hasSecondaryDataStore;
}
- private static boolean isKnownSchemaAwareStoreManagerIfNotFederated(Map<String,String> datanucleusProps) {
+ private static boolean isKnownSchemaAwareStoreManagerIfNotFederated(IsisConfiguration configuration) {
// this saves some time, but also avoids the (still undiagnosed) issue that instantiating the
// PMF can cause the ClassMetadata for the entity classes to be loaded in and cached prior to
// registering the CreateSchemaObjectFromClassData (to invoke 'create schema' first)
- final String connectionUrl = datanucleusProps.get("javax.jdo.option.ConnectionURL");
+ final String connectionUrl = configuration.getPersistor().getDatanucleus().getImpl().getJavax().getJdo().getOption().getConnectionUrl();
if(connectionUrl != null) {
for(String magic : knownSchemaAwareIfNotFederated) {
if (connectionUrl.startsWith(magic)) {
diff --git a/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/DataNucleusApplicationComponents5.java b/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/DataNucleusApplicationComponents5.java
index 1737484..53dd9c1 100644
--- a/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/DataNucleusApplicationComponents5.java
+++ b/core/plugins/jdo/datanucleus-5/src/main/java/org/apache/isis/jdo/persistence/DataNucleusApplicationComponents5.java
@@ -126,7 +126,7 @@ public class DataNucleusApplicationComponents5 implements ApplicationScopedCompo
final Set<String> persistableClassNameSet,
final Map<String, String> datanucleusProps) {
- final DNStoreManagerType dnStoreManagerType = DNStoreManagerType.typeOf(datanucleusProps);
+ final DNStoreManagerType dnStoreManagerType = DNStoreManagerType.typeOf(datanucleusProps, configuration);
PersistenceManagerFactory persistenceManagerFactory;