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 2021/05/26 09:51:46 UTC

[isis] branch master updated: ISIS-2631: config: rename explicitObjectType -> explicitLogicalTypeName

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 c9a8fe3  ISIS-2631: config: rename explicitObjectType -> explicitLogicalTypeName
c9a8fe3 is described below

commit c9a8fe3d8263ad3688f764fc24f886d67887dc07
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed May 26 11:51:32 2021 +0200

    ISIS-2631: config: rename explicitObjectType -> explicitLogicalTypeName
    
    removed: isis.core.meta-model.validator.ensure-unique-object-types
---
 .../modules/ROOT/pages/2021/2.0.0-M6/mignotes.adoc | 11 ++++++
 .../sections/isis.core.meta-model.validator.adoc   | 16 ++-------
 .../apache/isis/core/config/IsisConfiguration.java | 21 +++--------
 .../core/config/beans/IsisBeanTypeClassifier.java  | 10 +++---
 .../beans/IsisComponentScanInterceptorImpl.java    |  2 +-
 .../DomainObjectAnnotationFacetFactory.java        |  4 +--
 ...ObjectTypeFacetDerivedFromClassNameFactory.java |  4 +--
 .../demo/domain/src/main/resources/application.yml |  2 +-
 .../domainmodel/SpecloaderPerformanceTest.java     | 42 +++++++++++-----------
 .../isis/testdomain/model/good/MixinConcrete.java  |  3 --
 10 files changed, 48 insertions(+), 67 deletions(-)

diff --git a/antora/components/relnotes/modules/ROOT/pages/2021/2.0.0-M6/mignotes.adoc b/antora/components/relnotes/modules/ROOT/pages/2021/2.0.0-M6/mignotes.adoc
index fbbfb7f..cb88b3c 100644
--- a/antora/components/relnotes/modules/ROOT/pages/2021/2.0.0-M6/mignotes.adoc
+++ b/antora/components/relnotes/modules/ROOT/pages/2021/2.0.0-M6/mignotes.adoc
@@ -33,6 +33,17 @@ there is no counterpart for _Collection_
 
 |===
 
+== Configuration
+
+Following configuration options changed:
+[source,java]
+----
+isis.core.meta-model.validator.ensure-unique-object-types // removed
+
+isis.core.meta-model.validator.explicit-object-type // renamed to ...
+isis.core.meta-model.validator.explicit-logical-type-names 
+----
+
 == Other Changes
 
 Module `IsisModuleExtCorsImpl` was renamed to `IsisModuleExtCors`. 
