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:29 UTC

[02/17] isis git commit: ISIS-1188: collapsing and disentangling IsisSystem hierarchy..

ISIS-1188: collapsing and disentangling IsisSystem hierarchy..

introduced IsisComponentProvider interface to represent the responsibilities of the subclasses if IsisSystemAbstract.


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

Branch: refs/heads/master
Commit: 860511794ca3a4e54cd2a8a1c3f92b1f43d9f504
Parents: d16add7
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 17:24:02 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 17:24:02 2015 +0100

----------------------------------------------------------------------
 .../IsisComponentProviderDefault.java           | 224 +++++++++++
 .../integtestsupport/IsisSystemDefault.java     | 212 ----------
 .../integtestsupport/IsisSystemForTest.java     |  26 +-
 .../specloader/ServiceInitializer.java          |   3 -
 .../IsisComponentProvider.java                  |  61 +++
 .../IsisComponentProviderUsingInstallers.java   | 167 ++++++++
 .../IsisSystemAbstract.java                     | 402 -------------------
 .../IsisSystemThatUsesInstallersFactory.java    |   8 +-
 .../IsisSystemUsingComponentProvider.java       | 392 ++++++++++++++++++
 .../IsisSystemUsingInstallers.java              | 192 ---------
 10 files changed, 861 insertions(+), 826 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/86051179/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java
