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 2015/08/07 12:11:30 UTC

[03/17] isis git commit: ISIS-1188: collapsed IsisSystem and IsisSystemDefault (removed IsisSystemAbstract); ditto for IsisSession and IsisSessionFactory.

ISIS-1188: collapsed IsisSystem and IsisSystemDefault (removed IsisSystemAbstract); ditto for IsisSession and IsisSessionFactory.


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

Branch: refs/heads/master
Commit: fd9a217c7a2e86a8a594af39c59c53abb87a03ab
Parents: 8605117
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 17:56:58 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 17:56:58 2015 +0100

----------------------------------------------------------------------
 .../integtestsupport/IsisSystemForTest.java     |  24 +-
 .../isis/core/runtime/system/IsisSystem.java    | 358 ++++++++++++++++-
 .../runtime/system/session/IsisSession.java     | 250 ++++++++++--
 .../system/session/IsisSessionDefault.java      | 320 ---------------
 .../system/session/IsisSessionFactory.java      | 154 +++++++-
 .../session/IsisSessionFactoryDefault.java      | 197 ----------
 .../IsisSystemAbstract.java                     |  30 --
 .../IsisSystemThatUsesInstallersFactory.java    |  26 +-
 .../IsisSystemUsingComponentProvider.java       | 392 -------------------
 .../core/runtime/context/IsisContextTest.java   |   3 +-
 ...onFactoryAbstractTest_init_and_shutdown.java |   2 +-
 11 files changed, 728 insertions(+), 1028 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
index 345305e..5743b4f 100644
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java
@@ -61,7 +61,7 @@ import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction.State;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-import org.apache.isis.core.runtime.systemusinginstallers.IsisSystemUsingComponentProvider;
+import org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProvider;
 import org.apache.isis.core.security.authentication.AuthenticationRequestNameOnly;
 import org.apache.isis.core.specsupport.scenarios.DomainServiceProvider;
 import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
@@ -368,7 +368,13 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
             IsisLoggingConfigurer isisLoggingConfigurer = new IsisLoggingConfigurer(getLevel());
             isisLoggingConfigurer.configureLogging(".", new String[]{});
 
-            isisSystem = createIsisSystem(services);
+            IsisComponentProvider componentProvider = new IsisComponentProviderDefault(
+                    DeploymentType.UNIT_TESTING, services,
+                    getConfigurationElseDefault(),
+                    this.programmingModel,
+                    this.metaModelValidator);
+
+            isisSystem = new IsisSystem(componentProvider);
 
             // ensures that a FixtureClock is installed as the singleton underpinning the ClockService
             FixtureClock.initialize();
@@ -460,20 +466,6 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
                 : IsisComponentProviderDefault.defaultConfiguration();
     }
 
-
-    private IsisSystem createIsisSystem(List<Object> services) {
-
-        IsisComponentProviderDefault componentProvider = new IsisComponentProviderDefault(
-                DeploymentType.UNIT_TESTING, services,
-                getConfigurationElseDefault(),
-                this.programmingModel,
-                this.metaModelValidator);
-
-        return new IsisSystemUsingComponentProvider(
-                componentProvider);
-    }
-
-
     ////////////////////////////////////////////////////////////
     // listeners
     ////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystem.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystem.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystem.java
index 2904006..f6c25ea 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystem.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystem.java
@@ -19,27 +19,375 @@
 
 package org.apache.isis.core.runtime.system;
 
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.DomainObjectContainer;
 import org.apache.isis.applib.fixtures.LogonFixture;
+import org.apache.isis.applib.fixturescripts.FixtureScripts;
+import org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
+import org.apache.isis.core.commons.components.Noop;
 import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.debug.DebuggableWithTitle;