diff --git a/core/config/src/main/adoc/modules/config/pages/sections/isis.core.meta-model.validator.adoc b/core/config/src/main/adoc/modules/config/pages/sections/isis.core.meta-model.validator.adoc
index daaa5d7..d813cfe 100644
--- a/core/config/src/main/adoc/modules/config/pages/sections/isis.core.meta-model.validator.adoc
+++ b/core/config/src/main/adoc/modules/config/pages/sections/isis.core.meta-model.validator.adoc
@@ -33,22 +33,10 @@ If not allowed, then metamodel validation errors will be flagged.
 
 Note that this settings has no effect if the programming model has been configured to ignore deprecated features (because in this case the programming model facets simply won't be included in the introspection process.
 
-
-|
-[[isis.core.meta-model.validator.ensure-unique-object-types]]
-isis.core.meta-model.validator. +
-ensure-unique-object-types
-
-|  true
-| Whether to ensure that the object type of all objects (which can be set either explicitly using ``DomainObject#logicalTypeName()`` or ``DomainService#logicalTypeName()``, or can be inferred implicitly using a variety of mechanisms) must be unique with respect to all other object types.
-
-It is _highly advisable_ to leave this set as enabled (the default), and to also use explicit types (see ``#isExplicitObjectType()``.
-
-
 |
-[[isis.core.meta-model.validator.explicit-object-type]]
+[[isis.core.meta-model.validator.explicit-logical-type-names]]
 isis.core.meta-model.validator. +
-explicit-object-type
+explicit-logical-type-names
 
 | 
 | Whether to ensure that the object type of all objects must be specified explicitly, using either ``DomainObject#logicalTypeName()`` or ``DomainService#logicalTypeName()``.
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 64e4012..d6bb853 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
@@ -1338,18 +1338,6 @@ public class IsisConfiguration {
                 private boolean allowDeprecated = true;
 
                 /**
-                 * Whether to ensure that the object type of all objects (which can be set either explicitly using
-                 * {@link DomainObject#logicalTypeName()} or {@link DomainService#logicalTypeName()}, or can be inferred
-                 * implicitly using a variety of mechanisms) must be unique with respect to all other object types.
-                 *
-                 * <p>
-                 *     It is <i>highly advisable</i> to leave this set as enabled (the default), and to also use
-                 *     explicit types (see {@link #isExplicitObjectType()}.
-                 * </p>
-                 */
-                private boolean ensureUniqueObjectTypes = true;
-
-                /**
                  * If set, then checks that the supports <code>hideXxx</code> and <code>disableXxx</code> methods for
                  * actions do not have take parameters.
                  *
@@ -1379,16 +1367,15 @@ public class IsisConfiguration {
                 private boolean actionCollectionParameterChoices = true;
 
                 /**
-                 * Whether to ensure that the object type of all objects must be specified explicitly, using either
+                 * Whether to ensure that the logical-type-name of all objects must be specified explicitly, using either
                  * {@link DomainObject#logicalTypeName()} or {@link DomainService#logicalTypeName()}.
                  *
                  * <p>
-                 *     It is <i>highly advisable</i> to leave this set as enabled (the default).  These object types
-                 *     should also (of course) be unique - that can be checked by setting the
-                 *     {@link #isEnsureUniqueObjectTypes()} config property.
+                 *     It is <i>highly advisable</i> to leave this set as enabled (the default). These logical-type-names
+                 *     should also (of course) be unique - among non-abstract types.
                  * </p>
                  */
-                private boolean explicitObjectType = false;
+                private boolean explicitLogicalTypeNames = false;
 
                 private final JaxbViewModel jaxbViewModel = new JaxbViewModel();
                 @Data
diff --git a/core/config/src/main/java/org/apache/isis/core/config/beans/IsisBeanTypeClassifier.java b/core/config/src/main/java/org/apache/isis/core/config/beans/IsisBeanTypeClassifier.java
index 17a8191..f3b7703 100644
--- a/core/config/src/main/java/org/apache/isis/core/config/beans/IsisBeanTypeClassifier.java
+++ b/core/config/src/main/java/org/apache/isis/core/config/beans/IsisBeanTypeClassifier.java
@@ -69,21 +69,21 @@ public interface IsisBeanTypeClassifier {
     public static class BeanClassification {
 
         BeanSort beanSort;
-        String explicitObjectType;
+        String explicitLogicalTypeName;
         boolean delegateLifecycleManagement;
 
         // -- FACTORIES
 
-        public static BeanClassification delegated(BeanSort beanSort, String explicitObjectType) {
-            return of(beanSort, explicitObjectType, true);
+        public static BeanClassification delegated(BeanSort beanSort, String explicitLogicalTypeName) {
+            return of(beanSort, explicitLogicalTypeName, true);
         }
 
         public static BeanClassification delegated(BeanSort beanSort) {
             return delegated(beanSort, null);
         }
 
-        public static BeanClassification selfManaged(BeanSort beanSort, String explicitObjectType) {
-            return of(beanSort, explicitObjectType, false);
+        public static BeanClassification selfManaged(BeanSort beanSort, String explicitLogicalTypeName) {
+            return of(beanSort, explicitLogicalTypeName, false);
         }
 
         public static BeanClassification selfManaged(BeanSort beanSort) {
diff --git a/core/config/src/main/java/org/apache/isis/core/config/beans/IsisComponentScanInterceptorImpl.java b/core/config/src/main/java/org/apache/isis/core/config/beans/IsisComponentScanInterceptorImpl.java
index 3eff04b..acdc89c 100644
--- a/core/config/src/main/java/org/apache/isis/core/config/beans/IsisComponentScanInterceptorImpl.java
+++ b/core/config/src/main/java/org/apache/isis/core/config/beans/IsisComponentScanInterceptorImpl.java
@@ -84,7 +84,7 @@ implements IsisComponentScanInterceptor {
         val delegated = classification.isDelegateLifecycleManagement();
         typeMeta.setInjectable(delegated);
         if(delegated) {
-            typeMeta.setBeanNameOverride(classification.getExplicitObjectType());
+            typeMeta.setBeanNameOverride(classification.getExplicitLogicalTypeName());
         }
 
         val beanSort = classification.getBeanSort();
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
index 64a0ff5..1ceba77 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/domainobject/DomainObjectAnnotationFacetFactory.java
@@ -491,9 +491,7 @@ implements
 
     @Override
     public void refineProgrammingModel(ProgrammingModel programmingModel) {
-        if(getConfiguration().getCore().getMetaModel().getValidator().isEnsureUniqueObjectTypes()) {
-            addValidatorToEnsureUniqueLogicalTypeNames(programmingModel);
-        }
+        addValidatorToEnsureUniqueLogicalTypeNames(programmingModel);
     }
 
     private void addValidatorToEnsureUniqueLogicalTypeNames(ProgrammingModel pm) {
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/logicaltype/classname/ObjectTypeFacetDerivedFromClassNameFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/logicaltype/classname/ObjectTypeFacetDerivedFromClassNameFactory.java
index 2b3008e..2781433 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/logicaltype/classname/ObjectTypeFacetDerivedFromClassNameFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/object/logicaltype/classname/ObjectTypeFacetDerivedFromClassNameFactory.java
@@ -109,7 +109,7 @@ implements MetaModelRefiner, ObjectTypeFacetFactory {
     @Override
     public void refineProgrammingModel(ProgrammingModel programmingModel) {
 
-        val shouldCheck = getConfiguration().getCore().getMetaModel().getValidator().isExplicitObjectType();
+        val shouldCheck = getConfiguration().getCore().getMetaModel().getValidator().isExplicitLogicalTypeNames();
         if(!shouldCheck) {
             return;
         }
@@ -131,7 +131,7 @@ implements MetaModelRefiner, ObjectTypeFacetFactory {
                                 + "Use @Discriminator, @DomainObject(logicalTypeName=...) or "
                                 + "@PersistenceCapable(schema=...) to specify explicitly.",
                         objectSpec.getFullIdentifier(),
-                        "isis.core.meta-model.validator.explicit-object-type");
+                        "isis.core.meta-model.validator.explicit-logical-type-names");
             }
 
             });
diff --git a/examples/demo/domain/src/main/resources/application.yml b/examples/demo/domain/src/main/resources/application.yml
index 0f2ec94..561695f 100644
--- a/examples/demo/domain/src/main/resources/application.yml
+++ b/examples/demo/domain/src/main/resources/application.yml
@@ -54,7 +54,7 @@ isis:
       validator:
         allow-deprecated: false
         no-params-only: true
-        explicit-object-type: true
+        explicit-logical-type-names: true
         service-actions-only: true
         mixins-only: true
       introspector:
diff --git a/regressiontests/incubating/src/test/java/org/apache/isis/testdomain/domainmodel/SpecloaderPerformanceTest.java b/regressiontests/incubating/src/test/java/org/apache/isis/testdomain/domainmodel/SpecloaderPerformanceTest.java
index 4edb644..00598e6 100644
--- a/regressiontests/incubating/src/test/java/org/apache/isis/testdomain/domainmodel/SpecloaderPerformanceTest.java
+++ b/regressiontests/incubating/src/test/java/org/apache/isis/testdomain/domainmodel/SpecloaderPerformanceTest.java
@@ -47,13 +47,13 @@ import lombok.val;
 import lombok.extern.log4j.Log4j2;
 
 @SpringBootTest(
-        classes = { 
+        classes = {
                 Configuration_headless.class,
                 Configuration_usingValidDomain.class
-        }, 
+        },
         properties = {
                 "isis.core.meta-model.introspector.mode=FULL",
-                "isis.core.meta-model.validator.explicit-object-type=FALSE", // does not override any of the imports
+                "isis.core.meta-model.validator.explicit-logical-type-names=FALSE", // does not override any of the imports
         })
 @TestPropertySource({
     IsisPresets.SilenceMetaModel,
@@ -63,33 +63,33 @@ import lombok.extern.log4j.Log4j2;
 //XXX not a real test, just for performance tuning
 @Log4j2
 class SpecloaderPerformanceTest {
-    
+
     @Inject private IsisConfiguration config;
     @Inject private SpecificationLoader specificationLoader;
-    
+
     private final _Lazy<Set<String>> referenceMetamodelSummary = _Lazy.threadSafe(()->
-        MetamodelUtil.featuresSummarized(specificationLoader.snapshotSpecifications())); 
-    
+        MetamodelUtil.featuresSummarized(specificationLoader.snapshotSpecifications()));
+
     @BeforeEach
     void setup() {
         config.getCore().getMetaModel().getIntrospector().setParallelize(false);
         referenceMetamodelSummary.get(); // memoize
         config.getCore().getMetaModel().getIntrospector().setParallelize(true);
-        
+
         _Probe.errOut("========================== SETUP DONE ===================================");
-        
+
     }
-    
+
     static long ITERATIONS = 100; /* should typically run in ~10s */
     static long EXPECTED_MILLIS_PER_ITERATION = 100;
-    
+
     @Test
     void concurrentSpecloading_shouldYieldSameMetamodelAsSequential() {
         _Annotations.clearCache();
         specificationLoader.disposeMetaModel();
         specificationLoader.createMetaModel();
         val mmSummary = MetamodelUtil.featuresSummarized(specificationLoader.snapshotSpecifications());
-        
+
         val missingFeatures = _Sets.minus(referenceMetamodelSummary.get(), mmSummary);
         if(!missingFeatures.isEmpty()) {
             System.err.println(String.format("%d missing features", missingFeatures.size()));
@@ -99,29 +99,29 @@ class SpecloaderPerformanceTest {
         }
         assertEquals(Collections.<String>emptySet(), missingFeatures);
     }
-    
+
     @Test @Tag("LongRunning")
     void repeatedConcurrentSpecloading_shouldNotDeadlock() {
-        
-        
-        
+
+
+
         val timeOutMillis = ITERATIONS * EXPECTED_MILLIS_PER_ITERATION;
         val goodUntilMillis = System.currentTimeMillis() + timeOutMillis;
-        
+
         val repeatedRun = (Runnable)()->{
-        
+
             for(int i=0; i<ITERATIONS; ++i) {
                 _Annotations.clearCache();
                 specificationLoader.disposeMetaModel();
                 specificationLoader.createMetaModel();
-           
+
                 if(System.currentTimeMillis() > goodUntilMillis) {
                     fail("timed out");
                 }
             }
-            
+
         };
-        
+
         _Timing.runVerbose(log, "Repeated Concurrent Specloading", repeatedRun);
     }
 
diff --git a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/MixinConcrete.java b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/MixinConcrete.java
index 9e10be7..890e667 100644
--- a/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/MixinConcrete.java
+++ b/regressiontests/stable/src/main/java/org/apache/isis/testdomain/model/good/MixinConcrete.java
@@ -44,7 +44,4 @@ extends MixinAbstract {
         return null;
     }
 
-
-
-
 }