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/05 10:17:46 UTC

[isis] 02/02: ISIS-2250: sync-adoc

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 6b04900d6d47283d4ab2bc0f89fea56e0f60aeab
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Jan 5 10:15:45 2020 +0000

    ISIS-2250: sync-adoc
---
 .../examples/services/command/Command.java         |  2 +-
 .../examples/services/iactn/Interaction.java       | 56 +++++++++++++---------
 .../config/examples/generated/isis.reflector.adoc  | 18 ++++++-
 .../config/examples/generated/resteasy.adoc        |  9 ----
 .../SpecificationLoaderTestAbstract.java           |  1 +
 5 files changed, 51 insertions(+), 35 deletions(-)

diff --git a/core/applib/src/main/doc/modules/applib-svc/examples/services/command/Command.java b/core/applib/src/main/doc/modules/applib-svc/examples/services/command/Command.java
index fe83936..1eb9ff2 100644
--- a/core/applib/src/main/doc/modules/applib-svc/examples/services/command/Command.java
+++ b/core/applib/src/main/doc/modules/applib-svc/examples/services/command/Command.java
@@ -390,7 +390,7 @@ public interface Command extends HasUniqueId {
          * </p>
          *
          * See also {@link Interaction#getCurrentExecution()} and
-         * {@link Interaction.Execution#setStartedAt(Timestamp)}.
+         * {@link #setStartedAt(org.apache.isis.applib.services.clock.ClockService, org.apache.isis.applib.services.metrics.MetricsService)}.
          */
         void setStartedAt(Timestamp startedAt);
 
diff --git a/core/applib/src/main/doc/modules/applib-svc/examples/services/iactn/Interaction.java b/core/applib/src/main/doc/modules/applib-svc/examples/services/iactn/Interaction.java
index 4cb19a9..d53e822 100644
--- a/core/applib/src/main/doc/modules/applib-svc/examples/services/iactn/Interaction.java
+++ b/core/applib/src/main/doc/modules/applib-svc/examples/services/iactn/Interaction.java
@@ -27,10 +27,7 @@ import java.util.UUID;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.LongAdder;
 
-import javax.inject.Inject;
-
 import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.Value;
 import org.apache.isis.applib.events.domain.AbstractDomainEvent;
 import org.apache.isis.applib.events.domain.ActionDomainEvent;
 import org.apache.isis.applib.events.domain.PropertyDomainEvent;
@@ -40,7 +37,6 @@ import org.apache.isis.applib.services.command.Command;
 import org.apache.isis.applib.services.eventbus.EventBusService;
 import org.apache.isis.applib.services.metrics.MetricsService;
 import org.apache.isis.applib.services.wrapper.WrapperFactory;
-import org.apache.isis.applib.services.xactn.Transaction;
 import org.apache.isis.applib.util.schema.MemberExecutionDtoUtils;
 import org.apache.isis.commons.internal.collections._Lists;
 import org.apache.isis.commons.internal.collections._Maps;
@@ -54,6 +50,8 @@ import org.apache.isis.schema.ixn.v1.ObjectCountsDto;
 import org.apache.isis.schema.ixn.v1.PropertyEditDto;
 import org.apache.isis.schema.jaxbadapters.JavaSqlTimestampXmlGregorianCalendarAdapter;
 
+import lombok.val;
+
 /**
  * Represents an action invocation or property modification, resulting in some state change of the system.  It captures
  * not only the target object and arguments passed, but also builds up the call-graph, and captures metrics, eg
@@ -79,7 +77,6 @@ import org.apache.isis.schema.jaxbadapters.JavaSqlTimestampXmlGregorianCalendarA
  * </p>
  *
  */
-@Value
 public class Interaction implements HasUniqueId {
 
     // -- transactionId (property)
@@ -135,11 +132,13 @@ public class Interaction implements HasUniqueId {
     @Programmatic
     public Object execute(
             final MemberExecutor<ActionInvocation> memberExecutor,
-            final ActionInvocation actionInvocation) {
+            final ActionInvocation actionInvocation,
+            final ClockService clockService,
+            final MetricsService metricsService) {
 
         push(actionInvocation);
 
-        return executeInternal(memberExecutor, actionInvocation);
+        return executeInternal(memberExecutor, actionInvocation, clockService, metricsService);
     }
 
     /**
@@ -153,16 +152,20 @@ public class Interaction implements HasUniqueId {
     @Programmatic
     public Object execute(
             final MemberExecutor<PropertyEdit> memberExecutor,
-            final PropertyEdit propertyEdit) {
+            final PropertyEdit propertyEdit,
+            final ClockService clockService,
+            final MetricsService metricsService) {
 
         push(propertyEdit);
 
-        return executeInternal(memberExecutor, propertyEdit);
+        return executeInternal(memberExecutor, propertyEdit, clockService, metricsService);
     }
 
     private <T extends Execution<?,?>> Object executeInternal(
             final MemberExecutor<T> memberExecutor,
-            final T execution) {
+            final T execution,
+            final ClockService clockService,
+            final MetricsService metricsService) {
 
         // as a convenience, since in all cases we want the command to start when the first 
         // interaction executes, we populate the command here.
@@ -190,7 +193,7 @@ public class Interaction implements HasUniqueId {
             }
         } finally {
             final Timestamp completedAt = clockService.nowAsJavaSqlTimestamp();
-            pop(completedAt);
+            pop(completedAt, metricsService);
         }
     }
 
@@ -238,12 +241,14 @@ public class Interaction implements HasUniqueId {
      * </p>
      */
     @Programmatic
-    private Execution<?,?> pop(final Timestamp completedAt) {
+    private Execution<?,?> pop(
+            final Timestamp completedAt,
+            final MetricsService metricsService) {
         if(currentExecution == null) {
             throw new IllegalStateException("No current execution to pop");
         }
         final Execution<?,?> popped = currentExecution;
-        popped.setCompletedAt(completedAt);
+        popped.setCompletedAt(completedAt, metricsService);
 
         moveCurrentTo(currentExecution.getParent());
         return popped;
@@ -301,7 +306,7 @@ public class Interaction implements HasUniqueId {
          */
         PUBLISHED_EVENT,
         /**
-         * There may be multiple transactions within a given interaction, as per {@link Transaction#getSequence()}.
+         * There may be multiple transactions within a given interaction.
          */
         TRANSACTION,
         ;
@@ -483,8 +488,12 @@ public class Interaction implements HasUniqueId {
         }
 
         @Programmatic
-        public void setStartedAt(final Timestamp startedAt) {
-            syncMetrics(When.BEFORE, startedAt);
+        public Timestamp start(
+                final ClockService clockService,
+                final MetricsService metricsService) {
+            val startedAt = clockService.nowAsJavaSqlTimestamp();
+            syncMetrics(When.BEFORE, startedAt, metricsService);
+            return startedAt;
         }
 
 
@@ -499,8 +508,10 @@ public class Interaction implements HasUniqueId {
         /**
          * <b>NOT API</b>: intended to be called only by the framework.
          */
-        void setCompletedAt(final Timestamp completedAt) {
-            syncMetrics(When.AFTER, completedAt);
+        void setCompletedAt(
+                final Timestamp completedAt,
+                final MetricsService metricsService) {
+            syncMetrics(When.AFTER, completedAt, metricsService);
         }
 
 
@@ -651,8 +662,10 @@ public class Interaction implements HasUniqueId {
                     final int numberObjectsLoaded,
                     final int numberObjectsDirtied);
         }
-        private void syncMetrics(final When when, final Timestamp timestamp) {
-            final MetricsService metricsService = interaction.metricsService;
+        private void syncMetrics(
+                final When when,
+                final Timestamp timestamp,
+                final MetricsService metricsService) {
 
             final int numberObjectsLoaded = metricsService.numberObjectsLoaded();
             final int numberObjectsDirtied = metricsService.numberObjectsDirtied();
@@ -706,7 +719,4 @@ public class Interaction implements HasUniqueId {
         }
     }
 
-    @Inject MetricsService metricsService;
-    @Inject ClockService clockService;
-
 }
diff --git a/core/config/src/main/doc/modules/config/examples/generated/isis.reflector.adoc b/core/config/src/main/doc/modules/config/examples/generated/isis.reflector.adoc
index 762e19c..dd2c13a 100644
--- a/core/config/src/main/doc/modules/config/examples/generated/isis.reflector.adoc
+++ b/core/config/src/main/doc/modules/config/examples/generated/isis.reflector.adoc
@@ -4,12 +4,26 @@ explicit-annotations.action
 |  Whether or not a public method needs to be annotated with @{@link org.apache.isis.applib.annotation.Action} in order to be picked up as an action in the metamodel.
 
 | isis.reflector.introspector. +
+lock-after-full-introspection
+|  true
+|  If true, then no new specifications will be allowed to be loaded once introspection has been complete.  +
+ Only applies if the introspector is configured to perform full introspection up-front (either because of {@link IntrospectionMode#FULL} or {@link IntrospectionMode#LAZY_UNLESS_PRODUCTION} when in production); otherwise is ignored. 
+
+| isis.reflector.introspector. +
 mode
 | 
-| 
+|  Whether all known types should be fully introspected as part of the bootstrapping, or should only be partially introspected initially.  +
+ Leaving this as lazy means that there's a chance that metamodel validation errors will not be discovered during bootstrap.  That said, metamodel validation is still run incrementally for any classes introspected lazily after initial bootstrapping (unless {@link #isValidateIncrementally()} is disabled. 
 
 | isis.reflector.introspector. +
 parallelize
 |  true
-| 
+|  Whether to perform introspection and metamodel validation in parallel.
+
+| isis.reflector.introspector. +
+validate-incrementally
+|  true
+|  If true, then metamodel validation is performed after any new specification has been loaded (after the initial bootstrapping).  +
+ This does _not</i> apply if the introspector is configured to perform full introspection up-front AND when the metamodel is {@link #isLockAfterFullIntrospection() locked} after initial bootstrapping (because in that case the lock check will simply prevent any new specs from being loaded). But it will apply otherwise.   +
+In particular, this setting _can</i> still apply even if the {@link #getMode() introspection mode} is set to {@link IntrospectionMode#FULL full}, because that in itself does not preclude some code from attempting to load some previously unknown type.  For example, a fixture script could attempt to invoke an action on some new type using the {@link org.apache.isis.applib.services.wrapper.WrapperFactory} - this will cause introspection of that new type to be performed. 
 
diff --git a/core/config/src/main/doc/modules/config/examples/generated/resteasy.adoc b/core/config/src/main/doc/modules/config/examples/generated/resteasy.adoc
index 8a8ac8b..644481d 100644
--- a/core/config/src/main/doc/modules/config/examples/generated/resteasy.adoc
+++ b/core/config/src/main/doc/modules/config/examples/generated/resteasy.adoc
@@ -6,15 +6,6 @@
 | 
 | 
 
-| resteasy.jaxrs.app. +
-registration
-| 
-| 
-
-| resteasy.jaxrs.default-path
-|  /restful
-|  Note that this is used rather than `resteasy.servlet.mapping.prefix</code> because there is _NO</i> implementation of {@link javax.ws.rs.core.Application}, so we rely on it being automatically created.
-
 | resteasy.resteasy-settings
 | 
 | 
diff --git a/core/metamodel/src/test/java/org/apache/isis/metamodel/specloader/SpecificationLoaderTestAbstract.java b/core/metamodel/src/test/java/org/apache/isis/metamodel/specloader/SpecificationLoaderTestAbstract.java
index 4e6dba9..3e71eef 100644
--- a/core/metamodel/src/test/java/org/apache/isis/metamodel/specloader/SpecificationLoaderTestAbstract.java
+++ b/core/metamodel/src/test/java/org/apache/isis/metamodel/specloader/SpecificationLoaderTestAbstract.java
@@ -65,6 +65,7 @@ abstract class SpecificationLoaderTestAbstract {
 
         IsisConfiguration newConfiguration() {
             val config = new IsisConfiguration(); // uses defaults!
+            config.getReflector().getIntrospector().setLockAfterFullIntrospection(false);
             config.setEnvironment(newConfigurableEnvironment());
             return config;
         }