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 2020/12/02 15:11:00 UTC
[isis] branch master updated: ISIS-2464: move Interaction
implementation details from applib to runtime
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 394c58d ISIS-2464: move Interaction implementation details from applib to runtime
394c58d is described below
commit 394c58d26fd94dc6e0ef17659f30472d38a24242
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Dec 2 16:10:30 2020 +0100
ISIS-2464: move Interaction implementation details from applib to
runtime
---
.../isis/applib/services/iactn/Interaction.java | 50 +++++++++++-----------
.../core/runtime/iactn/InteractionSession.java | 3 +-
.../isis/core/runtime/iactn/IsisInteraction.java | 17 +++-----
.../iactn}/InteractionDefaultTest_next.java | 6 +--
.../session/IsisInteractionFactoryDefault.java | 16 ++++++-
5 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java b/api/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java
index 23b24e0..0979f78 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java
@@ -80,26 +80,24 @@ public interface Interaction extends HasUniqueId {
// end::refguide[]
- /**
- * Returns a (list of) {@link Execution}s in the order that they were pushed. Generally there will be just one entry in this list, but additional entries may arise from the use of mixins/contributions when re-rendering a modified object.
- *
- * <p>
- * Each {@link Execution} represents a call stack of domain events (action invocations or property edits),
- * that may in turn cause other domain events to be fired (by virtue of the {@link WrapperFactory}).
- * The reason that a list is returned is to support bulk command/actions (against multiple targets). A non-bulk
- * action will return a list of just one element.
- * </p>
- *
- * @implNote - it seems that this is never actually called.
- * The PropertyEdit/ActionInvocation facet diligently calls
- * {@link #execute(MemberExecutor, PropertyEdit, ClockService, MetricsService)} or
- * {@link #execute(MemberExecutor, ActionInvocation, ClockService, MetricsService)} for us, to ensure that the
- * graph is populated, but then delegate to the PublisherService immediately at the end... ie {@link org.apache.isis.schema.ixn.v2.InteractionDto}s are published as we go, not all in a batch at the end.
- */
- // tag::refguide[]
- List<Execution<?,?>> getExecutions(); // <.>
+// /**
+// * Returns a (list of) {@link Execution}s in the order that they were pushed. Generally there will be just one entry in this list, but additional entries may arise from the use of mixins/contributions when re-rendering a modified object.
+// *
+// * <p>
+// * Each {@link Execution} represents a call stack of domain events (action invocations or property edits),
+// * that may in turn cause other domain events to be fired (by virtue of the {@link WrapperFactory}).
+// * The reason that a list is returned is to support bulk command/actions (against multiple targets). A non-bulk
+// * action will return a list of just one element.
+// * </p>
+// *
+// * @implNote - it seems that this is never actually called.
+// * The PropertyEdit/ActionInvocation facet diligently calls
+// * {@link #execute(MemberExecutor, PropertyEdit, ClockService, MetricsService)} or
+// * {@link #execute(MemberExecutor, ActionInvocation, ClockService, MetricsService)} for us, to ensure that the
+// * graph is populated, but then delegate to the PublisherService immediately at the end... ie {@link org.apache.isis.schema.ixn.v2.InteractionDto}s are published as we go, not all in a batch at the end.
+// */
+// List<Execution<?,?>> getExecutions();
- // end::refguide[]
/**
* The current (most recently pushed) {@link Execution}.
*/
@@ -114,12 +112,12 @@ public interface Interaction extends HasUniqueId {
Execution<?,?> getPriorExecution(); // <.>
// end::refguide[]
- /**
- * <b>NOT API</b>: intended to be called only by the framework.
- *
- * Clears the set of {@link Execution}s that may have been {@link #push(Execution)}ed.
- */
- public void clear();
+// /**
+// * <b>NOT API</b>: intended to be called only by the framework.
+// *
+// * Clears the set of {@link Execution}s that may have been {@link #push(Execution)}ed.
+// */
+// public void clear();
/**
* <b>NOT API</b>: intended only to be implemented by the framework.
@@ -384,7 +382,7 @@ public interface Interaction extends HasUniqueId {
/**
* <b>NOT API</b>: intended to be called only by the framework.
*/
- void setCompletedAt(
+ public void setCompletedAt(
final Timestamp completedAt,
final MetricsService metricsService) {
syncMetrics(When.AFTER, completedAt, metricsService);
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionSession.java
index f129ece..8003cc5 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionSession.java
@@ -25,7 +25,6 @@ import java.util.UUID;
import java.util.function.Function;
import org.apache.isis.applib.services.iactn.Interaction;
-import org.apache.isis.applib.services.iactn.SimpleInteraction;
import org.apache.isis.applib.services.xactn.TransactionId;
import org.apache.isis.applib.services.xactn.TransactionState;
import org.apache.isis.commons.internal.base._Casts;
@@ -66,7 +65,7 @@ public class InteractionSession extends RuntimeContextBase {
super(mmc);
this.authenticationSession = authenticationSession; // binds this session to given authenticationSession
this.lifecycleStartedAtSystemNanos = System.nanoTime(); // used to measure time periods, so not using ClockService here
- this.interaction = new SimpleInteraction(UUID.randomUUID());
+ this.interaction = new IsisInteraction(UUID.randomUUID());
}
// -- FLUSH
diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/iactn/SimpleInteraction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/IsisInteraction.java
similarity index 94%
rename from api/applib/src/main/java/org/apache/isis/applib/services/iactn/SimpleInteraction.java
rename to core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/IsisInteraction.java
index 086e608..0ff6b90 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/iactn/SimpleInteraction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/IsisInteraction.java
@@ -16,11 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-package org.apache.isis.applib.services.iactn;
+package org.apache.isis.core.runtime.iactn;
import java.sql.Timestamp;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@@ -28,6 +26,7 @@ import java.util.concurrent.atomic.LongAdder;
import org.apache.isis.applib.services.clock.ClockService;
import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.services.iactn.Interaction;
import org.apache.isis.applib.services.metrics.MetricsService;
import org.apache.isis.commons.internal.collections._Lists;
import org.apache.isis.commons.internal.collections._Maps;
@@ -38,9 +37,9 @@ import lombok.val;
import lombok.extern.log4j.Log4j2;
@Log4j2
-public class SimpleInteraction implements Interaction {
+public class IsisInteraction implements Interaction {
- public SimpleInteraction(final @NonNull UUID uniqueId) {
+ public IsisInteraction(final @NonNull UUID uniqueId) {
this.command = new Command(uniqueId);
}
@@ -54,18 +53,12 @@ public class SimpleInteraction implements Interaction {
private final List<Execution<?,?>> executionGraphs = _Lists.newArrayList();
- @Override
- public List<Execution<?,?>> getExecutions() {
- return Collections.unmodifiableList(executionGraphs);
- }
-
@Getter(onMethod_ = {@Override})
private Execution<?,?> currentExecution;
@Getter(onMethod_ = {@Override})
private Execution<?,?> priorExecution;
- @Override
public void clear() {
executionGraphs.clear();
}
@@ -160,7 +153,7 @@ public class SimpleInteraction implements Interaction {
}
private void start(
- final SimpleInteraction.Execution<?,?> execution,
+ final IsisInteraction.Execution<?,?> execution,
final ClockService clockService,
final MetricsService metricsService,
final Command command) {
diff --git a/api/applib/src/test/java/org/apache/isis/applib/services/interaction/InteractionDefaultTest_next.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/iactn/InteractionDefaultTest_next.java
similarity index 88%
rename from api/applib/src/test/java/org/apache/isis/applib/services/interaction/InteractionDefaultTest_next.java
rename to core/runtime/src/test/java/org/apache/isis/core/runtime/iactn/InteractionDefaultTest_next.java
index 4cdcc0a..18e7843 100644
--- a/api/applib/src/test/java/org/apache/isis/applib/services/interaction/InteractionDefaultTest_next.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/iactn/InteractionDefaultTest_next.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.isis.applib.services.interaction;
+package org.apache.isis.core.runtime.iactn;
import java.util.UUID;
@@ -26,15 +26,13 @@ import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
-import org.apache.isis.applib.services.iactn.SimpleInteraction;
-
import lombok.val;
public class InteractionDefaultTest_next {
@Test
public void test() {
- val interaction = new SimpleInteraction(UUID.randomUUID());
+ val interaction = new IsisInteraction(UUID.randomUUID());
assertThat(interaction.next("foo"), is(0));
assertThat(interaction.next("foo"), is(1));
diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/IsisInteractionFactoryDefault.java b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/IsisInteractionFactoryDefault.java
index 7a7c217..1cbdbf5 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/IsisInteractionFactoryDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/IsisInteractionFactoryDefault.java
@@ -47,6 +47,7 @@ import org.apache.isis.commons.collections.Can;
import org.apache.isis.commons.internal.concurrent._ConcurrentContext;
import org.apache.isis.commons.internal.concurrent._ConcurrentTaskList;
import org.apache.isis.commons.internal.debug._Probe;
+import org.apache.isis.commons.internal.exceptions._Exceptions;
import org.apache.isis.core.config.IsisConfiguration;
import org.apache.isis.core.metamodel.context.MetaModelContext;
import org.apache.isis.core.metamodel.services.publishing.CommandPublisher;
@@ -54,6 +55,7 @@ import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
import org.apache.isis.core.runtime.events.RuntimeEventService;
import org.apache.isis.core.runtime.iactn.InteractionClosure;
import org.apache.isis.core.runtime.iactn.InteractionSession;
+import org.apache.isis.core.runtime.iactn.IsisInteraction;
import org.apache.isis.core.runtime.iactn.IsisInteractionFactory;
import org.apache.isis.core.runtime.iactn.IsisInteractionTracker;
import org.apache.isis.core.runtime.iactn.scope.IsisInteractionScopeBeanFactoryPostProcessor;
@@ -90,7 +92,8 @@ import lombok.extern.log4j.Log4j2;
@Primary
@Qualifier("Default")
@Log4j2
-public class IsisInteractionFactoryDefault implements IsisInteractionFactory, IsisInteractionTracker {
+public class IsisInteractionFactoryDefault
+implements IsisInteractionFactory, IsisInteractionTracker {
@Inject AuthenticationManager authenticationManager;
@Inject RuntimeEventService runtimeEventService;
@@ -317,6 +320,15 @@ public class IsisInteractionFactoryDefault implements IsisInteractionFactory, Is
}
}
+ private IsisInteraction getInternalInteractionElseFail() {
+ val interaction = getInteractionElseFail();
+ if(interaction instanceof IsisInteraction) {
+ return (IsisInteraction) interaction;
+ }
+ throw _Exceptions.unrecoverableFormatted("the framework does not recognice "
+ + "this implementation of an Interaction: %s", interaction.getClass().getName());
+ }
+
// -- HELPER - SUDO SUPPORT
@Inject private UserServiceDefault userServiceDefault;
@@ -344,7 +356,7 @@ public class IsisInteractionFactoryDefault implements IsisInteractionFactory, Is
private void completeAndPublishCurrentCommand() {
- val interaction = getInteractionElseFail();
+ val interaction = getInternalInteractionElseFail();
val command = interaction.getCommand();
if(command.getStartedAt() != null && command.getCompletedAt() == null) {