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/06 07:31:20 UTC
[isis] branch master updated: ISIS-2464: rename InteractionLayer ->
AuthenticationLayer
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 863e31c ISIS-2464: rename InteractionLayer -> AuthenticationLayer
863e31c is described below
commit 863e31c93c2187a7b0a7bcb759331b53dc5cc4bc
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sun Dec 6 08:31:04 2020 +0100
ISIS-2464: rename InteractionLayer -> AuthenticationLayer
---
...eractionLayer.java => AuthenticationLayer.java} | 6 +--
.../core/runtime/iactn/InteractionFactory.java | 14 +++----
.../core/runtime/iactn/InteractionTracker.java | 16 ++++----
.../session/InteractionFactoryDefault.java | 48 +++++++++++-----------
.../wrapper/WrapperFactoryDefault.java | 4 +-
5 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionLayer.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/AuthenticationLayer.java
similarity index 91%
rename from core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionLayer.java
rename to core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/AuthenticationLayer.java
index 9d5779d..d7f4046 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionLayer.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/AuthenticationLayer.java
@@ -28,17 +28,17 @@ import lombok.NonNull;
/**
* Provides the environment for an (or parts of an) user interaction to be executed.
* <p>
- * Can be nested by pushing onto the current Thread's InteractionLayer Stack.
+ * Can be nested by pushing onto the current thread's {@link InteractionTracker} Stack.
*
* @since 2.0
*
*/
-public class InteractionLayer extends RuntimeContextBase {
+public class AuthenticationLayer extends RuntimeContextBase {
@Getter private final InteractionSession interactionSession;
@Getter private final Authentication authentication;
- public InteractionLayer(
+ public AuthenticationLayer(
final @NonNull InteractionSession interactionSession,
final @NonNull Authentication authentication) {
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionFactory.java
index 0bddc2b..99d72d2 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionFactory.java
@@ -26,7 +26,7 @@ import org.apache.isis.core.security.authentication.Authentication;
import lombok.NonNull;
/**
- * The factory of {@link InteractionSession}(s) and {@link InteractionLayer}(s),
+ * The factory of {@link InteractionSession}(s) and {@link AuthenticationLayer}(s),
* also holding a reference to the current authentication layer stack using
* a thread-local.
* <p>
@@ -40,14 +40,14 @@ public interface InteractionFactory {
}
/**
- * If present, reuses the current top level {@link InteractionLayer}, otherwise creates a new
+ * If present, reuses the current top level {@link AuthenticationLayer}, otherwise creates a new
* anonymous one.
* @see {@link #openInteraction(Authentication)}
*/
- InteractionLayer openInteraction();
+ AuthenticationLayer openInteraction();
/**
- * Returns a new {@link InteractionLayer} that is a holder of {@link Authentication} on top
+ * Returns a new {@link AuthenticationLayer} that is a holder of {@link Authentication} on top
* of the current thread's authentication layer stack.
* <p>
* If available reuses an existing {@link InteractionSession}, otherwise creates a new one.
@@ -58,11 +58,11 @@ public interface InteractionFactory {
* @param authentication - the {@link Authentication} to associate with the new top of
* the stack (non-null)
*
- * @apiNote if the current {@link InteractionLayer} (if any) has an {@link Authentication} that
+ * @apiNote if the current {@link AuthenticationLayer} (if any) has an {@link Authentication} that
* equals that of the given one, as an optimization, no new layer is pushed onto the stack;
* instead the current one is returned
*/
- InteractionLayer openInteraction(@NonNull Authentication authentication);
+ AuthenticationLayer openInteraction(@NonNull Authentication authentication);
/**
* @return whether the calling thread is within the context of an open IsisInteractionSession
@@ -110,7 +110,7 @@ public interface InteractionFactory {
void runAnonymous(@NonNull ThrowingRunnable runnable);
/**
- * closes all open {@link InteractionLayer}(s) as stacked on the current thread
+ * closes all open {@link AuthenticationLayer}(s) as stacked on the current thread
*/
void closeSessionStack();
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionTracker.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionTracker.java
index 3466678..c6650a8 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionTracker.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/iactn/InteractionTracker.java
@@ -42,22 +42,22 @@ extends InteractionContext, AuthenticationContext {
boolean isInInteractionSession();
- /** @return the InteractionLayer that sits on top of the current
- * request- or test-scoped InteractionSession*/
- Optional<InteractionLayer> currentInteractionLayer();
+ /** @return the AuthenticationLayer that sits on top of the current
+ * request- or test-scoped InteractionSession's stack*/
+ Optional<AuthenticationLayer> currentAuthenticationLayer();
- default InteractionLayer currentInteractionLayerElseFail() {
- return currentInteractionLayer()
+ default AuthenticationLayer currentInteractionLayerElseFail() {
+ return currentAuthenticationLayer()
.orElseThrow(()->_Exceptions.illegalState("No InteractionSession available on current thread"));
}
/** @return the current request- or test-scoped InteractionSession*/
default Optional<InteractionSession> currentInteractionSession() {
- return currentInteractionLayer().map(InteractionLayer::getInteractionSession);
+ return currentAuthenticationLayer().map(AuthenticationLayer::getInteractionSession);
}
default Optional<ExecutionContext> currentExecutionContext() {
- return currentInteractionLayer().map(InteractionLayer::getExecutionContext);
+ return currentAuthenticationLayer().map(AuthenticationLayer::getExecutionContext);
}
/** @return the unique id of the current top-level request- or test-scoped IsisInteraction*/
@@ -90,7 +90,7 @@ extends InteractionContext, AuthenticationContext {
@Override
default Optional<Authentication> currentAuthentication() {
- return currentInteractionLayer().map(InteractionLayer::getAuthentication);
+ return currentAuthenticationLayer().map(AuthenticationLayer::getAuthentication);
}
// -- INTERACTION CONTEXT
diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/InteractionFactoryDefault.java b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/InteractionFactoryDefault.java
index f33dd55..2f3ba67 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/InteractionFactoryDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/InteractionFactoryDefault.java
@@ -53,7 +53,7 @@ import org.apache.isis.core.metamodel.services.publishing.CommandPublisher;
import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
import org.apache.isis.core.runtime.events.RuntimeEventService;
import org.apache.isis.core.runtime.iactn.InteractionFactory;
-import org.apache.isis.core.runtime.iactn.InteractionLayer;
+import org.apache.isis.core.runtime.iactn.AuthenticationLayer;
import org.apache.isis.core.runtime.iactn.InteractionSession;
import org.apache.isis.core.runtime.iactn.InteractionTracker;
import org.apache.isis.core.runtime.iactn.IsisInteraction;
@@ -143,62 +143,62 @@ implements InteractionFactory, InteractionTracker {
}
- private final ThreadLocal<Stack<InteractionLayer>> interactionLayerStack =
+ private final ThreadLocal<Stack<AuthenticationLayer>> authenticationStack =
ThreadLocal.withInitial(Stack::new);
@Override
- public InteractionLayer openInteraction() {
+ public AuthenticationLayer openInteraction() {
return openInteraction(new InitialisationSession());
}
@Override
- public InteractionLayer openInteraction(final @NonNull Authentication authToUse) {
+ public AuthenticationLayer openInteraction(final @NonNull Authentication authToUse) {
val interactionSession = getOrCreateInteractionSession();
- val newInteractionClosure = new InteractionLayer(interactionSession, authToUse);
+ val authenticationLayer = new AuthenticationLayer(interactionSession, authToUse);
- interactionLayerStack.get().push(newInteractionClosure);
+ authenticationStack.get().push(authenticationLayer);
- if(isInTopLevelClosure()) {
+ if(isInBaseLayer()) {
postSessionOpened(interactionSession);
}
if(log.isDebugEnabled()) {
- log.debug("new InteractionClosure created (conversation-id={}, total-sessions-on-stack={}, {})",
+ log.debug("new authentication layer created (conversation-id={}, total-layers-on-stack={}, {})",
conversationId.get(),
- interactionLayerStack.get().size(),
+ authenticationStack.get().size(),
_Probe.currentThreadId());
}
- return newInteractionClosure;
+ return authenticationLayer;
}
private InteractionSession getOrCreateInteractionSession() {
- return interactionLayerStack.get().isEmpty()
+ return authenticationStack.get().isEmpty()
? new InteractionSession(metaModelContext)
- : interactionLayerStack.get().firstElement().getInteractionSession();
+ : authenticationStack.get().firstElement().getInteractionSession();
}
@Override
public void closeSessionStack() {
- log.debug("about to close IsisInteraction stack (conversation-id={}, total-sessions-on-stack={}, {})",
+ log.debug("about to close the authentication stack (conversation-id={}, total-layers-on-stack={}, {})",
conversationId.get(),
- interactionLayerStack.get().size(),
+ authenticationStack.get().size(),
_Probe.currentThreadId());
closeInteractionStackDownToStackSize(0);
}
@Override
- public Optional<InteractionLayer> currentInteractionLayer() {
- val stack = interactionLayerStack.get();
+ public Optional<AuthenticationLayer> currentAuthenticationLayer() {
+ val stack = authenticationStack.get();
return stack.isEmpty() ? Optional.empty() : Optional.of(stack.lastElement());
}
@Override
public boolean isInInteractionSession() {
- return !interactionLayerStack.get().isEmpty();
+ return !authenticationStack.get().isEmpty();
}
@Override
@@ -222,7 +222,7 @@ implements InteractionFactory, InteractionTracker {
@NonNull final Authentication authentication,
@NonNull final Callable<R> callable) {
- final int stackSizeWhenEntering = interactionLayerStack.get().size();
+ final int stackSizeWhenEntering = authenticationStack.get().size();
openInteraction(authentication);
try {
@@ -267,8 +267,8 @@ implements InteractionFactory, InteractionTracker {
// -- HELPER
- private boolean isInTopLevelClosure() {
- return interactionLayerStack.get().size()==1;
+ private boolean isInBaseLayer() {
+ return authenticationStack.get().size()==1;
}
private void postSessionOpened(InteractionSession newIsisInteraction) {
@@ -288,12 +288,12 @@ implements InteractionFactory, InteractionTracker {
log.debug("about to close IsisInteraction stack down to size {} (conversation-id={}, total-sessions-on-stack={}, {})",
downToStackSize,
conversationId.get(),
- interactionLayerStack.get().size(),
+ authenticationStack.get().size(),
_Probe.currentThreadId());
- val stack = interactionLayerStack.get();
+ val stack = authenticationStack.get();
while(stack.size()>downToStackSize) {
- if(isInTopLevelClosure()) {
+ if(isInBaseLayer()) {
// keep the stack unmodified yet, to allow for callbacks to properly operate
preSessionClosed(stack.peek().getInteractionSession());
}
@@ -301,7 +301,7 @@ implements InteractionFactory, InteractionTracker {
}
if(downToStackSize == 0) {
// cleanup thread-local
- interactionLayerStack.remove();
+ authenticationStack.remove();
conversationId.remove();
}
}
diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/wrapper/WrapperFactoryDefault.java b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/wrapper/WrapperFactoryDefault.java
index c200024..e2d2cd8 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/wrapper/WrapperFactoryDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/wrapper/WrapperFactoryDefault.java
@@ -93,7 +93,7 @@ import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
import org.apache.isis.core.metamodel.specloader.specimpl.ObjectActionMixedIn;
import org.apache.isis.core.runtime.iactn.InteractionFactory;
-import org.apache.isis.core.runtime.iactn.InteractionLayer;
+import org.apache.isis.core.runtime.iactn.AuthenticationLayer;
import org.apache.isis.core.runtime.iactn.InteractionTracker;
import org.apache.isis.core.runtimeservices.wrapper.dispatchers.InteractionEventDispatcher;
import org.apache.isis.core.runtimeservices.wrapper.dispatchers.InteractionEventDispatcherTypeSafe;
@@ -545,7 +545,7 @@ public class WrapperFactoryDefault implements WrapperFactory {
dispatchersByEventClass.put(type, dispatcher);
}
- private InteractionLayer currentInteractionLayer() {
+ private AuthenticationLayer currentInteractionLayer() {
return interactionTracker.currentInteractionLayerElseFail();
}