new file mode 100644
index 0000000..b710fe1
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java
@@ -0,0 +1,224 @@
+/*
+ *  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.integtestsupport;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+import org.apache.isis.core.commons.resource.ResourceStreamSourceContextLoaderClassPath;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
+import org.apache.isis.core.metamodel.layoutmetadata.LayoutMetadataReader;
+import org.apache.isis.core.metamodel.layoutmetadata.json.LayoutMetadataReaderFromJson;
+import org.apache.isis.core.metamodel.metamodelvalidator.dflt.MetaModelValidatorDefault;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
+import org.apache.isis.core.runtime.authentication.AuthenticationManager;
+import org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandard;
+import org.apache.isis.core.runtime.authentication.standard.Authenticator;
+import org.apache.isis.core.runtime.authorization.AuthorizationManager;
+import org.apache.isis.core.runtime.authorization.standard.AuthorizationManagerStandard;
+import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
+import org.apache.isis.core.runtime.fixtures.FixturesInstallerFromConfiguration;
+import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.core.runtime.services.ServicesInstallerFromConfiguration;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.IsisSystemException;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
+import org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProvider;
+import org.apache.isis.core.runtime.transaction.facetdecorator.standard.StandardTransactionFacetDecorator;
+import org.apache.isis.core.security.authentication.AuthenticatorBypass;
+import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
+import org.apache.isis.progmodels.dflt.JavaReflectorHelper;
+import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
+
+public class IsisComponentProviderDefault implements IsisComponentProvider {
+
+    private final DeploymentType deploymentType;
+
+    private final IsisConfiguration configuration;
+    private final List<Object> servicesIfAny;
+    private final ProgrammingModel programmingModelOverride;
+    private final MetaModelValidator metaModelValidatorOverride;
+
+    public IsisComponentProviderDefault(
+            final DeploymentType deploymentType,
+            final List<Object> services,
+            final IsisConfiguration configuration,
+            final ProgrammingModel programmingModelOverride,
+            final MetaModelValidator metaModelValidatorOverride) {
+        this.deploymentType = deploymentType;
+        this.configuration = configuration;
+        this.servicesIfAny = services;
+        this.programmingModelOverride = programmingModelOverride;
+        this.metaModelValidatorOverride = metaModelValidatorOverride;
+    }
+
+    static IsisConfiguration defaultConfiguration() {
+        return new IsisConfigurationDefault(ResourceStreamSourceContextLoaderClassPath.create("config"));
+    }
+
+
+    @Override
+    public DeploymentType getDeploymentType() {
+        return deploymentType;
+    }
+
+
+    /**
+     * Reads <tt>isis.properties</tt> (and other optional property files) from the &quot;config&quot; package on the current classpath.
+     */
+    @Override
+    public IsisConfiguration getConfiguration() {
+        return configuration;
+    }
+
+
+    /**
+     * Either the services explicitly provided by a constructor, otherwise reads from the configuration.
+     */
+    @Override
+    public List<Object> obtainServices() {
+        if(servicesIfAny != null) {
+            return servicesIfAny;
+        }
+        // else
+        final ServicesInstallerFromConfiguration servicesInstaller = new ServicesInstallerFromConfiguration();
+        return servicesInstaller.getServices(getDeploymentType());
+    }
+
+    /**
+     * Install fixtures from configuration.
+     */
+    @Override
+    public FixturesInstaller obtainFixturesInstaller() throws IsisSystemException {
+        final FixturesInstallerFromConfiguration fixturesInstallerFromConfiguration = new FixturesInstallerFromConfiguration();
+        fixturesInstallerFromConfiguration.setConfiguration(getConfiguration());
+        return fixturesInstallerFromConfiguration;
+    }
+
+
+    /**
+     * <p>
+     * Each of the subcomponents can be overridden if required.
+     *
+     * @see #obtainReflectorFacetDecoratorSet()
+     * @see #obtainReflectorMetaModelValidator()
+     * @see #obtainReflectorProgrammingModel()
+     */
+    @Override
+    public SpecificationLoaderSpi provideSpecificationLoaderSpi(
+            DeploymentType deploymentType,
+            Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
+
+
+        final ProgrammingModel programmingModel = obtainReflectorProgrammingModel();
+        final Set<FacetDecorator> facetDecorators = obtainReflectorFacetDecoratorSet();
+        final MetaModelValidator mmv = obtainReflectorMetaModelValidator();
+        final List<LayoutMetadataReader> layoutMetadataReaders = obtainLayoutMetadataReaders();
+        return JavaReflectorHelper
+                .createObjectReflector(programmingModel, metaModelRefiners, facetDecorators, layoutMetadataReaders, mmv,
+                        getConfiguration());
+    }
+
+
+    private ProgrammingModel obtainReflectorProgrammingModel() {
+
+        if (programmingModelOverride != null) {
+            return programmingModelOverride;
+        }
+
+        final ProgrammingModelFacetsJava5 programmingModel = new ProgrammingModelFacetsJava5();
+
+        // TODO: this is duplicating logic in JavaReflectorInstallerNoDecorators; need to unify.
+
+        ProgrammingModel.Util.includeFacetFactories(getConfiguration(), programmingModel);
+        ProgrammingModel.Util.excludeFacetFactories(getConfiguration(), programmingModel);
+        return programmingModel;
+    }
+
+    /**
+     * Optional hook method.
+     */
+    private Set<FacetDecorator> obtainReflectorFacetDecoratorSet() {
+        return Sets.newHashSet((FacetDecorator) new StandardTransactionFacetDecorator(getConfiguration()));
+    }
+
+    /**
+     * Optional hook method.
+     */
+    protected MetaModelValidator obtainReflectorMetaModelValidator() {
+        if(metaModelValidatorOverride != null) {
+            return metaModelValidatorOverride;
+        }
+        return new MetaModelValidatorDefault();
+    }
+
+    /**
+     * Optional hook method.
+     */
+    protected List<LayoutMetadataReader> obtainLayoutMetadataReaders() {
+        return Lists.<LayoutMetadataReader>newArrayList(new LayoutMetadataReaderFromJson());
+    }
+
+
+    /**
+     * The standard authentication manager, configured with the default authenticator (allows all requests through).
+     */
+    @Override
+    public AuthenticationManager provideAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException {
+        final AuthenticationManagerStandard authenticationManager = new AuthenticationManagerStandard(getConfiguration());
+        Authenticator authenticator = new AuthenticatorBypass(configuration);
+        authenticationManager.addAuthenticator(authenticator);
+        return authenticationManager;
+    }
+
+    /**
+     * The standard authorization manager, allowing all access.
+     */
+    @Override
+    public AuthorizationManager provideAuthorizationManager(DeploymentType deploymentType) {
+        return new AuthorizationManagerStandard(getConfiguration());
+    }
+
+    @Override
+    public PersistenceSessionFactory providePersistenceSessionFactory(
+            DeploymentType deploymentType,
+            final List<Object> services) throws IsisSystemException {
+        PersistenceMechanismInstaller installer =
+                createPersistenceMechanismInstaller(getConfiguration());
+        return installer.createPersistenceSessionFactory(deploymentType, services);
+    }
+
+    private PersistenceMechanismInstaller createPersistenceMechanismInstaller(IsisConfiguration configuration) throws IsisSystemException {
+        DataNucleusPersistenceMechanismInstaller installer = new DataNucleusPersistenceMechanismInstaller();
+        installer.setConfiguration(configuration);
+        return installer;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/86051179/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java
deleted file mode 100644
index 47979aa..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemDefault.java
+++ /dev/null
@@ -1,212 +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.integtestsupport;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationDefault;
-import org.apache.isis.core.commons.resource.ResourceStreamSourceContextLoaderClassPath;
-import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
-import org.apache.isis.core.metamodel.facetdecorator.FacetDecorator;
-import org.apache.isis.core.metamodel.layoutmetadata.LayoutMetadataReader;
-import org.apache.isis.core.metamodel.layoutmetadata.json.LayoutMetadataReaderFromJson;
-import org.apache.isis.core.metamodel.metamodelvalidator.dflt.MetaModelValidatorDefault;
-import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandard;
-import org.apache.isis.core.runtime.authentication.standard.Authenticator;
-import org.apache.isis.core.runtime.authorization.AuthorizationManager;
-import org.apache.isis.core.runtime.authorization.standard.AuthorizationManagerStandard;
-import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
-import org.apache.isis.core.runtime.fixtures.FixturesInstallerFromConfiguration;
-import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
-import org.apache.isis.core.runtime.services.ServicesInstallerFromConfiguration;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.IsisSystemException;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
-import org.apache.isis.core.runtime.systemusinginstallers.IsisSystemAbstract;
-import org.apache.isis.core.runtime.transaction.facetdecorator.standard.StandardTransactionFacetDecorator;
-import org.apache.isis.core.security.authentication.AuthenticatorBypass;
-import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
-import org.apache.isis.progmodels.dflt.JavaReflectorHelper;
-import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
-
-public class IsisSystemDefault extends IsisSystemAbstract {
-
-    private final IsisConfiguration configuration;
-    private final List<Object> servicesIfAny;
-    private final ProgrammingModel programmingModelOverride;
-    private final MetaModelValidator metaModelValidatorOverride;
-
-    public IsisSystemDefault(
-            final DeploymentType deploymentType,
-            final List<Object> services,
-            final IsisConfiguration configuration,
-            final ProgrammingModel programmingModelOverride,
-            final MetaModelValidator metaModelValidatorOverride) {
-        super(deploymentType);
-        this.configuration = configuration;
-        this.servicesIfAny = services;
-        this.programmingModelOverride = programmingModelOverride;
-        this.metaModelValidatorOverride = metaModelValidatorOverride;
-    }
-
-    static IsisConfiguration defaultConfiguration() {
-        return new IsisConfigurationDefault(ResourceStreamSourceContextLoaderClassPath.create("config"));
-    }
-
-    /**
-     * Reads <tt>isis.properties</tt> (and other optional property files) from the &quot;config&quot; package on the current classpath.
-     */
-    @Override
-    public IsisConfiguration getConfiguration() {
-        return configuration;
-    }
-
-
-    /**
-     * Either the services explicitly provided by a constructor, otherwise reads from the configuration.
-     */
-    @Override
-    protected List<Object> obtainServices() {
-        if(servicesIfAny != null) {
-            return servicesIfAny;
-        }
-        // else
-        final ServicesInstallerFromConfiguration servicesInstaller = new ServicesInstallerFromConfiguration();
-        return servicesInstaller.getServices(getDeploymentType());
-    }
-
-    /**
-     * Install fixtures from configuration.
-     */
-    @Override
-    protected FixturesInstaller obtainFixturesInstaller() throws IsisSystemException {
-        final FixturesInstallerFromConfiguration fixturesInstallerFromConfiguration = new FixturesInstallerFromConfiguration();
-        fixturesInstallerFromConfiguration.setConfiguration(getConfiguration());
-        return fixturesInstallerFromConfiguration;
-    }
-
-
-    /**
-     * Optional hook method, to create the reflector with defaults (Java5, with cglib, and only the transaction facet decorators)
-     * 
-     * <p>
-     * Each of the subcomponents can be overridden if required.
-     * 
-     * @see #obtainReflectorFacetDecoratorSet()
-     * @see #obtainReflectorMetaModelValidator()
-     * @see #obtainReflectorProgrammingModel()
-     */
-    @Override
-    protected SpecificationLoaderSpi obtainSpecificationLoaderSpi(DeploymentType deploymentType, Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
-
-
-        final ProgrammingModel programmingModel = obtainReflectorProgrammingModel();
-        final Set<FacetDecorator> facetDecorators = obtainReflectorFacetDecoratorSet();
-        final MetaModelValidator mmv = obtainReflectorMetaModelValidator();
-        final List<LayoutMetadataReader> layoutMetadataReaders = obtainLayoutMetadataReaders();
-        return JavaReflectorHelper.createObjectReflector(programmingModel, metaModelRefiners, facetDecorators, layoutMetadataReaders, mmv, getConfiguration());
-    }
-
-
-    /**
-     * Optional hook method.
-     */
-    protected ProgrammingModel obtainReflectorProgrammingModel() {
-
-        if (programmingModelOverride != null) {
-            return programmingModelOverride;
-        }
-
-        final ProgrammingModelFacetsJava5 programmingModel = new ProgrammingModelFacetsJava5();
-
-        // TODO: this is duplicating logic in JavaReflectorInstallerNoDecorators; need to unify.
-
-        ProgrammingModel.Util.includeFacetFactories(getConfiguration(), programmingModel);
-        ProgrammingModel.Util.excludeFacetFactories(getConfiguration(), programmingModel);
-        return programmingModel;
-    }
-
-    /**
-     * Optional hook method.
-     */
-    protected Set<FacetDecorator> obtainReflectorFacetDecoratorSet() {
-        return Sets.newHashSet((FacetDecorator) new StandardTransactionFacetDecorator(getConfiguration()));
-    }
-
-    /**
-     * Optional hook method.
-     */
-    protected MetaModelValidator obtainReflectorMetaModelValidator() {
-        if(metaModelValidatorOverride != null) {
-            return metaModelValidatorOverride;
-        }
-        return new MetaModelValidatorDefault();
-    }
-
-    /**
-     * Optional hook method.
-     */
-    protected List<LayoutMetadataReader> obtainLayoutMetadataReaders() {
-        return Lists.<LayoutMetadataReader>newArrayList(new LayoutMetadataReaderFromJson());
-    }
-
-
-    /**
-     * The standard authentication manager, configured with the default authenticator (allows all requests through).
-     */
-    @Override
-    protected AuthenticationManager obtainAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException {
-        final AuthenticationManagerStandard authenticationManager = new AuthenticationManagerStandard(getConfiguration());
-        Authenticator authenticator = new AuthenticatorBypass(configuration);
-        authenticationManager.addAuthenticator(authenticator);
-        return authenticationManager;
-    }
-
-    /**
-     * The standard authorization manager, allowing all access.
-     */
-    @Override
-    protected AuthorizationManager obtainAuthorizationManager(DeploymentType deploymentType) {
-        return new AuthorizationManagerStandard(getConfiguration());
-    }
-
-    @Override
-    protected PersistenceSessionFactory obtainPersistenceSessionFactory(DeploymentType deploymentType, final List<Object> services) throws IsisSystemException {
-        PersistenceMechanismInstaller installer =
-                createPersistenceMechanismInstaller(getConfiguration());
-        return installer.createPersistenceSessionFactory(deploymentType, services);
-    }
-
-    private PersistenceMechanismInstaller createPersistenceMechanismInstaller(IsisConfiguration configuration) throws IsisSystemException {
-        DataNucleusPersistenceMechanismInstaller installer = new DataNucleusPersistenceMechanismInstaller();
-        installer.setConfiguration(configuration);
-        return installer;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/86051179/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 a645f5c..345305e 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
@@ -54,18 +54,20 @@ import org.apache.isis.core.runtime.logging.IsisLoggingConfigurer;
 import org.apache.isis.core.runtime.services.ServicesInstaller;
 import org.apache.isis.core.runtime.services.ServicesInstallerFromConfigurationAndAnnotation;
 import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.IsisSystem;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.ObjectStore;
 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.security.authentication.AuthenticationRequestNameOnly;
 import org.apache.isis.core.specsupport.scenarios.DomainServiceProvider;
 import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
 
 /**
- * Wraps a plain {@link IsisSystemDefault}, and provides a number of features to assist with testing.
+ * Wraps a plain {@link IsisSystem}, and provides a number of features to assist with testing.
  */
 public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServiceProvider {
 
@@ -146,7 +148,7 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
     // //////////////////////////////////////
 
 
-    private IsisSystemDefault isisSystem;
+    private IsisSystem isisSystem;
     private AuthenticationSession authenticationSession;
 
     private final IsisConfiguration configuration;
@@ -453,22 +455,22 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
     }
 
     private IsisConfiguration getConfigurationElseDefault() {
-        if(this.configuration != null) {
-            return this.configuration;
-        } else {
-            return IsisSystemDefault.defaultConfiguration();
-        }
+        return configuration != null
+                ? configuration
+                : IsisComponentProviderDefault.defaultConfiguration();
     }
 
 
-    private IsisSystemDefault createIsisSystem(List<Object> services) {
+    private IsisSystem createIsisSystem(List<Object> services) {
 
-        final IsisSystemDefault system = new IsisSystemDefault(
+        IsisComponentProviderDefault componentProvider = new IsisComponentProviderDefault(
                 DeploymentType.UNIT_TESTING, services,
                 getConfigurationElseDefault(),
                 this.programmingModel,
                 this.metaModelValidator);
-        return system;
+
+        return new IsisSystemUsingComponentProvider(
+                componentProvider);
     }
 
 
@@ -523,12 +525,12 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
     ////////////////////////////////////////////////////////////
 
     /**
-     * The {@link IsisSystemDefault} created during {@link #setUpSystem()}.
+     * The {@link IsisSystem} created during {@link #setUpSystem()}.
      *
      * <p>
      * Can fine-tune the actual implementation using the hook {@link #createIsisSystem(List)}.
      */
-    public IsisSystemDefault getIsisSystem() {
+    public IsisSystem getIsisSystem() {
         return isisSystem;
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/86051179/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ServiceInitializer.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ServiceInitializer.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ServiceInitializer.java
index 65404ab..f4d32bc 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ServiceInitializer.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/ServiceInitializer.java
@@ -32,7 +32,6 @@ public class ServiceInitializer {
     private final static Logger LOG = LoggerFactory.getLogger(ServiceInitializer.class);
 
     private Map<String, String> props;
-    
 
     private Map<Object, Method> postConstructMethodsByService = Maps.newLinkedHashMap(); 
     private Map<Object, Method> preDestroyMethodsByService = Maps.newLinkedHashMap(); 
@@ -120,7 +119,6 @@ public class ServiceInitializer {
         }
     }
 
-
     public void preDestroy() {
         LOG.info("calling @PreDestroy on all domain services");
         for (final Map.Entry<Object, Method> entry : preDestroyMethodsByService.entrySet()) {
@@ -138,5 +136,4 @@ public class ServiceInitializer {
         }
     }
 
-
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/86051179/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
new file mode 100644
index 0000000..8194a6c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
@@ -0,0 +1,61 @@
+/*
+ *  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.util.Collection;
+import java.util.List;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+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.fixtures.FixturesInstaller;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.IsisSystemException;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
+
+/**
+ * 
+ */
+public interface IsisComponentProvider {
+
+    DeploymentType getDeploymentType();
+
+    IsisConfiguration getConfiguration();
+
+    SpecificationLoaderSpi provideSpecificationLoaderSpi(
+            DeploymentType deploymentType,
+            Collection<MetaModelRefiner> metaModelRefiners) throws
+            IsisSystemException;
+
+    PersistenceSessionFactory providePersistenceSessionFactory(
+            DeploymentType deploymentType,
+            final List<Object> services) throws IsisSystemException;
+
+    AuthenticationManager provideAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException;
+
+    AuthorizationManager provideAuthorizationManager(final DeploymentType deploymentType);
+
+    List<Object> obtainServices();
+
+    FixturesInstaller obtainFixturesInstaller() throws IsisSystemException;
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/86051179/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java
new file mode 100644
index 0000000..561d54c
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java
@@ -0,0 +1,167 @@
+/*
+ *  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.util.Collection;
+import java.util.List;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.ObjectReflectorInstaller;
+import org.apache.isis.core.runtime.authentication.AuthenticationManager;
+import org.apache.isis.core.runtime.authentication.AuthenticationManagerInstaller;
+import org.apache.isis.core.runtime.authorization.AuthorizationManager;
+import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
+import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
+import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.core.runtime.services.ServicesInstaller;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.IsisSystemException;
+import org.apache.isis.core.runtime.system.SystemConstants;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
+import org.apache.isis.core.runtime.transaction.facetdecorator.standard.TransactionFacetDecoratorInstaller;
+
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+
+public class IsisComponentProviderUsingInstallers implements IsisComponentProvider {
+
+    private final DeploymentType deploymentType;
+    private final InstallerLookup installerLookup;
+
+    private AuthenticationManagerInstaller authenticationInstaller;
+    private AuthorizationManagerInstaller authorizationInstaller;
+    private ObjectReflectorInstaller reflectorInstaller;
+    private ServicesInstaller servicesInstaller;
+    private PersistenceMechanismInstaller persistenceMechanismInstaller;
+    private FixturesInstaller fixtureInstaller;
+
+    public IsisComponentProviderUsingInstallers(
+            final DeploymentType deploymentType,
+            final InstallerLookup installerLookup) {
+        this.deploymentType = deploymentType;
+        ensureThatArg(installerLookup, is(not(nullValue())));
+        this.installerLookup = installerLookup;
+
+        lookupAndSetInstallers(deploymentType);
+    }
+
+    private void lookupAndSetInstallers(final DeploymentType deploymentType) {
+
+        this.authenticationInstaller = installerLookup.authenticationManagerInstaller(
+                getConfiguration().getString(SystemConstants.AUTHENTICATION_INSTALLER_KEY),
+                deploymentType);
+
+        this.authorizationInstaller = installerLookup.authorizationManagerInstaller(
+                getConfiguration().getString(SystemConstants.AUTHORIZATION_INSTALLER_KEY), deploymentType);
+
+        this.fixtureInstaller = installerLookup.fixturesInstaller(
+                getConfiguration().getString(SystemConstants.FIXTURES_INSTALLER_KEY));
+
+        persistenceMechanismInstaller = installerLookup.persistenceMechanismInstaller(
+                getConfiguration().getString(SystemConstants.OBJECT_PERSISTOR_INSTALLER_KEY),
+                deploymentType);
+
+        reflectorInstaller = installerLookup.reflectorInstaller(
+                getConfiguration().getString(SystemConstants.REFLECTOR_KEY));
+
+        servicesInstaller = installerLookup.servicesInstaller(null);
+
+        TransactionFacetDecoratorInstaller transactionFacetDecoratorInstaller =
+                installerLookup.getInstaller(TransactionFacetDecoratorInstaller.class);
+
+        ensureThatState(authenticationInstaller, is(not(nullValue())), "authenticationInstaller could not be looked up");
+        ensureThatState(authorizationInstaller, is(not(nullValue())), "authorizationInstaller could not be looked up");
+        ensureThatState(fixtureInstaller, is(not(nullValue())), "fixtureInstaller could not be looked up");
+        ensureThatState(persistenceMechanismInstaller, is(not(nullValue())), "persistenceMechanismInstaller could not be looked up");
+        ensureThatState(reflectorInstaller, is(not(nullValue())), "reflectorInstaller could not be looked up");
+        ensureThatState(transactionFacetDecoratorInstaller, is(not(nullValue())), "transactionFacetDecoratorInstaller could not be looked up");
+        ensureThatState(servicesInstaller, is(not(nullValue())), "servicesInstaller could not be looked up");
+
+        // add in transaction support
+        reflectorInstaller.addFacetDecoratorInstaller(transactionFacetDecoratorInstaller);
+    }
+
+    //region > API
+
+    public DeploymentType getDeploymentType() {
+        return deploymentType;
+    }
+
+    /**
+     * Returns a <i>snapshot</i> of the {@link IsisConfiguration configuration}.
+     *
+     * <p>
+     *     ... as held by the internal {@link InstallerLookup}.
+     * </p>
+     *
+     * @see InstallerLookup#getConfiguration()
+     */
+    @Override
+    public IsisConfiguration getConfiguration() {
+        return installerLookup.getConfiguration();
+    }
+
+    //endregion
+
+
+    @Override
+    public AuthenticationManager provideAuthenticationManager(final DeploymentType deploymentType) {
+        return authenticationInstaller.createAuthenticationManager();
+    }
+
+    @Override
+    public  AuthorizationManager provideAuthorizationManager(final DeploymentType deploymentType) {
+        return authorizationInstaller.createAuthorizationManager();
+    }
+
+    @Override
+    public FixturesInstaller obtainFixturesInstaller() throws IsisSystemException {
+        return fixtureInstaller;
+    }
+
+    @Override
+    public SpecificationLoaderSpi provideSpecificationLoaderSpi(
+            final DeploymentType deploymentType,
+            final Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
+
+
+        return reflectorInstaller.createReflector(metaModelRefiners);
+    }
+
+    @Override
+    public List<Object> obtainServices() {
+
+        return servicesInstaller.getServices(getDeploymentType());
+    }
+
+    @Override
+    public PersistenceSessionFactory providePersistenceSessionFactory(
+            final DeploymentType deploymentType,
+            final List<Object> services) throws IsisSystemException {
+        return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, services);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/86051179/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
index 73e27bf..54436ee 100644
--- 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
@@ -19,414 +19,12 @@
 
 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.Installer;
-import org.apache.isis.core.commons.components.Noop;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.debug.DebugBuilder;
-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.installerregistry.InstallerLookup;
-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 abstract class IsisSystemAbstract 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;
-
-    //region > constructors
-
-    public IsisSystemAbstract(final DeploymentType deploymentType) {
-        this(deploymentType, new IsisLocaleInitializer(), new IsisTimeZoneInitializer());
-    }
-
-    public IsisSystemAbstract(final DeploymentType deploymentType, final IsisLocaleInitializer localeInitializer, final IsisTimeZoneInitializer timeZoneInitializer) {
-        this.deploymentType = deploymentType;
-        this.localeInitializer = localeInitializer;
-        this.timeZoneInitializer = timeZoneInitializer;
-    }
-    //endregion
-
-    //region > deploymentType
-    @Override
-    public DeploymentType getDeploymentType() {
-        return deploymentType;
-    }
-
-    //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);
-        }
-    }
-
-    //region > createSessionFactory
-
-    private IsisSessionFactory sessionFactory;
-
-    /**
-     * Populated after {@link #init()}.
-     */
-    @Override
-    public IsisSessionFactory getSessionFactory() {
-        return sessionFactory;
-    }
-
-    private IsisSessionFactory createSessionFactory(final DeploymentType deploymentType) throws IsisSystemException {
-        final List<Object> services = obtainServices();
-        final PersistenceSessionFactory persistenceSessionFactory =
-                obtainPersistenceSessionFactory(deploymentType, services);
-
-        final IsisConfiguration configuration = getConfiguration();
-        final AuthenticationManager authenticationManager = obtainAuthenticationManager(deploymentType);
-        final AuthorizationManager authorizationManager = obtainAuthorizationManager(deploymentType);
-        final OidMarshaller oidMarshaller = obtainOidMarshaller();
-
-        final Collection<MetaModelRefiner> metaModelRefiners =
-                refiners(authenticationManager, authorizationManager, persistenceSessionFactory);
-        final SpecificationLoaderSpi reflector = obtainSpecificationLoaderSpi(deploymentType, metaModelRefiners);
-
-        ServicesInjectorSpi servicesInjector = persistenceSessionFactory.getServicesInjector();
-        servicesInjector.addFallbackIfRequired(FixtureScripts.class, new FixtureScriptsDefault());
-        servicesInjector.validateServices();
-
-        // bind metamodel to the (runtime) framework
-        final RuntimeContextFromSession runtimeContext = obtainRuntimeContextFromSession();
-        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);
-    }
-    //endregion
-
-
-    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 = 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();
-    }
-
-    //endregion
-
-    //region > obtainXxx: specificationLoaderSpi, persistenceSessionFactory, oidMarshaller, runtimeContextFromSession, authenticationManager authorizationManager, services, fixturesInstaller
-
-    protected abstract SpecificationLoaderSpi obtainSpecificationLoaderSpi(DeploymentType deploymentType, Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException;
-
-    protected abstract PersistenceSessionFactory obtainPersistenceSessionFactory(DeploymentType deploymentType, final List<Object> services) throws IsisSystemException;
-
-    protected OidMarshaller obtainOidMarshaller() {
-        return new OidMarshaller();
-    }
-
-    protected RuntimeContextFromSession obtainRuntimeContextFromSession() {
-        return new RuntimeContextFromSession();
-    }
-
-    protected abstract AuthenticationManager obtainAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException;
-
-    protected abstract AuthorizationManager obtainAuthorizationManager(final DeploymentType deploymentType);
-
-    protected abstract List<Object> obtainServices();
-
-    /**
-     * This is the only {@link Installer} that is used by any (all) subclass
-     * implementations, because it effectively <i>is</i> the component we need
-     * (as opposed to a builder/factory of the component we need).
-     *
-     * <p>
-     * The fact that the component <i>is</i> an installer (and therefore can be
-     * {@link InstallerLookup} looked up} is at this level really just an
-     * incidental implementation detail useful for the subclass that uses
-     * {@link InstallerLookup} to create the other components.
-     */
-    protected abstract FixturesInstaller obtainFixturesInstaller() throws IsisSystemException;
-
-
-    //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
-    @Override
-    public abstract IsisConfiguration 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
-
-    private void debug(final DebugBuilder debug, final Object object) {
-        if (object instanceof DebuggableWithTitle) {
-            final DebuggableWithTitle d = (DebuggableWithTitle) object;
-            debug.appendTitle(d.debugTitle());
-            d.debugData(debug);
-        } else {
-            debug.appendln(object.toString());
-            debug.appendln("... no further debug information");
-        }
-    }
-
-    @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/86051179/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 19de635..057cbab 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
@@ -65,11 +65,9 @@ public class IsisSystemThatUsesInstallersFactory implements IsisSystemFactory {
     @Override
     public IsisSystem createSystem(final DeploymentType deploymentType) {
 
-        final IsisSystemUsingInstallers system = new IsisSystemUsingInstallers(deploymentType, installerLookup);
-
-        system.lookupAndSetAuthenticatorAndAuthorization(deploymentType);
-        system.lookupAndSetFixturesInstaller();
-        return system;
+        IsisComponentProviderUsingInstallers componentProvider =
+                new IsisComponentProviderUsingInstallers(deploymentType, installerLookup);
+        return new IsisSystemUsingComponentProvider(componentProvider);
     }
 
     // //////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/86051179/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
new file mode 100644
index 0000000..7c246aa
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingComponentProvider.java
@@ -0,0 +1,392 @@
+/*
+ *  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/86051179/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
deleted file mode 100644
index fa96621..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisSystemUsingInstallers.java
+++ /dev/null
@@ -1,192 +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.util.Collection;
-import java.util.List;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
-import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
-import org.apache.isis.core.metamodel.specloader.ObjectReflectorInstaller;
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authentication.AuthenticationManagerInstaller;
-import org.apache.isis.core.runtime.authorization.AuthorizationManager;
-import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
-import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
-import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
-import org.apache.isis.core.runtime.services.ServicesInstaller;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.IsisSystemException;
-import org.apache.isis.core.runtime.system.SystemConstants;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
-import org.apache.isis.core.runtime.transaction.facetdecorator.standard.TransactionFacetDecoratorInstaller;
-
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
-import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-
-public class IsisSystemUsingInstallers extends IsisSystemAbstract {
-
-    public static final Logger LOG = LoggerFactory.getLogger(IsisSystemUsingInstallers.class);
-
-    private final InstallerLookup installerLookup;
-
-    private AuthenticationManagerInstaller authenticationInstaller;
-    private AuthorizationManagerInstaller authorizationInstaller;
-    private ObjectReflectorInstaller reflectorInstaller;
-    private ServicesInstaller servicesInstaller;
-    private PersistenceMechanismInstaller persistenceMechanismInstaller;
-    private FixturesInstaller fixtureInstaller;
-
-
-    // ///////////////////////////////////////////
-    // Constructors
-    // ///////////////////////////////////////////
-
-    public IsisSystemUsingInstallers(final DeploymentType deploymentType, final InstallerLookup installerLookup) {
-        super(deploymentType);
-        ensureThatArg(installerLookup, is(not(nullValue())));
-        this.installerLookup = installerLookup;
-    }
-
-
-    // ///////////////////////////////////////////
-    // Configuration
-    // ///////////////////////////////////////////
-
-    /**
-     * Returns a <i>snapshot</i> of the {@link IsisConfiguration configuration}.
-     *
-     * <p>
-     *     ... as held by the internal {@link InstallerLookup}.
-     * </p>
-     *
-     * @see InstallerLookup#getConfiguration()
-     */
-    @Override
-    public IsisConfiguration getConfiguration() {
-        return installerLookup.getConfiguration();
-    }
-
-    // ///////////////////////////////////////////
-    // Authentication & Authorization
-    // ///////////////////////////////////////////
-
-    public void lookupAndSetAuthenticatorAndAuthorization(final DeploymentType deploymentType) {
-
-        //final IsisConfiguration configuration = installerLookup.getConfiguration();
-
-        // use the one specified in configuration
-        final String authenticationManagerKey = getConfiguration().getString(SystemConstants.AUTHENTICATION_INSTALLER_KEY);
-        final AuthenticationManagerInstaller authenticationInstaller = installerLookup.authenticationManagerInstaller(authenticationManagerKey, deploymentType);
-        if (authenticationInstaller != null) {
-            setAuthenticationInstaller(authenticationInstaller);
-        }
-        
-        // use the one specified in configuration
-        final String authorizationManagerKey = getConfiguration().getString(SystemConstants.AUTHORIZATION_INSTALLER_KEY);
-        final AuthorizationManagerInstaller authorizationInstaller = installerLookup.authorizationManagerInstaller(authorizationManagerKey, deploymentType);
-        if (authorizationInstaller != null) {
-            setAuthorizationInstaller(authorizationInstaller);
-        }
-    }
-
-    public void setAuthenticationInstaller(final AuthenticationManagerInstaller authenticationManagerInstaller) {
-        this.authenticationInstaller = authenticationManagerInstaller;
-    }
-
-    public void setAuthorizationInstaller(final AuthorizationManagerInstaller authorizationManagerInstaller) {
-        this.authorizationInstaller = authorizationManagerInstaller;
-    }
-
-    @Override
-    protected AuthenticationManager obtainAuthenticationManager(final DeploymentType deploymentType) {
-        return authenticationInstaller.createAuthenticationManager();
-    }
-
-    @Override
-    protected AuthorizationManager obtainAuthorizationManager(final DeploymentType deploymentType) {
-        return authorizationInstaller.createAuthorizationManager();
-    }
-
-    public void lookupAndSetFixturesInstaller() {
-        final IsisConfiguration configuration = installerLookup.getConfiguration();
-        final String fixture = configuration.getString(SystemConstants.FIXTURES_INSTALLER_KEY);
-
-        final FixturesInstaller fixturesInstaller = installerLookup.fixturesInstaller(fixture);
-        if (fixturesInstaller != null) {
-            this.fixtureInstaller = fixturesInstaller;
-        }
-    }
-
-    @Override
-    protected FixturesInstaller obtainFixturesInstaller() throws IsisSystemException {
-        return fixtureInstaller;
-    }
-
-    // ///////////////////////////////////////////
-    // Reflector
-    // ///////////////////////////////////////////
-
-    @Override
-    protected SpecificationLoaderSpi obtainSpecificationLoaderSpi(final DeploymentType deploymentType, final Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
-        if (reflectorInstaller == null) {
-            final String fromCmdLine = getConfiguration().getString(SystemConstants.REFLECTOR_KEY);
-            reflectorInstaller = installerLookup.reflectorInstaller(fromCmdLine);
-        }
-        ensureThatState(reflectorInstaller, is(not(nullValue())), "reflector installer has not been injected and could not be looked up");
-
-        // add in transaction support (if already in set then will be ignored)
-        reflectorInstaller.addFacetDecoratorInstaller(installerLookup.getInstaller(TransactionFacetDecoratorInstaller.class));
-
-        return reflectorInstaller.createReflector(metaModelRefiners);
-    }
-
-    @Override
-    protected List<Object> obtainServices() {
-        if (servicesInstaller == null) {
-            servicesInstaller = installerLookup.servicesInstaller(null);
-        }
-        ensureThatState(servicesInstaller, is(not(nullValue())), "services installer has not been injected and could not be looked up");
-
-        return servicesInstaller.getServices(getDeploymentType());
-    }
-
-
-    @Override
-    protected PersistenceSessionFactory obtainPersistenceSessionFactory(final DeploymentType deploymentType, final List<Object> services) throws IsisSystemException {
-
-        // look for a object store persistor
-        if (persistenceMechanismInstaller == null) {
-            final String persistenceMechanism = getConfiguration().getString(SystemConstants.OBJECT_PERSISTOR_INSTALLER_KEY);
-            persistenceMechanismInstaller = installerLookup.persistenceMechanismInstaller(persistenceMechanism, deploymentType);
-        }
-
-        ensureThatState(persistenceMechanismInstaller, is(not(nullValue())), "persistor installer has not been injected and could not be looked up");
-        return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, services);
-    }
-}