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 2020/01/17 07:40:09 UTC

[isis] 03/06: ISIS-2264: removes some redundant code in DN bootstrapping

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

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

commit 6139311636610665f7bf1f8c7521f44e766b800b
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jan 17 08:11:28 2020 +0100

    ISIS-2264: removes some redundant code in DN bootstrapping
    
    these config props already have default values in IsisConfiguration, so no need to force them in programmatically also.  Instead we just use javax validation to ensure they are not overridden to an empty or null value etc.
---
 .../org/apache/isis/core/config/IsisConfiguration.java    |  5 +++++
 .../persistence/PersistenceSessionFactory5.java           | 15 ---------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/core/config/src/main/java/org/apache/isis/core/config/IsisConfiguration.java b/core/config/src/main/java/org/apache/isis/core/config/IsisConfiguration.java
index a15a3bc..2c59e0f 100644
--- a/core/config/src/main/java/org/apache/isis/core/config/IsisConfiguration.java
+++ b/core/config/src/main/java/org/apache/isis/core/config/IsisConfiguration.java
@@ -31,6 +31,8 @@ import java.util.regex.Pattern;
 import javax.inject.Inject;
 import javax.inject.Named;
 import javax.validation.constraints.Email;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -1169,6 +1171,7 @@ public class IsisConfiguration {
                              *
                              * @implNote - this config property isn't used by the framework, but is provided as a convenience for IDE autocomplete.
                              */
+                            @NotNull @NotEmpty
                             private String type = "none";
                         }
                     }
@@ -1182,6 +1185,7 @@ public class IsisConfiguration {
                          *     See also <tt>additional-spring-configuration-metadata.json</tt> (change casing).
                          * </p>
                          */
+                        @NotNull @NotEmpty
                         private String className = "org.apache.isis.persistence.jdo.datanucleus5.datanucleus.JDOStateManagerForIsis";
                     }
                     private final Schema schema = new Schema();
@@ -1241,6 +1245,7 @@ public class IsisConfiguration {
                          *
                          * @implNote - changing this property from its default is used to enable the flyway extension (in combination with {@link Datanucleus.Schema#isAutoCreateAll()}
                          */
+                        @NotNull @NotEmpty
                         private String persistenceManagerFactoryClass = "org.datanucleus.api.jdo.JDOPersistenceManagerFactory";
 
                         private final Option option = new Option();
diff --git a/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/persistence/PersistenceSessionFactory5.java b/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/persistence/PersistenceSessionFactory5.java
index 017ea91..f435b12 100644
--- a/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/persistence/PersistenceSessionFactory5.java
+++ b/persistence/jdo/datanucleus-5/src/main/java/org/apache/isis/persistence/jdo/datanucleus5/persistence/PersistenceSessionFactory5.java
@@ -135,19 +135,6 @@ implements PersistenceSessionFactory, FixturesInstalledStateHolder {
         props.putAll(dnSettings.getAsMap());
         DataNucleusContextUtil.putMetaModelContext(props, metaModelContext);
 
-        // new feature in DN 3.2.3; enables dependency injection into entities
-        putIfNotPresent(props, PropertyNames.PROPERTY_OBJECT_PROVIDER_CLASS_NAME, JDOStateManagerForIsis.class.getName());
-        
-        putIfNotPresent(props, "javax.jdo.PersistenceManagerFactoryClass", JDOPersistenceManagerFactory.class.getName());
-
-        // previously we defaulted this property to "true", but that could cause the target database to be modified
-        putIfNotPresent(props, PropertyNames.PROPERTY_SCHEMA_AUTOCREATE_DATABASE, Boolean.FALSE.toString());
-
-        putIfNotPresent(props, PropertyNames.PROPERTY_SCHEMA_VALIDATE_ALL, Boolean.TRUE.toString());
-        putIfNotPresent(props, PropertyNames.PROPERTY_CACHE_L2_TYPE, "none");
-
-        putIfNotPresent(props, PropertyNames.PROPERTY_PERSISTENCE_UNIT_LOAD_CLASSES, Boolean.TRUE.toString());
-
         String connectionFactoryName = (String) props.get(PropertyNames.PROPERTY_CONNECTION_FACTORY_NAME);
         if(connectionFactoryName != null) {
             String connectionFactory2Name = (String) props.get(PropertyNames.PROPERTY_CONNECTION_FACTORY2_NAME);
@@ -180,8 +167,6 @@ implements PersistenceSessionFactory, FixturesInstalledStateHolder {
                 log.info("using JDBC connection '{}'", 
                         props.get("javax.jdo.option.ConnectionURL"));
             }
-
-
         }
         
         return props;