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 2016/01/17 17:13:16 UTC

[02/17] isis git commit: ISIS-1295: removing ContextReplacePolicy since no longer required either

ISIS-1295: removing ContextReplacePolicy since no longer required either


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/e86e7ad9
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/e86e7ad9
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/e86e7ad9

Branch: refs/heads/master
Commit: e86e7ad908d11da87b272986a726be81a899bdfc
Parents: ee58bb0
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Jan 4 18:59:24 2016 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Jan 4 18:59:24 2016 +0000

----------------------------------------------------------------------
 .../runtime/system/context/IsisContext.java     | 30 +++++---------------
 1 file changed, 7 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/e86e7ad9/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
index 9fe9b17..238d297 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/context/IsisContext.java
@@ -64,7 +64,6 @@ public class IsisContext implements DebuggableWithTitle {
     private static IsisContext singleton;
 
     private final IsisSessionFactory sessionFactory;
-    private final ContextReplacePolicy replacePolicy;
     private final SessionClosePolicy sessionClosePolicy;
 
     private static IsisConfiguration configuration;
@@ -108,35 +107,27 @@ public class IsisContext implements DebuggableWithTitle {
         AUTO_CLOSE
     }
 
-    /**
-     * Whether the {@link IsisContext#getInstance() singleton} itself may be
-     * replaced.
-     */
-    protected static enum ContextReplacePolicy {
-        NOT_REPLACEABLE, REPLACEABLE
-    }
-
 
     /**
      * Creates a new instance of the {@link IsisSession} holder.
      * 
      * <p>
-     * Will throw an exception if an instance has already been created and is
-     * not {@link ContextReplacePolicy#REPLACEABLE}.
+     * Will throw an exception if an instance has already been created.
      */
-    protected IsisContext(final ContextReplacePolicy replacePolicy, final SessionClosePolicy sessionClosePolicy, final IsisSessionFactory sessionFactory) {
-        if (singleton != null && !singleton.isContextReplaceable()) {
-            throw new IsisException("Isis Context already set up and cannot be replaced");
+    protected IsisContext(
+            final SessionClosePolicy sessionClosePolicy,
+            final IsisSessionFactory sessionFactory) {
+        if (singleton != null) {
+            throw new IsisException("Isis Context already set up");
         }
         singleton = this;
         this.sessionFactory = sessionFactory;
         this.sessionClosePolicy = sessionClosePolicy;
-        this.replacePolicy = replacePolicy;
     }
 
 
     protected IsisContext(final IsisSessionFactory sessionFactory) {
-        this(ContextReplacePolicy.NOT_REPLACEABLE, SessionClosePolicy.AUTO_CLOSE, sessionFactory);
+        this(SessionClosePolicy.AUTO_CLOSE, sessionFactory);
     }
 
 
@@ -168,13 +159,6 @@ public class IsisContext implements DebuggableWithTitle {
     // ///////////////////////////////////////////////////////////
 
     /**
-     * Whether a context singleton can simply be replaced or not.
-     */
-    public final boolean isContextReplaceable() {
-        return replacePolicy == ContextReplacePolicy.REPLACEABLE;
-    }
-
-    /**
      * Whether any open session can be automatically
      * {@link #closeSessionInstance() close}d on
      * {@link #openSessionInstance(AuthenticationSession) open}.