+import org.apache.isis.core.commons.lang.ListExtensions;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.ServiceInitializer;
+import org.apache.isis.core.runtime.authentication.AuthenticationManager;
+import org.apache.isis.core.runtime.authentication.exploration.ExplorationSession;
+import org.apache.isis.core.runtime.authorization.AuthorizationManager;
+import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
+import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.internal.InitialisationSession;
+import org.apache.isis.core.runtime.system.internal.IsisLocaleInitializer;
+import org.apache.isis.core.runtime.system.internal.IsisTimeZoneInitializer;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManagerException;
+import org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProvider;
+
+public class IsisSystem implements DebugSelection, ApplicationScopedComponent {
+
+    public static final Logger LOG = LoggerFactory.getLogger(IsisSystem.class);
+
+    private final IsisLocaleInitializer localeInitializer;
+    private final IsisTimeZoneInitializer timeZoneInitializer;
+    private final DeploymentType deploymentType;
+
+    private boolean initialized = false;
+
+    private ServiceInitializer serviceInitializer;
+    private FixturesInstaller fixtureInstaller;
+    private IsisSessionFactory sessionFactory;
+
+    //region > constructors
+
+    private final IsisComponentProvider isisComponentProvider;
+
+    public IsisSystem(IsisComponentProvider isisComponentProvider) {
+        this.deploymentType = isisComponentProvider.getDeploymentType();
+        this.localeInitializer = new IsisLocaleInitializer();
+        this.timeZoneInitializer = new IsisTimeZoneInitializer();
 
-public interface IsisSystem extends DebugSelection, ApplicationScopedComponent {
+        this.isisComponentProvider = isisComponentProvider;
+    }
 
-    DeploymentType getDeploymentType();
+    //endregion
 
-    LogonFixture getLogonFixture();
+    //region > deploymentType
+    public DeploymentType getDeploymentType() {
+        return deploymentType;
+    }
+    //endregion
+
+    //region > sessionFactory
 
     /**
      * Populated after {@link #init()}.
      */
-    public IsisSessionFactory getSessionFactory();
+    public IsisSessionFactory getSessionFactory() {
+        return sessionFactory;
+    }
+
+    //endregion
+
+    //region > init
+
+
+    @Override
+    public void init() {
+
+        if (initialized) {
+            throw new IllegalStateException("Already initialized");
+        } else {
+            initialized = true;
+        }
+
+        LOG.info("initialising Isis System");
+        LOG.info("working directory: " + new File(".").getAbsolutePath());
+        LOG.info("resource stream source: " + getConfiguration().getResourceStreamSource());
+
+        localeInitializer.initLocale(getConfiguration());
+        timeZoneInitializer.initTimeZone(getConfiguration());
+
+        try {
+            sessionFactory = createSessionFactory(deploymentType);
+
+            // temporarily make a configuration available
+            // REVIEW: would rather inject this, or perhaps even the
+            // ConfigurationBuilder
+            IsisContext.setConfiguration(getConfiguration());
+
+            initContext(sessionFactory);
+            sessionFactory.init();
+
+            // validate here after all entities have been registered in the persistence session factory
+            final SpecificationLoaderSpi specificationLoader = sessionFactory.getSpecificationLoader();
+            specificationLoader.validateAndAssert();
+
+            serviceInitializer = initializeServices();
+
+            installFixturesIfRequired();
+
+            translateServicesAndEnumConstants();
+
+        } catch (final IsisSystemException ex) {
+            LOG.error("failed to initialise", ex);
+            throw new RuntimeException(ex);
+        }
+    }
+
+
+    private IsisSessionFactory createSessionFactory(final DeploymentType deploymentType) throws IsisSystemException {
+
+        final List<Object> services = isisComponentProvider.obtainServices();
+        final PersistenceSessionFactory persistenceSessionFactory =
+                isisComponentProvider.providePersistenceSessionFactory(deploymentType, services);
+
+        final IsisConfiguration configuration = getConfiguration();
+        final AuthenticationManager authenticationManager = isisComponentProvider
+                .provideAuthenticationManager(deploymentType);
+        final AuthorizationManager authorizationManager = isisComponentProvider
+                .provideAuthorizationManager(deploymentType);
+        final OidMarshaller oidMarshaller = createOidMarshaller();
+
+        final Collection<MetaModelRefiner> metaModelRefiners =
+                refiners(authenticationManager, authorizationManager, persistenceSessionFactory);
+        final SpecificationLoaderSpi reflector = isisComponentProvider
+                .provideSpecificationLoaderSpi(deploymentType, metaModelRefiners);
+
+        ServicesInjectorSpi servicesInjector = persistenceSessionFactory.getServicesInjector();
+        servicesInjector.addFallbackIfRequired(FixtureScripts.class, new FixtureScriptsDefault());
+        servicesInjector.validateServices();
+
+        // bind metamodel to the (runtime) framework
+        final RuntimeContextFromSession runtimeContext = createRuntimeContextFromSession();
+        runtimeContext.injectInto(reflector);
+
+        return new IsisSessionFactory (
+                deploymentType, configuration, reflector,
+                authenticationManager, authorizationManager,
+                persistenceSessionFactory, oidMarshaller);
+    }
+
+    private static Collection<MetaModelRefiner> refiners(Object... possibleRefiners ) {
+        return ListExtensions.filtered(Arrays.asList(possibleRefiners), MetaModelRefiner.class);
+    }
+
+
+    private void initContext(final IsisSessionFactory sessionFactory) {
+        getDeploymentType().initContext(sessionFactory);
+    }
+
+    /**
+     * @see #shutdownServices(ServiceInitializer)
+     */
+    private ServiceInitializer initializeServices() {
+
+        final List<Object> services = sessionFactory.getServices();
+
+        // validate
+        final ServiceInitializer serviceInitializer = new ServiceInitializer();
+        serviceInitializer.validate(getConfiguration(), services);
+
+        // call @PostConstruct (in a session)
+        IsisContext.openSession(new InitialisationSession());
+        try {
+            getTransactionManager().startTransaction();
+            try {
+                serviceInitializer.postConstruct();
+
+                return serviceInitializer;
+            } catch(RuntimeException ex) {
+                getTransactionManager().getTransaction().setAbortCause(new IsisTransactionManagerException(ex));
+                return serviceInitializer;
+            } finally {
+                // will commit or abort
+                getTransactionManager().endTransaction();
+            }
+        } finally {
+            IsisContext.closeSession();
+        }
+    }
+
+    private void installFixturesIfRequired() throws IsisSystemException {
+
+        fixtureInstaller = isisComponentProvider.obtainFixturesInstaller();
+        if (isNoop(fixtureInstaller)) {
+            return;
+        }
+
+        IsisContext.openSession(new InitialisationSession());
+        fixtureInstaller.installFixtures();
+        try {
+
+            // only allow logon fixtures if not in production mode.
+            if (!getDeploymentType().isProduction()) {
+                logonFixture = fixtureInstaller.getLogonFixture();
+            }
+        } finally {
+            IsisContext.closeSession();
+        }
+    }
+
+    private boolean isNoop(final FixturesInstaller candidate) {
+        return candidate == null || (fixtureInstaller instanceof Noop);
+    }
+
+    /**
+     * The act of invoking titleOf(...) will cause translations to be requested.
+     */
+    private void translateServicesAndEnumConstants() {
+        IsisContext.openSession(new InitialisationSession());
+        try {
+            final List<Object> services = sessionFactory.getServices();
+            final DomainObjectContainer container = lookupService(DomainObjectContainer.class);
+            for (Object service : services) {
+                final String unused = container.titleOf(service);
+            }
+            for (final ObjectSpecification objSpec : allSpecifications()) {
+                final Class<?> correspondingClass = objSpec.getCorrespondingClass();
+                if(correspondingClass.isEnum()) {
+                    final Object[] enumConstants = correspondingClass.getEnumConstants();
+                    for (Object enumConstant : enumConstants) {
+                        final String unused = container.titleOf(enumConstant);
+                    }
+                }
+            }
+        } finally {
+            IsisContext.closeSession();
+        }
+
+    }
+
+    private <T> T lookupService(final Class<T> serviceClass) {
+        return getServicesInjector().lookupService(serviceClass);
+    }
+
+    private ServicesInjectorSpi getServicesInjector() {
+        return getPersistenceSession().getServicesInjector();
+    }
+
+    private PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    Collection<ObjectSpecification> allSpecifications() {
+        return IsisContext.getSpecificationLoader().allSpecifications();
+    }
+
+    private OidMarshaller createOidMarshaller() {
+        return new OidMarshaller();
+    }
+
+    private RuntimeContextFromSession createRuntimeContextFromSession() {
+        return new RuntimeContextFromSession();
+    }
+
+    //endregion
+
+    //region > shutdown
+
+    @Override
+    public void shutdown() {
+        LOG.info("shutting down system");
+
+        shutdownServices(this.serviceInitializer);
+
+        IsisContext.closeAllSessions();
+    }
+
+    /**
+     * @see #initializeServices()
+     */
+    private void shutdownServices(final ServiceInitializer serviceInitializer) {
+
+        // call @PostDestroy (in a session)
+        IsisContext.openSession(new InitialisationSession());
+        try {
+            getTransactionManager().startTransaction();
+            try {
+                serviceInitializer.preDestroy();
+
+            } catch(RuntimeException ex) {
+                getTransactionManager().getTransaction().setAbortCause(new IsisTransactionManagerException(ex));
+            } finally {
+                // will commit or abort
+                getTransactionManager().endTransaction();
+            }
+        } finally {
+            IsisContext.closeSession();
+        }
+    }
+
+    //endregion
+
+    //region > configuration
 
     /**
      * Returns a <i>snapshot</i> of the {@link IsisConfiguration configuration}
      * (although once the {@link IsisSystem} is completely initialized, will
      * effectively be immutable).
      */
-    IsisConfiguration getConfiguration();
+    public IsisConfiguration getConfiguration() {
+        return isisComponentProvider.getConfiguration();
+    }
+    //endregion
+
+    //region > logonFixture
+    private LogonFixture logonFixture;
+
+    /**
+     * The {@link LogonFixture}, if any, obtained by running fixtures.
+     *
+     * <p>
+     * Intended to be used when for {@link DeploymentType#SERVER_EXPLORATION
+     * exploration} (instead of an {@link ExplorationSession}) or
+     * {@link DeploymentType#SERVER_PROTOTYPE prototype} deployments (saves logging
+     * in). Should be <i>ignored</i> in other {@link DeploymentType}s.
+     */
+    public LogonFixture getLogonFixture() {
+        return logonFixture;
+    }
+    //endregion
+
+    //region > debugging
+
+    @Override
+    public DebuggableWithTitle debugSection(final String selectionName) {
+        // DebugInfo deb;
+        if (selectionName.equals("Configuration")) {
+            return getConfiguration();
+        }
+        return null;
+    }
+
+    @Override
+    public String[] debugSectionNames() {
+        final String[] general = new String[] { "Overview", "Authenticator", "Configuration", "Reflector", "Requests", "Contexts" };
+        final String[] contextIds = IsisContext.getInstance().allSessionIds();
+        final String[] combined = new String[general.length + contextIds.length];
+        System.arraycopy(general, 0, combined, 0, general.length);
+        System.arraycopy(contextIds, 0, combined, general.length, contextIds.length);
+        return combined;
+    }
+
+    IsisTransactionManager getTransactionManager() {
+        return IsisContext.getTransactionManager();
+    }
+
+    //endregion
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSession.java
index 0f42039..9047d9c 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSession.java
@@ -19,12 +19,30 @@
 
 package org.apache.isis.core.runtime.system.session;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.commons.components.SessionScopedComponent;
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.debug.DebugString;
+import org.apache.isis.core.commons.debug.DebuggableWithTitle;
+import org.apache.isis.core.commons.util.ToString;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
 
 /**
  * Analogous to (and in essence a wrapper for) a JDO <code>PersistenceManager</code>;
@@ -35,65 +53,239 @@ import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
  * 
  * @see IsisSessionFactory
  */
-public interface IsisSession extends SessionScopedComponent {
+public class IsisSession implements SessionScopedComponent {
+
+    private static final Logger LOG = LoggerFactory.getLogger(IsisSession.class);
+
+    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM HH:mm:ss,SSS");
+    private static int nextId = 1;
+
+    private final IsisSessionFactory isisSessionFactory;
+
+    private final AuthenticationSession authenticationSession;
+    private PersistenceSession persistenceSession; // only non-final so can be
+    // replaced in tests.
+    private final int id;
+    private long accessTime;
+    private String debugSnapshot;
+
+    //region > constructor
+    public IsisSession(
+            final IsisSessionFactory sessionFactory,
+            final AuthenticationSession authenticationSession,
+            final PersistenceSession persistenceSession) {
+
+        // global context
+        ensureThatArg(sessionFactory, is(not(nullValue())), "execution context factory is required");
+
+        // session
+        ensureThatArg(authenticationSession, is(not(nullValue())), "authentication session is required");
+        ensureThatArg(persistenceSession, is(not(nullValue())), "persistence session is required");
+
+        this.isisSessionFactory = sessionFactory;
 
-    // //////////////////////////////////////////////////////
-    // closeAll
-    // //////////////////////////////////////////////////////
+        this.authenticationSession = authenticationSession;
+        this.persistenceSession = persistenceSession;
 
+        setSessionOpenTime(System.currentTimeMillis());
+
+        this.id = nextId++;
+
+    }
+    //endregion
+
+    //region > open, close
+    @Override
+    public void open() {
+        persistenceSession.open();
+    }
+
+    /**
+     * Closes session.
+     */
+    @Override
+    public void close() {
+        try {
+            takeSnapshot();
+        } catch(Throwable ex) {
+            LOG.error("Failed to takeSnapshot while closing the session; continuing to avoid memory leakage");
+        }
+
+        final PersistenceSession persistenceSession = getPersistenceSession();
+        if(persistenceSession != null) {
+            persistenceSession.close();
+        }
+    }
+
+    //endregion
+
+    //region > shutdown
     /**
+     * Shuts down all components.
+     *
      * Normal lifecycle is managed using callbacks in
      * {@link SessionScopedComponent}. This method is to allow the outer
      * {@link ApplicationScopedComponent}s to shutdown, closing any and all
      * running {@link IsisSession}s.
      */
-    void closeAll();
+    public void closeAll() {
+        close();
+
+        shutdownIfRequired(persistenceSession);
+    }
 
-    // //////////////////////////////////////////////////////
-    // Id
-    // //////////////////////////////////////////////////////
+    private void shutdownIfRequired(final Object o) {
+        if (o instanceof SessionScopedComponent) {
+            final SessionScopedComponent requiresSetup = (SessionScopedComponent) o;
+            requiresSetup.close();
+        }
+    }
+    //endregion
 
+    //region > convenience methods
     /**
-     * A descriptive identifier for this {@link IsisSession}.
+     * Convenience method.
+     */
+    public DeploymentType getDeploymentType() {
+        return isisSessionFactory.getDeploymentType();
+    }
+
+    /**
+     * Convenience method.
      */
-    String getId();
+    public IsisConfiguration getConfiguration() {
+        return isisSessionFactory.getConfiguration();
+    }
 
-    // //////////////////////////////////////////////////////
-    // Authentication Session
-    // //////////////////////////////////////////////////////
+    /**
+     * Convenience method.
+     */
+    public SpecificationLoaderSpi getSpecificationLoader() {
+        return isisSessionFactory.getSpecificationLoader();
+    }
+    //endregion
 
+    //region > AuthenticationSession
     /**
      * Returns the {@link AuthenticationSession} representing this user for this
      * {@link IsisSession}.
      */
-    AuthenticationSession getAuthenticationSession();
+    public AuthenticationSession getAuthenticationSession() {
+        return authenticationSession;
+    }
 
-    // //////////////////////////////////////////////////////
-    // Persistence Session
-    // //////////////////////////////////////////////////////
+    private String getSessionUserName() {
+        return getAuthenticationSession().getUserName();
+    }
+    //endregion
 
+    //region > id
+    /**
+     * A descriptive identifier for this {@link IsisSession}.
+     */
+    public String getId() {
+        return "#" + id + getSessionUserName();
+    }
+    //endregion
+
+    //region > Persistence Session
     /**
      * The {@link PersistenceSession} within this {@link IsisSession}.
      */
-    PersistenceSession getPersistenceSession();
+    public PersistenceSession getPersistenceSession() {
+        return persistenceSession;
+    }
+
+    //endregion
+
+    //region > sessionOpenTime
+    protected long getSessionOpenTime() {
+        return accessTime;
+    }
+
+    private void setSessionOpenTime(final long accessTime) {
+        this.accessTime = accessTime;
+    }
+    //endregion
+
+    //region > transaction
+
+    /**
+     * Convenience method that returns the {@link IsisTransaction} of the
+     * session, if any.
+     */
+    public IsisTransaction getCurrentTransaction() {
+        return getTransactionManager().getTransaction();
+    }
+
+    //endregion
+
+    //region > toString
+    @Override
+    public String toString() {
+        final ToString asString = new ToString(this);
+        asString.append("context", getId());
+        appendState(asString);
+        return asString.toString();
+    }
+    //endregion
+
+    //region > debugging
+
+    public void debug(final DebugBuilder debug) {
+        debug.appendAsHexln("hash", hashCode());
+        debug.appendln("context id", id);
+        debug.appendln("accessed", DATE_FORMAT.format(new Date(getSessionOpenTime())));
+        debugState(debug);
+    }
 
+    public void takeSnapshot() {
+        if (!LOG.isDebugEnabled()) {
+            return;
+        }
+        final DebugString debug = new DebugString();
+        debug(debug);
+        debug.indent();
+        debug.appendln();
 
-    
-    // //////////////////////////////////////////////////////
-    // Transaction (if in progress)
-    // //////////////////////////////////////////////////////
+        debug(debug, getPersistenceSession());
+        if (getCurrentTransaction() != null) {
+            debug(debug, getCurrentTransaction().getMessageBroker());
+        }
+        debugSnapshot = debug.toString();
 
-    IsisTransaction getCurrentTransaction();
+        LOG.debug(debugSnapshot);
+    }
 
-    // //////////////////////////////////////////////////////
-    // Debugging
-    // //////////////////////////////////////////////////////
+    private void debug(final DebugBuilder debug, final Object object) {
+        if (object instanceof DebuggableWithTitle) {
+            final DebuggableWithTitle d = (DebuggableWithTitle) object;
+            debug.startSection(d.debugTitle());
+            d.debugData(debug);
+            debug.endSection();
+        } else {
+            debug.appendln("no debug for " + object);
+        }
+    }
 
-    void debugAll(DebugBuilder debug);
+    public void appendState(final ToString asString) {
+        asString.append("authenticationSession", getAuthenticationSession());
+        asString.append("persistenceSession", getPersistenceSession());
+        asString.append("transaction", getCurrentTransaction());
+    }
 
-    void debug(DebugBuilder debug);
+    public void debugState(final DebugBuilder debug) {
+        debug.appendln("authenticationSession", getAuthenticationSession());
+        debug.appendln("persistenceSession", getPersistenceSession());
+        debug.appendln("transaction", getCurrentTransaction());
+    }
+    //endregion
 
-    void debugState(DebugBuilder debug);
+    //region > Dependencies (from constructor)
 
+    private IsisTransactionManager getTransactionManager() {
+        return getPersistenceSession().getTransactionManager();
+    }
+    //endregion
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java
deleted file mode 100644
index 4dcb7b3..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionDefault.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.session;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.components.SessionScopedComponent;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-import org.apache.isis.core.commons.debug.DebugString;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.commons.util.ToString;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
-import static org.hamcrest.CoreMatchers.*;
-
-/**
- * Analogous to a Hibernate <tt>Session</tt>, holds the current set of
- * components for a specific execution context (such as on a thread).
- * 
- * <p>
- * The <tt>IsisContext</tt> class (in <tt>nof-core</tt>) is responsible for
- * locating the current execution context.
- * 
- * @see IsisSessionFactory
- */
-public class IsisSessionDefault implements IsisSession {
-
-    private static final Logger LOG = LoggerFactory.getLogger(IsisSessionDefault.class);
-
-    private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM HH:mm:ss,SSS");
-    private static int nextId = 1;
-
-    private final IsisSessionFactory isisSessionFactory;
-
-    private final AuthenticationSession authenticationSession;
-    private PersistenceSession persistenceSession; // only non-final so can be
-                                                   // replaced in tests.
-    private final int id;
-    private long accessTime;
-    private String debugSnapshot;
-
-    public IsisSessionDefault(
-            final IsisSessionFactory sessionFactory,
-            final AuthenticationSession authenticationSession,
-            final PersistenceSession persistenceSession) {
-
-        // global context
-        ensureThatArg(sessionFactory, is(not(nullValue())), "execution context factory is required");
-
-        // session
-        ensureThatArg(authenticationSession, is(not(nullValue())), "authentication session is required");
-        ensureThatArg(persistenceSession, is(not(nullValue())), "persistence session is required");
-
-        this.isisSessionFactory = sessionFactory;
-
-        this.authenticationSession = authenticationSession;
-        this.persistenceSession = persistenceSession;
-
-        setSessionOpenTime(System.currentTimeMillis());
-
-        this.id = nextId++;
-        
-    }
-
-    // //////////////////////////////////////////////////////
-    // open, close
-    // //////////////////////////////////////////////////////
-
-    @Override
-    public void open() {
-        persistenceSession.open();
-    }
-
-    /**
-     * Closes session.
-     */
-    @Override
-    public void close() {
-        try {
-            takeSnapshot();
-        } catch(Throwable ex) {
-            LOG.error("Failed to takeSnapshot while closing the session; continuing to avoid memory leakage");
-        }
-
-        final PersistenceSession persistenceSession = getPersistenceSession();
-        if(persistenceSession != null) {
-            persistenceSession.close();
-        }
-    }
-
-    // //////////////////////////////////////////////////////
-    // shutdown
-    // //////////////////////////////////////////////////////
-
-    /**
-     * Shuts down all components.
-     */
-    @Override
-    public void closeAll() {
-        close();
-
-        shutdownIfRequired(persistenceSession);
-    }
-
-    private void shutdownIfRequired(final Object o) {
-        if (o instanceof SessionScopedComponent) {
-            final SessionScopedComponent requiresSetup = (SessionScopedComponent) o;
-            requiresSetup.close();
-        }
-    }
-
-    // //////////////////////////////////////////////////////
-    // ExecutionContextFactory
-    // //////////////////////////////////////////////////////
-
-    /**
-     * Convenience method.
-     */
-    public DeploymentType getDeploymentType() {
-        return isisSessionFactory.getDeploymentType();
-    }
-
-    /**
-     * Convenience method.
-     */
-    public IsisConfiguration getConfiguration() {
-        return isisSessionFactory.getConfiguration();
-    }
-
-    /**
-     * Convenience method.
-     */
-    public SpecificationLoaderSpi getSpecificationLoader() {
-        return isisSessionFactory.getSpecificationLoader();
-    }
-
-    // //////////////////////////////////////////////////////
-    // AuthenticationSession
-    // //////////////////////////////////////////////////////
-
-    /**
-     * Returns the security session representing this user for this execution
-     * context.
-     */
-    @Override
-    public AuthenticationSession getAuthenticationSession() {
-        return authenticationSession;
-    }
-
-    private String getSessionUserName() {
-        return getAuthenticationSession().getUserName();
-    }
-
-    // //////////////////////////////////////////////////////
-    // Id
-    // //////////////////////////////////////////////////////
-
-    /**
-     * Returns an descriptive identifier for this {@link IsisSessionDefault}.
-     */
-    @Override
-    public String getId() {
-        return "#" + id + getSessionUserName();
-    }
-
-    // //////////////////////////////////////////////////////
-    // Persistence Session
-    // //////////////////////////////////////////////////////
-
-    @Override
-    public PersistenceSession getPersistenceSession() {
-        return persistenceSession;
-    }
-
-
-    // //////////////////////////////////////////////////////
-    // Session Open Time
-    // //////////////////////////////////////////////////////
-
-    protected long getSessionOpenTime() {
-        return accessTime;
-    }
-
-    private void setSessionOpenTime(final long accessTime) {
-        this.accessTime = accessTime;
-    }
-
-    // //////////////////////////////////////////////////////
-    // Transaction
-    // //////////////////////////////////////////////////////
-
-    /**
-     * Convenience method that returns the {@link IsisTransaction} of the
-     * session, if any.
-     */
-    @Override
-    public IsisTransaction getCurrentTransaction() {
-        return getTransactionManager().getTransaction();
-    }
-
-    // //////////////////////////////////////////////////////
-    // testSetObjectPersistor
-    // //////////////////////////////////////////////////////
-
-    /**
-     * Should only be called in tests.
-     */
-    public void testSetObjectPersistor(final PersistenceSession objectPersistor) {
-        this.persistenceSession = objectPersistor;
-    }
-
-    // //////////////////////////////////////////////////////
-    // toString
-    // //////////////////////////////////////////////////////
-
-    @Override
-    public String toString() {
-        final ToString asString = new ToString(this);
-        asString.append("context", getId());
-        appendState(asString);
-        return asString.toString();
-    }
-
-    // //////////////////////////////////////////////////////
-    // Debugging
-    // //////////////////////////////////////////////////////
-
-    @Override
-    public void debugAll(final DebugBuilder debug) {
-        debug.startSection("Isis Context Snapshot");
-        debug.appendln(debugSnapshot);
-        debug.endSection();
-    }
-
-    @Override
-    public void debug(final DebugBuilder debug) {
-        debug.appendAsHexln("hash", hashCode());
-        debug.appendln("context id", id);
-        debug.appendln("accessed", DATE_FORMAT.format(new Date(getSessionOpenTime())));
-        debugState(debug);
-    }
-
-    public void takeSnapshot() {
-        if (!LOG.isDebugEnabled()) {
-            return;
-        }
-        final DebugString debug = new DebugString();
-        debug(debug);
-        debug.indent();
-        debug.appendln();
-
-        debug(debug, getPersistenceSession());
-        if (getCurrentTransaction() != null) {
-            debug(debug, getCurrentTransaction().getMessageBroker());
-        }
-        debugSnapshot = debug.toString();
-
-        LOG.debug(debugSnapshot);
-    }
-
-    private void debug(final DebugBuilder debug, final Object object) {
-        if (object instanceof DebuggableWithTitle) {
-            final DebuggableWithTitle d = (DebuggableWithTitle) object;
-            debug.startSection(d.debugTitle());
-            d.debugData(debug);
-            debug.endSection();
-        } else {
-            debug.appendln("no debug for " + object);
-        }
-    }
-
-    public void appendState(final ToString asString) {
-        asString.append("authenticationSession", getAuthenticationSession());
-        asString.append("persistenceSession", getPersistenceSession());
-        asString.append("transaction", getCurrentTransaction());
-    }
-
-    @Override
-    public void debugState(final DebugBuilder debug) {
-        debug.appendln("authenticationSession", getAuthenticationSession());
-        debug.appendln("persistenceSession", getPersistenceSession());
-        debug.appendln("transaction", getCurrentTransaction());
-    }
-
-    // /////////////////////////////////////////////////////
-    // Dependencies (from constructor)
-    // /////////////////////////////////////////////////////
-
-    private IsisTransactionManager getTransactionManager() {
-        return getPersistenceSession().getTransactionManager();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
index e62ce4d..1af2136 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
@@ -20,47 +20,164 @@
 package org.apache.isis.core.runtime.system.session;
 
 import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.adapter.oid.Oid;
 import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
 import org.apache.isis.core.runtime.authorization.AuthorizationManager;
+import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+
 /**
  * Analogous (and in essence a wrapper for) a JDO <code>PersistenceManagerFactory</code>
  * 
- * @see IsisSession
+ * Creates an implementation of
+ * {@link IsisSessionFactory#openSession(AuthenticationSession)} to create an
+ * {@link IsisSession}, but delegates to subclasses to actually obtain the
+ * components that make up that {@link IsisSession}.
+ *
+ * <p>
+ * The idea is that one subclass can use the {@link InstallerLookup} design to
+ * lookup installers for components (and hence create the components
+ * themselves), whereas another subclass might simply use Spring (or another DI
+ * container) to inject in the components according to some Spring-configured
+ * application context.
  */
-public interface IsisSessionFactory extends ApplicationScopedComponent {
+
+public class IsisSessionFactory implements ApplicationScopedComponent {
+
+
+    @SuppressWarnings("unused")
+    private final static Logger LOG = LoggerFactory.getLogger(IsisSessionFactory.class);
+
+    private final DeploymentType deploymentType;
+    private final IsisConfiguration configuration;
+    private final SpecificationLoaderSpi specificationLoaderSpi;
+    private final AuthenticationManager authenticationManager;
+    private final AuthorizationManager authorizationManager;
+    private final PersistenceSessionFactory persistenceSessionFactory;
+    private final OidMarshaller oidMarshaller;
+
+    public IsisSessionFactory (
+            final DeploymentType deploymentType,
+            final IsisConfiguration configuration,
+            final SpecificationLoaderSpi specificationLoader,
+            final AuthenticationManager authenticationManager,
+            final AuthorizationManager authorizationManager,
+            final PersistenceSessionFactory persistenceSessionFactory,
+            final OidMarshaller oidMarshaller) {
+
+        ensureThatArg(deploymentType, is(not(nullValue())));
+        ensureThatArg(configuration, is(not(nullValue())));
+        ensureThatArg(specificationLoader, is(not(nullValue())));
+        ensureThatArg(authenticationManager, is(not(nullValue())));
+        ensureThatArg(authorizationManager, is(not(nullValue())));
+        ensureThatArg(persistenceSessionFactory, is(not(nullValue())));
+
+        this.deploymentType = deploymentType;
+        this.configuration = configuration;
+        this.specificationLoaderSpi = specificationLoader;
+        this.authenticationManager = authenticationManager;
+        this.authorizationManager = authorizationManager;
+        this.persistenceSessionFactory = persistenceSessionFactory;
+        this.oidMarshaller = oidMarshaller;
+    }
+
+
+
+    // ///////////////////////////////////////////
+    // init, shutdown
+    // ///////////////////////////////////////////
+
+    /**
+     * Wires components as necessary, and then
+     * {@link ApplicationScopedComponent#init() init}ializes all.
+     */
+    @Override
+    public void init() {
+        final ServicesInjectorSpi servicesInjector = persistenceSessionFactory.getServicesInjector();
+        specificationLoaderSpi.setServiceInjector(servicesInjector);
+
+        specificationLoaderSpi.init();
+
+        // must come after init of spec loader.
+        specificationLoaderSpi.injectInto(persistenceSessionFactory);
+
+        authenticationManager.init();
+        authorizationManager.init();
+        persistenceSessionFactory.init();
+
+    }
+
+
+
+    @Override
+    public void shutdown() {
+
+        persistenceSessionFactory.shutdown();
+        authenticationManager.shutdown();
+        specificationLoaderSpi.shutdown();
+    }
+
 
     /**
      * Creates and {@link IsisSession#open() open}s the {@link IsisSession}.
      */
-    IsisSession openSession(final AuthenticationSession session);
+    public IsisSession openSession(final AuthenticationSession authenticationSession) {
+        final PersistenceSession persistenceSession = persistenceSessionFactory.createPersistenceSession();
+        ensureThatArg(persistenceSession, is(not(nullValue())));
+
+        // inject into persistenceSession any/all application-scoped components
+        // that it requires
+        getSpecificationLoader().injectInto(persistenceSession);
+
+        return newIsisSession(authenticationSession, persistenceSession);
+    }
+
+    protected IsisSession newIsisSession(
+            final AuthenticationSession authenticationSession,
+            final PersistenceSession persistenceSession) {
+        return new IsisSession(this, authenticationSession, persistenceSession);
+    }
 
     /**
      * The {@link ApplicationScopedComponent application-scoped}
-     * {@link DeploymentType}.
+     * {@link IsisConfiguration}.
      */
-    public DeploymentType getDeploymentType();
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
 
     /**
      * The {@link ApplicationScopedComponent application-scoped}
-     * {@link IsisConfiguration}.
+     * {@link DeploymentType}.
      */
-    public IsisConfiguration getConfiguration();
+    public DeploymentType getDeploymentType() {
+        return deploymentType;
+    }
 
     /**
      * The {@link ApplicationScopedComponent application-scoped}
      * {@link SpecificationLoaderSpi}.
      */
-    public SpecificationLoaderSpi getSpecificationLoader();
+    public SpecificationLoaderSpi getSpecificationLoader() {
+        return specificationLoaderSpi;
+    }
 
     /**
      * The {@link AuthenticationManager} that will be used to authenticate and
@@ -68,27 +185,38 @@ public interface IsisSessionFactory extends ApplicationScopedComponent {
      * {@link IsisSession#getAuthenticationSession() within} the
      * {@link IsisSession}.
      */
-    public AuthenticationManager getAuthenticationManager();
+    public AuthenticationManager getAuthenticationManager() {
+        return authenticationManager;
+    }
 
     /**
      * The {@link AuthorizationManager} that will be used to authorize access to
      * domain objects.
      */
-    public AuthorizationManager getAuthorizationManager();
+    public AuthorizationManager getAuthorizationManager() {
+        return authorizationManager;
+    }
 
     /**
      * The {@link org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory} that will be used to create
      * {@link PersistenceSession} {@link IsisSession#getPersistenceSession()
      * within} the {@link IsisSession}.
      */
-    public PersistenceSessionFactory getPersistenceSessionFactory();
+    public PersistenceSessionFactory getPersistenceSessionFactory() {
+        return persistenceSessionFactory;
+    }
 
-    public List<Object> getServices();
+    public List<Object> getServices() {
+        return getPersistenceSessionFactory().getServicesInjector().getRegisteredServices();
+    }
 
     /**
      * The {@link OidMarshaller} to use for marshalling and unmarshalling {@link Oid}s
      * into strings.
      */
-	public OidMarshaller getOidMarshaller();
+    public OidMarshaller getOidMarshaller() {
+        return oidMarshaller;
+    }
+
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java
deleted file mode 100644
index 1d38172..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryDefault.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.system.session;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.ListMultimap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.components.ApplicationScopedComponent;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.services.ServiceUtil;
-import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.specloader.ServiceInitializer;
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authorization.AuthorizationManager;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
-import static org.hamcrest.CoreMatchers.*;
-
-/**
- * Creates an implementation of
- * {@link IsisSessionFactory#openSession(AuthenticationSession)} to create an
- * {@link IsisSession}, but delegates to subclasses to actually obtain the
- * components that make up that {@link IsisSession}.
- * 
- * <p>
- * The idea is that one subclass can use the {@link InstallerLookup} design to
- * lookup installers for components (and hence create the components
- * themselves), whereas another subclass might simply use Spring (or another DI
- * container) to inject in the components according to some Spring-configured
- * application context.
- */
-public class IsisSessionFactoryDefault implements IsisSessionFactory {
-
-    @SuppressWarnings("unused")
-    private final static Logger LOG = LoggerFactory.getLogger(IsisSessionFactoryDefault.class);
-    
-    private final DeploymentType deploymentType;
-    private final IsisConfiguration configuration;
-    private final SpecificationLoaderSpi specificationLoaderSpi;
-    private final AuthenticationManager authenticationManager;
-    private final AuthorizationManager authorizationManager;
-    private final PersistenceSessionFactory persistenceSessionFactory;
-    private final OidMarshaller oidMarshaller;
-
-    public IsisSessionFactoryDefault(
-            final DeploymentType deploymentType,
-            final IsisConfiguration configuration,
-            final SpecificationLoaderSpi specificationLoader,
-            final AuthenticationManager authenticationManager,
-            final AuthorizationManager authorizationManager,
-            final PersistenceSessionFactory persistenceSessionFactory,
-            final OidMarshaller oidMarshaller) {
-
-        ensureThatArg(deploymentType, is(not(nullValue())));
-        ensureThatArg(configuration, is(not(nullValue())));
-        ensureThatArg(specificationLoader, is(not(nullValue())));
-        ensureThatArg(authenticationManager, is(not(nullValue())));
-        ensureThatArg(authorizationManager, is(not(nullValue())));
-        ensureThatArg(persistenceSessionFactory, is(not(nullValue())));
-
-        this.deploymentType = deploymentType;
-        this.configuration = configuration;
-        this.specificationLoaderSpi = specificationLoader;
-        this.authenticationManager = authenticationManager;
-        this.authorizationManager = authorizationManager;
-        this.persistenceSessionFactory = persistenceSessionFactory;
-        this.oidMarshaller = oidMarshaller;
-    }
-
-
-
-    // ///////////////////////////////////////////
-    // init, shutdown
-    // ///////////////////////////////////////////
-
-    /**
-     * Wires components as necessary, and then
-     * {@link ApplicationScopedComponent#init() init}ializes all.
-     */
-    @Override
-    public void init() {
-        final ServicesInjectorSpi servicesInjector = persistenceSessionFactory.getServicesInjector();
-        specificationLoaderSpi.setServiceInjector(servicesInjector);
-
-        specificationLoaderSpi.init();
-
-        // must come after init of spec loader.
-        specificationLoaderSpi.injectInto(persistenceSessionFactory);
-
-        authenticationManager.init();
-        authorizationManager.init();
-        persistenceSessionFactory.init();
-        
-    }
-
-
-    
-    @Override
-    public void shutdown() {
-        
-        persistenceSessionFactory.shutdown();
-        authenticationManager.shutdown();
-        specificationLoaderSpi.shutdown();
-    }
-
-
-    @Override
-    public IsisSession openSession(final AuthenticationSession authenticationSession) {
-        final PersistenceSession persistenceSession = persistenceSessionFactory.createPersistenceSession();
-        ensureThatArg(persistenceSession, is(not(nullValue())));
-
-        // inject into persistenceSession any/all application-scoped components
-        // that it requires
-        getSpecificationLoader().injectInto(persistenceSession);
-
-        final IsisSessionDefault isisSessionDefault = newIsisSessionDefault(authenticationSession, persistenceSession);
-        return isisSessionDefault;
-    }
-
-    protected IsisSessionDefault newIsisSessionDefault(
-            final AuthenticationSession authenticationSession,
-            final PersistenceSession persistenceSession) {
-        return new IsisSessionDefault(this, authenticationSession, persistenceSession);
-    }
-
-    @Override
-    public IsisConfiguration getConfiguration() {
-        return configuration;
-    }
-
-    @Override
-    public DeploymentType getDeploymentType() {
-        return deploymentType;
-    }
-
-    @Override
-    public SpecificationLoaderSpi getSpecificationLoader() {
-        return specificationLoaderSpi;
-    }
-
-    @Override
-    public AuthenticationManager getAuthenticationManager() {
-        return authenticationManager;
-    }
-
-    @Override
-    public AuthorizationManager getAuthorizationManager() {
-        return authorizationManager;
-    }
-
-    @Override
-    public PersistenceSessionFactory getPersistenceSessionFactory() {
-        return persistenceSessionFactory;
-    }
-
-    @Override
-    public List<Object> getServices() {
-        return getPersistenceSessionFactory().getServicesInjector().getRegisteredServices();
-    }
-    
-    @Override
-    public OidMarshaller getOidMarshaller() {
-    	return oidMarshaller;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java
deleted file mode 100644
index 54436ee..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemAbstract.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.core.runtime.systemusinginstallers;
-
-import org.apache.isis.core.runtime.system.IsisSystem;
-
-/**
- * 
- */
-public abstract class IsisSystemAbstract implements IsisSystem {
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java
index 057cbab..f0160ff 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemThatUsesInstallersFactory.java
@@ -25,7 +25,6 @@ import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.IsisSystem;
 import org.apache.isis.core.runtime.system.IsisSystemFactory;
-import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjector;
 
 /**
  * Implementation of {@link IsisSystemFactory} that uses {@link InstallerLookup}
@@ -35,19 +34,12 @@ public class IsisSystemThatUsesInstallersFactory implements IsisSystemFactory {
 
     private final InstallerLookup installerLookup;
 
-    // //////////////////////////////////////////////////////////
-    // constructor
-    // //////////////////////////////////////////////////////////
-
     @Inject
     public IsisSystemThatUsesInstallersFactory(final InstallerLookup installerLookup) {
         this.installerLookup = installerLookup;
     }
 
-    // //////////////////////////////////////////////////////////
-    // init, shutdown
-    // //////////////////////////////////////////////////////////
-
+    //region > init, shutdown
     @Override
     public void init() {
         // nothing to do
@@ -57,25 +49,13 @@ public class IsisSystemThatUsesInstallersFactory implements IsisSystemFactory {
     public void shutdown() {
         // nothing to do
     }
-
-    // //////////////////////////////////////////////////////////
-    // main API
-    // //////////////////////////////////////////////////////////
+    //endregion
 
     @Override
     public IsisSystem createSystem(final DeploymentType deploymentType) {
-
         IsisComponentProviderUsingInstallers componentProvider =
                 new IsisComponentProviderUsingInstallers(deploymentType, installerLookup);
-        return new IsisSystemUsingComponentProvider(componentProvider);
-    }
-
-    // //////////////////////////////////////////////////////////
-    // Dependencies (injected or defaulted in constructor)
-    // //////////////////////////////////////////////////////////
-
-    public SystemDependencyInjector getInstallerLookup() {
-        return installerLookup;
+        return new IsisSystem(componentProvider);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingComponentProvider.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingComponentProvider.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingComponentProvider.java
deleted file mode 100644
index 7c246aa..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingComponentProvider.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.isis.core.runtime.systemusinginstallers;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.fixtures.LogonFixture;
-import org.apache.isis.applib.fixturescripts.FixtureScripts;
-import org.apache.isis.applib.services.fixturespec.FixtureScriptsDefault;
-import org.apache.isis.core.commons.components.Noop;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.debug.DebuggableWithTitle;
-import org.apache.isis.core.commons.lang.ListExtensions;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
-import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
-import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.specloader.ServiceInitializer;
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authentication.exploration.ExplorationSession;
-import org.apache.isis.core.runtime.authorization.AuthorizationManager;
-import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
-import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.IsisSystem;
-import org.apache.isis.core.runtime.system.IsisSystemException;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.internal.InitialisationSession;
-import org.apache.isis.core.runtime.system.internal.IsisLocaleInitializer;
-import org.apache.isis.core.runtime.system.internal.IsisTimeZoneInitializer;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
-import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
-import org.apache.isis.core.runtime.system.session.IsisSessionFactoryDefault;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManagerException;
-
-public class IsisSystemUsingComponentProvider implements IsisSystem {
-
-    public static final Logger LOG = LoggerFactory.getLogger(IsisSystemAbstract.class);
-
-    private final IsisLocaleInitializer localeInitializer;
-    private final IsisTimeZoneInitializer timeZoneInitializer;
-    private final DeploymentType deploymentType;
-
-    private boolean initialized = false;
-
-    private ServiceInitializer serviceInitializer;
-    private FixturesInstaller fixtureInstaller;
-    private IsisSessionFactory sessionFactory;
-
-    //region > constructors
-
-    private final IsisComponentProvider isisComponentProvider;
-
-    public IsisSystemUsingComponentProvider(IsisComponentProvider isisComponentProvider) {
-        this.deploymentType = isisComponentProvider.getDeploymentType();
-        this.localeInitializer = new IsisLocaleInitializer();
-        this.timeZoneInitializer = new IsisTimeZoneInitializer();
-
-        this.isisComponentProvider = isisComponentProvider;
-    }
-
-    //endregion
-
-    //region > deploymentType
-    @Override
-    public DeploymentType getDeploymentType() {
-        return deploymentType;
-    }
-    //endregion
-
-    //region > sessionFactory
-
-    /**
-     * Populated after {@link #init()}.
-     */
-    @Override
-    public IsisSessionFactory getSessionFactory() {
-        return sessionFactory;
-    }
-
-    //endregion
-
-    //region > init
-
-
-    @Override
-    public void init() {
-
-        if (initialized) {
-            throw new IllegalStateException("Already initialized");
-        } else {
-            initialized = true;
-        }
-
-        LOG.info("initialising Isis System");
-        LOG.info("working directory: " + new File(".").getAbsolutePath());
-        LOG.info("resource stream source: " + getConfiguration().getResourceStreamSource());
-
-        localeInitializer.initLocale(getConfiguration());
-        timeZoneInitializer.initTimeZone(getConfiguration());
-
-        try {
-            sessionFactory = createSessionFactory(deploymentType);
-
-            // temporarily make a configuration available
-            // REVIEW: would rather inject this, or perhaps even the
-            // ConfigurationBuilder
-            IsisContext.setConfiguration(getConfiguration());
-
-            initContext(sessionFactory);
-            sessionFactory.init();
-
-            // validate here after all entities have been registered in the persistence session factory
-            final SpecificationLoaderSpi specificationLoader = sessionFactory.getSpecificationLoader();
-            specificationLoader.validateAndAssert();
-
-            serviceInitializer = initializeServices();
-
-            installFixturesIfRequired();
-
-            translateServicesAndEnumConstants();
-
-        } catch (final IsisSystemException ex) {
-            LOG.error("failed to initialise", ex);
-            throw new RuntimeException(ex);
-        }
-    }
-
-
-    private IsisSessionFactory createSessionFactory(final DeploymentType deploymentType) throws IsisSystemException {
-
-        final List<Object> services = isisComponentProvider.obtainServices();
-        final PersistenceSessionFactory persistenceSessionFactory =
-                isisComponentProvider.providePersistenceSessionFactory(deploymentType, services);
-
-        final IsisConfiguration configuration = getConfiguration();
-        final AuthenticationManager authenticationManager = isisComponentProvider
-                .provideAuthenticationManager(deploymentType);
-        final AuthorizationManager authorizationManager = isisComponentProvider
-                .provideAuthorizationManager(deploymentType);
-        final OidMarshaller oidMarshaller = createOidMarshaller();
-
-        final Collection<MetaModelRefiner> metaModelRefiners =
-                refiners(authenticationManager, authorizationManager, persistenceSessionFactory);
-        final SpecificationLoaderSpi reflector = isisComponentProvider
-                .provideSpecificationLoaderSpi(deploymentType, metaModelRefiners);
-
-        ServicesInjectorSpi servicesInjector = persistenceSessionFactory.getServicesInjector();
-        servicesInjector.addFallbackIfRequired(FixtureScripts.class, new FixtureScriptsDefault());
-        servicesInjector.validateServices();
-
-        // bind metamodel to the (runtime) framework
-        final RuntimeContextFromSession runtimeContext = createRuntimeContextFromSession();
-        runtimeContext.injectInto(reflector);
-
-        return new IsisSessionFactoryDefault(
-                deploymentType, configuration, reflector,
-                authenticationManager, authorizationManager,
-                persistenceSessionFactory, oidMarshaller);
-    }
-
-    private static Collection<MetaModelRefiner> refiners(Object... possibleRefiners ) {
-        return ListExtensions.filtered(Arrays.asList(possibleRefiners), MetaModelRefiner.class);
-    }
-
-
-    private void initContext(final IsisSessionFactory sessionFactory) {
-        getDeploymentType().initContext(sessionFactory);
-    }
-
-    /**
-     * @see #shutdownServices(ServiceInitializer)
-     */
-    private ServiceInitializer initializeServices() {
-
-        final List<Object> services = sessionFactory.getServices();
-
-        // validate
-        final ServiceInitializer serviceInitializer = new ServiceInitializer();
-        serviceInitializer.validate(getConfiguration(), services);
-
-        // call @PostConstruct (in a session)
-        IsisContext.openSession(new InitialisationSession());
-        try {
-            getTransactionManager().startTransaction();
-            try {
-                serviceInitializer.postConstruct();
-
-                return serviceInitializer;
-            } catch(RuntimeException ex) {
-                getTransactionManager().getTransaction().setAbortCause(new IsisTransactionManagerException(ex));
-                return serviceInitializer;
-            } finally {
-                // will commit or abort
-                getTransactionManager().endTransaction();
-            }
-        } finally {
-            IsisContext.closeSession();
-        }
-    }
-
-    private void installFixturesIfRequired() throws IsisSystemException {
-
-        fixtureInstaller = isisComponentProvider.obtainFixturesInstaller();
-        if (isNoop(fixtureInstaller)) {
-            return;
-        }
-
-        IsisContext.openSession(new InitialisationSession());
-        fixtureInstaller.installFixtures();
-        try {
-
-            // only allow logon fixtures if not in production mode.
-            if (!getDeploymentType().isProduction()) {
-                logonFixture = fixtureInstaller.getLogonFixture();
-            }
-        } finally {
-            IsisContext.closeSession();
-        }
-    }
-
-    private boolean isNoop(final FixturesInstaller candidate) {
-        return candidate == null || (fixtureInstaller instanceof Noop);
-    }
-
-    /**
-     * The act of invoking titleOf(...) will cause translations to be requested.
-     */
-    private void translateServicesAndEnumConstants() {
-        IsisContext.openSession(new InitialisationSession());
-        try {
-            final List<Object> services = sessionFactory.getServices();
-            final DomainObjectContainer container = lookupService(DomainObjectContainer.class);
-            for (Object service : services) {
-                final String unused = container.titleOf(service);
-            }
-            for (final ObjectSpecification objSpec : allSpecifications()) {
-                final Class<?> correspondingClass = objSpec.getCorrespondingClass();
-                if(correspondingClass.isEnum()) {
-                    final Object[] enumConstants = correspondingClass.getEnumConstants();
-                    for (Object enumConstant : enumConstants) {
-                        final String unused = container.titleOf(enumConstant);
-                    }
-                }
-            }
-        } finally {
-            IsisContext.closeSession();
-        }
-
-    }
-
-    private <T> T lookupService(final Class<T> serviceClass) {
-        return getServicesInjector().lookupService(serviceClass);
-    }
-
-    private ServicesInjectorSpi getServicesInjector() {
-        return getPersistenceSession().getServicesInjector();
-    }
-
-    private PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-    Collection<ObjectSpecification> allSpecifications() {
-        return IsisContext.getSpecificationLoader().allSpecifications();
-    }
-
-    private OidMarshaller createOidMarshaller() {
-        return new OidMarshaller();
-    }
-
-    private RuntimeContextFromSession createRuntimeContextFromSession() {
-        return new RuntimeContextFromSession();
-    }
-
-    //endregion
-
-    //region > shutdown
-
-    @Override
-    public void shutdown() {
-        LOG.info("shutting down system");
-
-        shutdownServices(this.serviceInitializer);
-
-        IsisContext.closeAllSessions();
-    }
-
-    /**
-     * @see #initializeServices()
-     */
-    private void shutdownServices(final ServiceInitializer serviceInitializer) {
-
-        // call @PostDestroy (in a session)
-        IsisContext.openSession(new InitialisationSession());
-        try {
-            getTransactionManager().startTransaction();
-            try {
-                serviceInitializer.preDestroy();
-
-            } catch(RuntimeException ex) {
-                getTransactionManager().getTransaction().setAbortCause(new IsisTransactionManagerException(ex));
-            } finally {
-                // will commit or abort
-                getTransactionManager().endTransaction();
-            }
-        } finally {
-            IsisContext.closeSession();
-        }
-    }
-
-    //endregion
-
-    //region > configuration
-    public IsisConfiguration getConfiguration() {
-        return isisComponentProvider.getConfiguration();
-    }
-    //endregion
-
-    //region > logonFixture
-    private LogonFixture logonFixture;
-
-    /**
-     * The {@link LogonFixture}, if any, obtained by running fixtures.
-     *
-     * <p>
-     * Intended to be used when for {@link DeploymentType#SERVER_EXPLORATION
-     * exploration} (instead of an {@link ExplorationSession}) or
-     * {@link DeploymentType#SERVER_PROTOTYPE prototype} deployments (saves logging
-     * in). Should be <i>ignored</i> in other {@link DeploymentType}s.
-     */
-    @Override
-    public LogonFixture getLogonFixture() {
-        return logonFixture;
-    }
-    //endregion
-
-    //region > debugging
-
-    @Override
-    public DebuggableWithTitle debugSection(final String selectionName) {
-        // DebugInfo deb;
-        if (selectionName.equals("Configuration")) {
-            return getConfiguration();
-        }
-        return null;
-    }
-
-    @Override
-    public String[] debugSectionNames() {
-        final String[] general = new String[] { "Overview", "Authenticator", "Configuration", "Reflector", "Requests", "Contexts" };
-        final String[] contextIds = IsisContext.getInstance().allSessionIds();
-        final String[] combined = new String[general.length + contextIds.length];
-        System.arraycopy(general, 0, combined, 0, general.length);
-        System.arraycopy(contextIds, 0, combined, general.length, contextIds.length);
-        return combined;
-    }
-
-    IsisTransactionManager getTransactionManager() {
-        return IsisContext.getTransactionManager();
-    }
-
-    //endregion
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
index 5838ace..6b01e83 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
@@ -39,7 +39,6 @@ import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.context.IsisContextStatic;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
-import org.apache.isis.core.runtime.system.session.IsisSessionFactoryDefault;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
 import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 
@@ -102,7 +101,7 @@ public class IsisContextTest {
             }
         });
 
-        sessionFactory = new IsisSessionFactoryDefault(DeploymentType.UNIT_TESTING, configuration, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockPersistenceSessionFactory, oidMarshaller);
+        sessionFactory = new IsisSessionFactory(DeploymentType.UNIT_TESTING, configuration, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockPersistenceSessionFactory, oidMarshaller);
         authSession = new SimpleSession("tester", Collections.<String>emptyList());
         
         IsisContext.setConfiguration(configuration);

http://git-wip-us.apache.org/repos/asf/isis/blob/fd9a217c/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java
index 77af285..ec8e1e0 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/session/IsisSessionFactoryAbstractTest_init_and_shutdown.java
@@ -84,7 +84,7 @@ public class IsisSessionFactoryAbstractTest_init_and_shutdown {
     public void validate_DomainServicesWithDuplicateIds() {
         serviceList.add(new DomainServiceWithSomeId());
         serviceList.add(new DomainServiceWithDuplicateId());
-        isf = new IsisSessionFactoryDefault(mockDeploymentType, configuration, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockPersistenceSessionFactory, mockOidMarshaller) {
+        isf = new IsisSessionFactory(mockDeploymentType, configuration, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockPersistenceSessionFactory, mockOidMarshaller) {
         };
     }
 }