andi-huber commented on a change in pull request #590:
URL: https://github.com/apache/isis/pull/590#discussion_r648429168



##########
File path: 
api/applib/src/main/java/org/apache/isis/applib/services/iactnlayer/InteractionContext.java
##########
@@ -69,15 +75,53 @@
     @With @Getter @Builder.Default
     @NonNull TimeZone timeZone = TimeZone.getDefault();
 
+    Map<String, Serializable> attributes = new HashMap<>();

Review comment:
       Breaks with the original idea of InteractionContext being a value 
(immutable). Functionality for storing attributes is in IsisInteraction.

##########
File path: 
core/security/src/main/java/org/apache/isis/core/security/authentication/Authentication.java
##########
@@ -91,8 +101,24 @@ default Type getType() {
     // -- WITHERS
 
     /**
-     * Returns a copy with given {@code executionContext}.
-     * @param executionContext
+     * Returns a copy with given {@code interactionContext}.
+     * @param interactionContext
      */
-    Authentication withExecutionContext(ExecutionContext executionContext);
+    Authentication withInteractionContext(InteractionContext 
interactionContext);
+
+    /**
+     * Looks up an {@link Authentication} from the provided {@link 
InteractionContext}.
+     *
+     * <p>
+     *     If the {@link InteractionContext} was created as the result of an 
authentication process (as opposed to
+     *     programmatically) then there will be an attached {@link 
Authentication} object.
+     * </p>
+     *
+     * @param interactionContext
+     * @return
+     */
+    public static Optional<Authentication> authenticationFrom(final @NonNull 
InteractionContext interactionContext) {

Review comment:
       relates to a comment above, that InteractionContext should be immutable; 
I hope there are alternative ways to get the (current) Authentication; not sure

##########
File path: 
api/applib/src/main/java/org/apache/isis/applib/services/xactn/TransactionalProcessor.java
##########
@@ -25,7 +25,7 @@
 import org.springframework.transaction.support.DefaultTransactionDefinition;
 
 import org.apache.isis.commons.functional.Result;
-import org.apache.isis.commons.functional.ThrowingRunnable;

Review comment:
       Why not keep using 'commons' for ThrowingRunnable?

##########
File path: 
api/applib/src/main/java/org/apache/isis/applib/services/iactnlayer/InteractionService.java
##########
@@ -0,0 +1,102 @@
+package org.apache.isis.applib.services.iactnlayer;
+
+import java.util.concurrent.Callable;
+
+import lombok.NonNull;
+
+/**
+ * A low-level service to programmatically &quot;connect&quot; (or create a
+ * session, or interact with; choose your term) the the framework's runtime.
+ *
+ * <p>
+ *     This service is used internally by the framework itself, for example
+ *     when a viewer receives a request a new {@link InteractionLayer} is 
created
+ *     for the duration of the users's interaction.  It is also used by 
integration
+ *     tests, to be able to connect to the database.
+ * </p>
+ *
+ * <p>
+ *     You could think of this as analogous to an <code>HttpRequest</code>, or
+ *     a JPA <code>EntityManager</code> or JDO <code>PersistenceManager</code>.
+ * </p>
+ *
+ * <p>
+ *     There are two main APIs exposed.  One is to
+ *     {@link #openInteraction(InteractionContext) open} a new {@link 
InteractionLayer},
+ *     to be {@link #closeInteractionLayers() closed later}.  The other is to
+ *     execute a {@link Callable} or {@link ThrowingRunnable runnable} within 
the
+ *     duration of an {@link InteractionLayer}, wrapping up automatically.
+ *     This is what is used by {@link 
org.apache.isis.applib.services.sudo.SudoService}, for example.
+ * </p>
+ *
+ * @since 2.x {@index}
+ */
+public interface InteractionService {

Review comment:
       I think we could merge those methods from AnonymousInteractionFactory, 
then remove AnonymousInteractionFactory.

##########
File path: commons/src/main/java/org/apache/isis/commons/functional/Result.java
##########
@@ -61,10 +61,6 @@
         }
     }
 
-    public static Result<Void> ofVoid(final @NonNull ThrowingRunnable 
runnable) {

Review comment:
       maybe keep for convenience?

##########
File path: 
core/security/src/main/java/org/apache/isis/core/security/authentication/manager/AnonymousInteractionFactory.java
##########
@@ -38,10 +38,19 @@
  */
 public interface AnonymousInteractionFactory {

Review comment:
       probably merge into InteractionService, then remove.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to