You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2018/03/14 15:55:29 UTC

[isis] branch master updated: ISIS-1902 consistently apply Isis' default class loader on PMF creation (DN-4 plugin as well)

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 1e78313  ISIS-1902 consistently apply Isis' default class loader on PMF creation (DN-4 plugin as well)
1e78313 is described below

commit 1e78313631df3a751aff558764ce2dbc5b46a855
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Mar 14 16:55:25 2018 +0100

    ISIS-1902 consistently apply Isis' default class loader on PMF creation
    (DN-4 plugin as well)
---
 .../persistence/DataNucleusApplicationComponents4.java | 18 +++++++++++-------
 .../persistence/DataNucleusApplicationComponents5.java |  1 -
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/core/plugins/jdo-datanucleus-4/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents4.java b/core/plugins/jdo-datanucleus-4/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents4.java
index d6a0608..5a89d8c 100644
--- a/core/plugins/jdo-datanucleus-4/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents4.java
+++ b/core/plugins/jdo-datanucleus-4/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents4.java
@@ -124,13 +124,18 @@ public class DataNucleusApplicationComponents4 implements ApplicationScopedCompo
     		persistenceManagerFactory = null;
     	}
     }
-
+    
+    private static PersistenceManagerFactory newPersistenceManagerFactory(Map<String, String> datanucleusProps) {
+    	return JDOHelper.getPersistenceManagerFactory(datanucleusProps, IsisContext.getClassLoader());
+    }
+    
     private static boolean isSchemaAwareStoreManager(Map<String,String> datanucleusProps) {
 
         // we create a throw-away instance of PMF so that we can probe whether DN has
         // been configured with a schema-aware store manager or not.
-        final JDOPersistenceManagerFactory probePmf =
-                (JDOPersistenceManagerFactory)JDOHelper.getPersistenceManagerFactory(datanucleusProps);
+        final JDOPersistenceManagerFactory probePmf = 
+        		(JDOPersistenceManagerFactory) newPersistenceManagerFactory(datanucleusProps);
+                
         try {
             final PersistenceNucleusContext nucleusContext = probePmf.getNucleusContext();
             final StoreManager storeManager = nucleusContext.getStoreManager();
@@ -164,12 +169,11 @@ public class DataNucleusApplicationComponents4 implements ApplicationScopedCompo
                 datanucleusProps.put(PropertyNames.PROPERTY_SCHEMA_AUTOCREATE_COLUMNS, "true");
                 datanucleusProps.put(PropertyNames.PROPERTY_SCHEMA_AUTOCREATE_CONSTRAINTS, "true");
                 
-                persistenceManagerFactory = JDOHelper
-                		.getPersistenceManagerFactory(datanucleusProps,	IsisContext.getClassLoader() );
+                persistenceManagerFactory = newPersistenceManagerFactory(datanucleusProps);
                 createSchema(persistenceManagerFactory, persistableClassNameSet, datanucleusProps);
 
             } else {
-                persistenceManagerFactory = JDOHelper.getPersistenceManagerFactory(datanucleusProps);
+                persistenceManagerFactory = newPersistenceManagerFactory(datanucleusProps);
             }
 
         } else {
@@ -178,7 +182,7 @@ public class DataNucleusApplicationComponents4 implements ApplicationScopedCompo
             // otherwise NPEs occur later.
 
             configureAutoStart(persistableClassNameSet, datanucleusProps);
-            persistenceManagerFactory = JDOHelper.getPersistenceManagerFactory(this.datanucleusProps);
+            persistenceManagerFactory = newPersistenceManagerFactory(this.datanucleusProps);
         }
 
         return persistenceManagerFactory;
diff --git a/core/plugins/jdo-datanucleus-5/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents5.java b/core/plugins/jdo-datanucleus-5/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents5.java
index 0d361f1..4ed8a81 100644
--- a/core/plugins/jdo-datanucleus-5/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents5.java
+++ b/core/plugins/jdo-datanucleus-5/src/main/java/org/apache/isis/core/runtime/system/persistence/DataNucleusApplicationComponents5.java
@@ -18,7 +18,6 @@
  */
 package org.apache.isis.core.runtime.system.persistence;
 
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Set;

-- 
To stop receiving notification emails like this one, please contact
ahuber@apache.org.