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/06 11:28:31 UTC

[1/9] isis git commit: ISIS-1187: mothballing legacy integration test support.

Repository: isis
Updated Branches:
  refs/heads/ISIS-848 afc133c7b -> 6ccf96c9a (forced update)


ISIS-1187: mothballing legacy integration test support.


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

Branch: refs/heads/ISIS-848
Commit: 6549e1eb46bd048eb31fcdba93759acdedb6c128
Parents: 1d5e8c1
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 06:55:26 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 06:55:26 2015 +0100

----------------------------------------------------------------------
 .../integtestsupport/legacy/Authenticator.java  |  32 ---
 .../integtestsupport/legacy/Authorizor.java     |  32 ---
 .../core/integtestsupport/legacy/ConfigDir.java |  36 ----
 .../core/integtestsupport/legacy/Fixture.java   |  33 ---
 .../core/integtestsupport/legacy/Fixtures.java  |  33 ---
 .../integtestsupport/legacy/IsisTestRunner.java | 215 -------------------
 .../core/integtestsupport/legacy/Persistor.java |  32 ---
 .../core/integtestsupport/legacy/Service.java   |  33 ---
 .../core/integtestsupport/legacy/Services.java  |  33 ---
 .../legacy/components/AnnotationInstaller.java  |  94 --------
 .../FixtureInstallerAnnotatedClass.java         |  88 --------
 .../IsisSystemUsingInstallersWithinJunit.java   |  73 -------
 .../ServicesInstallerAnnotatedClass.java        |  91 --------
 .../integtestsupport/legacy/Authenticator.java  |  32 +++
 .../integtestsupport/legacy/Authorizor.java     |  32 +++
 .../core/integtestsupport/legacy/ConfigDir.java |  36 ++++
 .../core/integtestsupport/legacy/Fixture.java   |  33 +++
 .../core/integtestsupport/legacy/Fixtures.java  |  33 +++
 .../integtestsupport/legacy/IsisTestRunner.java | 215 +++++++++++++++++++
 .../core/integtestsupport/legacy/Persistor.java |  32 +++
 .../core/integtestsupport/legacy/Service.java   |  33 +++
 .../core/integtestsupport/legacy/Services.java  |  33 +++
 .../legacy/components/AnnotationInstaller.java  |  94 ++++++++
 .../FixtureInstallerAnnotatedClass.java         |  88 ++++++++
 .../IsisSystemUsingInstallersWithinJunit.java   |  73 +++++++
 .../ServicesInstallerAnnotatedClass.java        |  91 ++++++++
 26 files changed, 825 insertions(+), 825 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java
deleted file mode 100644
index b788520..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java
+++ /dev/null
@@ -1,32 +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.legacy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Authenticator {
-    Class<?> value();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java
deleted file mode 100644
index be399b3..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java
+++ /dev/null
@@ -1,32 +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.legacy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Authorizor {
-    Class<?> value();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java
deleted file mode 100644
index eac566c..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java
+++ /dev/null
@@ -1,36 +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.legacy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * The location of the <tt>config</tt> directory, relative to the base.
- */
-@Target(ElementType.TYPE)
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ConfigDir {
-    String value();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
deleted file mode 100644
index bf8a9f8..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
+++ /dev/null
@@ -1,33 +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.legacy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Fixture {
-    Class<?> value();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
deleted file mode 100644
index f2e25ed..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
+++ /dev/null
@@ -1,33 +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.legacy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Fixtures {
-    Fixture[] value();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
deleted file mode 100644
index cdd1170..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
+++ /dev/null
@@ -1,215 +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.legacy;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import org.jmock.Mockery;
-import org.junit.internal.runners.*;
-import org.junit.runner.Description;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunNotifier;
-import org.apache.isis.applib.fixtures.LogonFixture;
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
-import org.apache.isis.core.commons.config.IsisConfigurationBuilderDefault;
-import org.apache.isis.core.integtestsupport.legacy.components.IsisSystemUsingInstallersWithinJunit;
-import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
-import org.apache.isis.core.runtime.authentication.exploration.AuthenticationRequestExploration;
-import org.apache.isis.core.runtime.fixtures.authentication.AuthenticationRequestLogonFixture;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.SystemConstants;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
-
-/**
- * Copied from JMock, and with the same support.
- * 
- */
-public class IsisTestRunner extends JUnit4ClassRunner {
-
-    private final Field mockeryField;
-
-    /**
-     * Only used during object construction.
-     */
-    public IsisTestRunner(final Class<?> testClass) throws InitializationError {
-        super(testClass);
-
-        // JMock initialization, adapted to allow for no mockery field.
-        mockeryField = findFieldAndMakeAccessible(testClass, Mockery.class);
-    }
-
-    private static String getConfigDir(final Class<?> javaClass) {
-        final ConfigDir fixturesAnnotation = javaClass.getAnnotation(ConfigDir.class);
-        if (fixturesAnnotation != null) {
-            return fixturesAnnotation.value();
-        }
-        return null;
-    }
-
-    @Override
-    protected void invokeTestMethod(final Method method, final RunNotifier notifier) {
-
-        final TestClass testClass = getTestClass();
-        final String configDirIfAny = getConfigDir(testClass.getJavaClass());
-
-        final Description description = methodDescription(method);
-
-        final IsisConfigurationBuilder isisConfigurationBuilder = new IsisConfigurationBuilderDefault(configDirIfAny);
-        isisConfigurationBuilder.add(SystemConstants.NOSPLASH_KEY, "" + true); // switch
-                                                                               // off
-                                                                               // splash
-
-        final InstallerLookup installerLookup = new InstallerLookup();
-        isisConfigurationBuilder.injectInto(installerLookup);
-        installerLookup.init();
-
-        IsisSystemUsingInstallersWithinJunit system = null;
-        AuthenticationSession session = null;
-        try {
-            // init the system; cf similar code in Isis and
-            // IsisServletContextInitializer
-            final DeploymentType deploymentType = DeploymentType.UNIT_TESTING;
-
-            // TODO: replace with regular IsisSystem and remove this subclass.
-            system = new IsisSystemUsingInstallersWithinJunit(deploymentType, installerLookup, testClass);
-
-            system.init();
-
-            // specific to this bootstrap mechanism
-            AuthenticationRequest request;
-            final LogonFixture logonFixture = system.getFixturesInstaller().getLogonFixture();
-            if (logonFixture != null) {
-                request = new AuthenticationRequestLogonFixture(logonFixture);
-            } else {
-                request = new AuthenticationRequestExploration(logonFixture);
-            }
-            session = IsisContext.getAuthenticationManager().authenticate(request);
-
-            IsisContext.openSession(session);
-            getTransactionManager().startTransaction();
-
-            final Object test = createTest();
-            getServicesInjector().injectServicesInto(test);
-
-            final TestMethod testMethod = wrapMethod(method);
-            new MethodRoadie(test, testMethod, notifier, description).run();
-
-            getTransactionManager().endTransaction();
-
-        } catch (final InvocationTargetException e) {
-            testAborted(notifier, description, e.getCause());
-            getTransactionManager().abortTransaction();
-            return;
-        } catch (final Exception e) {
-            testAborted(notifier, description, e);
-            return;
-        } finally {
-            if (system != null) {
-                if (session != null) {
-                    IsisContext.closeSession();
-                }
-                system.shutdown();
-            }
-        }
-    }
-
-    private void testAborted(final RunNotifier notifier, final Description description, final Throwable e) {
-        notifier.fireTestStarted(description);
-        notifier.fireTestFailure(new Failure(description, e));
-        notifier.fireTestFinished(description);
-    }
-
-    /**
-     * Taken from JMock's runner.
-     */
-    @Override
-    protected TestMethod wrapMethod(final Method method) {
-        return new TestMethod(method, getTestClass()) {
-            @Override
-            public void invoke(final Object testFixture) throws IllegalAccessException, InvocationTargetException {
-
-                super.invoke(testFixture);
-
-                if (mockeryField != null) {
-                    mockeryOf(testFixture).assertIsSatisfied();
-                }
-            }
-        };
-    }
-
-    /**
-     * JMock code.
-     * 
-     * @param test
-     * @return
-     */
-    protected Mockery mockeryOf(final Object test) {
-        if (mockeryField == null) {
-            return null;
-        }
-        try {
-            final Mockery mockery = (Mockery) mockeryField.get(test);
-            if (mockery == null) {
-                throw new IllegalStateException(String.format("Mockery named '%s' is null", mockeryField.getName()));
-            }
-            return mockery;
-        } catch (final IllegalAccessException e) {
-            throw new IllegalStateException(String.format("cannot get value of field %s", mockeryField.getName()), e);
-        }
-    }
-
-    /**
-     * Adapted from JMock code.
-     */
-    static Field findFieldAndMakeAccessible(final Class<?> testClass, final Class<?> clazz) throws InitializationError {
-        for (Class<?> c = testClass; c != Object.class; c = c.getSuperclass()) {
-            for (final Field field : c.getDeclaredFields()) {
-                if (clazz.isAssignableFrom(field.getType())) {
-                    field.setAccessible(true);
-                    return field;
-                }
-            }
-        }
-        return null;
-    }
-
-    // /////////////////////////////////////////////////////
-    // Dependencies (from context)
-    // /////////////////////////////////////////////////////
-
-    private static PersistenceSession getPersistenceSession() {
-        return IsisContext.getPersistenceSession();
-    }
-
-    private static ServicesInjectorSpi getServicesInjector() {
-        return getPersistenceSession().getServicesInjector();
-    }
-
-    private static IsisTransactionManager getTransactionManager() {
-        return getPersistenceSession().getTransactionManager();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java
deleted file mode 100644
index 32ad6e0..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java
+++ /dev/null
@@ -1,32 +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.legacy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Persistor {
-    Class<?> value();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
deleted file mode 100644
index 4e52531..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
+++ /dev/null
@@ -1,33 +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.legacy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Service {
-    Class<?> value();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
deleted file mode 100644
index f4290d5..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
+++ /dev/null
@@ -1,33 +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.legacy;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.TYPE)
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Services {
-    Service[] value();
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java
deleted file mode 100644
index 151de42..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java
+++ /dev/null
@@ -1,94 +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.legacy.components;
-
-import org.apache.isis.core.integtestsupport.legacy.Authenticator;
-import org.apache.isis.core.integtestsupport.legacy.Authorizor;
-import org.apache.isis.core.integtestsupport.legacy.Persistor;
-import org.apache.isis.core.runtime.authentication.AuthenticationManagerInstaller;
-import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
-import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
-import org.apache.isis.core.security.authentication.BypassAuthenticationManagerInstaller;
-import org.apache.isis.core.security.authorization.BypassAuthorizationManagerInstaller;
-import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
-
-public class AnnotationInstaller {
-
-    /**
-     * Should be called prior to installing; typically called immediately after
-     * instantiation.
-     * 
-     * <p>
-     * Note: an alternative design would be to have a 1-arg constructor, but the
-     * convention for installers is to make them no-arg.
-     */
-    // {{ AuthenticationManagerInstaller
-    public AuthenticationManagerInstaller addAuthenticatorAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
-        final Authenticator authenticatorAnnotation = javaClass.getAnnotation(Authenticator.class);
-        if (authenticatorAnnotation != null) {
-            return addAuthenticatorRepresentedBy(authenticatorAnnotation);
-        } else {
-            return new BypassAuthenticationManagerInstaller();
-        }
-
-    }
-
-    private AuthenticationManagerInstaller addAuthenticatorRepresentedBy(final Authenticator authenticatorAnnotation) throws InstantiationException, IllegalAccessException {
-        final Class<?> fixtureClass = authenticatorAnnotation.value();
-        return (AuthenticationManagerInstaller) fixtureClass.newInstance();
-    }
-
-    // }}
-
-    // {{ AuthorizationManagerInstaller
-    public AuthorizationManagerInstaller addAuthorizerAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
-        final Authorizor authorizorAnnotation = javaClass.getAnnotation(Authorizor.class);
-        if (authorizorAnnotation != null) {
-            return addAuthorizerRepresentedBy(authorizorAnnotation);
-        } else {
-            return new BypassAuthorizationManagerInstaller();
-        }
-
-    }
-
-    private AuthorizationManagerInstaller addAuthorizerRepresentedBy(final Authorizor authorizorAnnotation) throws InstantiationException, IllegalAccessException {
-        final Class<?> fixtureClass = authorizorAnnotation.value();
-        return (AuthorizationManagerInstaller) fixtureClass.newInstance();
-    }
-
-    // }}
-
-    // {{ PersistenceMechanismInstaller
-    public PersistenceMechanismInstaller addPersistorAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
-        final Persistor annotation = javaClass.getAnnotation(Persistor.class);
-        return annotation != null
-                ? addPersistorRepresentedBy(annotation)
-                : new DataNucleusPersistenceMechanismInstaller();
-
-    }
-
-    private PersistenceMechanismInstaller addPersistorRepresentedBy(
-            final Persistor annotation)
-            throws InstantiationException, IllegalAccessException {
-        final Class<?> fixtureClass = annotation.value();
-        return (PersistenceMechanismInstaller) fixtureClass.newInstance();
-    }
-    // }}
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
deleted file mode 100644
index 43b30ed..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
+++ /dev/null
@@ -1,88 +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.legacy.components;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.core.integtestsupport.legacy.Fixture;
-import org.apache.isis.core.integtestsupport.legacy.Fixtures;
-import org.apache.isis.core.runtime.fixtures.FixturesInstallerAbstract;
-import org.apache.isis.core.runtime.fixtures.FixturesInstallerDelegate;
-
-public class FixtureInstallerAnnotatedClass extends FixturesInstallerAbstract {
-
-    private final List<Object> fixtures = new ArrayList<Object>();
-
-    /**
-     * @see #addFixturesAnnotatedOn(Class)
-     */
-    public FixtureInstallerAnnotatedClass() {
-        super("annotated");
-    }
-
-    // ///////////////////////////////////////////
-    // Hook method
-    // ///////////////////////////////////////////
-
-    /**
-     * Just copies the fixtures added using
-     * {@link #addFixturesAnnotatedOn(Class)} into the delegate.
-     */
-    @Override
-    protected void addFixturesTo(final FixturesInstallerDelegate delegate) {
-        for (final Object fixture : fixtures) {
-            delegate.addFixture(fixture);
-        }
-    }
-
-    // ///////////////////////////////////////////
-    // addFixturesAnnotatedOn (not API)
-    // ///////////////////////////////////////////
-
-    /**
-     * Should be called prior to installing; typically called immediately after
-     * instantiation.
-     * 
-     * <p>
-     * Note: an alternative design would be to have a 1-arg constructor, but the
-     * convention for installers is to make them no-arg.
-     */
-    public void addFixturesAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
-        final Fixtures fixturesAnnotation = javaClass.getAnnotation(Fixtures.class);
-        if (fixturesAnnotation != null) {
-            final Fixture[] fixtureAnnotations = fixturesAnnotation.value();
-            for (final Fixture fixtureAnnotation : fixtureAnnotations) {
-                addFixtureRepresentedBy(fixtureAnnotation, fixtures);
-            }
-        }
-
-        final Fixture fixtureAnnotation = javaClass.getAnnotation(Fixture.class);
-        if (fixtureAnnotation != null) {
-            addFixtureRepresentedBy(fixtureAnnotation, fixtures);
-        }
-    }
-
-    private void addFixtureRepresentedBy(final Fixture fixtureAnnotation, final List<Object> fixtures) throws InstantiationException, IllegalAccessException {
-        final Class<?> fixtureClass = fixtureAnnotation.value();
-        fixtures.add(fixtureClass.newInstance());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
deleted file mode 100644
index b4bbc87..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
+++ /dev/null
@@ -1,73 +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.legacy.components;
-
-import org.junit.internal.runners.TestClass;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.systemusinginstallers.IsisSystemUsingInstallers;
-
-public class IsisSystemUsingInstallersWithinJunit extends IsisSystemUsingInstallers {
-
-    private final TestClass testClass;
-
-    public IsisSystemUsingInstallersWithinJunit(final DeploymentType deploymentType, final InstallerLookup installerLookup, final TestClass testClass) {
-        super(deploymentType, installerLookup);
-        installerLookup.getConfigurationBuilder().add("isis.deploymentType", deploymentType.nameLowerCase());
-        
-        this.testClass = testClass;
-
-        final AnnotationInstaller installer = new AnnotationInstaller();
-
-        try {
-            setAuthenticationInstaller(getInstallerLookup().injectDependenciesInto(installer.addAuthenticatorAnnotatedOn(this.testClass.getJavaClass())));
-
-            setAuthorizationInstaller(getInstallerLookup().injectDependenciesInto(installer.addAuthorizerAnnotatedOn(this.testClass.getJavaClass())));
-
-            setPersistenceMechanismInstaller(getInstallerLookup().injectDependenciesInto(installer.addPersistorAnnotatedOn(this.testClass.getJavaClass())));
-
-            // fixture installer
-            final FixtureInstallerAnnotatedClass fixtureInstaller = new FixtureInstallerAnnotatedClass();
-            fixtureInstaller.addFixturesAnnotatedOn(this.testClass.getJavaClass());
-            setFixtureInstaller(fixtureInstaller);
-        } catch (final InstantiationException e) {
-            throw new IsisException(e);
-        } catch (final IllegalAccessException e) {
-            throw new IsisException(e);
-        }
-
-        // services installer
-        final ServicesInstallerAnnotatedClass servicesInstaller = new ServicesInstallerAnnotatedClass();
-        try {
-            servicesInstaller.addServicesAnnotatedOn(this.testClass.getJavaClass());
-        } catch (final InstantiationException e) {
-            throw new IsisException(e);
-        } catch (final IllegalAccessException e) {
-            throw new IsisException(e);
-        }
-        setServicesInstaller(servicesInstaller);
-    }
-
-    public TestClass getTestClass() {
-        return testClass;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
deleted file mode 100644
index 3d6fec2..0000000
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
+++ /dev/null
@@ -1,91 +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.legacy.components;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.core.integtestsupport.legacy.Service;
-import org.apache.isis.core.integtestsupport.legacy.Services;
-import org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault;
-import org.apache.isis.core.runtime.services.ServicesInstallerAbstract;
-
-public class ServicesInstallerAnnotatedClass extends ServicesInstallerAbstract {
-
-    public ServicesInstallerAnnotatedClass() {
-        super("annotated");
-    }
-
-    public void addServicesAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
-        final List<Object> services = new ArrayList<Object>();
-        addServicesAnnotatedOn(javaClass, services);
-
-        final DomainObjectContainer doc = lookupContainerIn(services);
-        if(doc == null) {
-            services.add(new DomainObjectContainerDefault());
-        }
-
-        addServices(services);
-
-    }
-
-    private static DomainObjectContainer lookupContainerIn(List<Object> services1) {
-        for (Object service : services1) {
-            if(service instanceof DomainObjectContainer) {
-                return (DomainObjectContainer) service;
-            }
-        }
-        return null;
-    }
-
-
-    private void addServicesAnnotatedOn(final Class<?> testClass, final List<Object> services) throws InstantiationException, IllegalAccessException {
-        final Services servicesAnnotation = testClass.getAnnotation(Services.class);
-        if (servicesAnnotation != null) {
-            final Service[] serviceAnnotations = servicesAnnotation.value();
-            for (final Service serviceAnnotation : serviceAnnotations) {
-                addServiceRepresentedBy(serviceAnnotation, services);
-            }
-        }
-
-        final Service serviceAnnotation = testClass.getAnnotation(Service.class);
-        if (serviceAnnotation != null) {
-            addServiceRepresentedBy(serviceAnnotation, services);
-        }
-    }
-
-    private void addServiceRepresentedBy(final Service serviceAnnotation, final List<Object> services) throws InstantiationException, IllegalAccessException {
-        final Class<?> serviceClass = serviceAnnotation.value();
-        // there's no need to unravel any Collections of services,
-        // because the ServiceLoader will do it for us later.
-        services.add(serviceClass.newInstance());
-    }
-
-    @Override
-    public List<Class<?>> getTypes() {
-        return listOf(List.class); // ie List<Object.class>, of services
-    }
-
-    @Override
-    public void setIgnoreFailures(boolean ignoreFailures) {
-        // no-op
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java
new file mode 100644
index 0000000..b788520
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java
@@ -0,0 +1,32 @@
+/*
+ *  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.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Authenticator {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java
new file mode 100644
index 0000000..be399b3
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java
@@ -0,0 +1,32 @@
+/*
+ *  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.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Authorizor {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java
new file mode 100644
index 0000000..eac566c
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java
@@ -0,0 +1,36 @@
+/*
+ *  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.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The location of the <tt>config</tt> directory, relative to the base.
+ */
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ConfigDir {
+    String value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
new file mode 100644
index 0000000..bf8a9f8
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
@@ -0,0 +1,33 @@
+/*
+ *  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.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Fixture {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
new file mode 100644
index 0000000..f2e25ed
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
@@ -0,0 +1,33 @@
+/*
+ *  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.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Fixtures {
+    Fixture[] value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
new file mode 100644
index 0000000..cdd1170
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
@@ -0,0 +1,215 @@
+/*
+ *  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.legacy;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import org.jmock.Mockery;
+import org.junit.internal.runners.*;
+import org.junit.runner.Description;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunNotifier;
+import org.apache.isis.applib.fixtures.LogonFixture;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilderDefault;
+import org.apache.isis.core.integtestsupport.legacy.components.IsisSystemUsingInstallersWithinJunit;
+import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.core.runtime.authentication.exploration.AuthenticationRequestExploration;
+import org.apache.isis.core.runtime.fixtures.authentication.AuthenticationRequestLogonFixture;
+import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.SystemConstants;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+
+/**
+ * Copied from JMock, and with the same support.
+ * 
+ */
+public class IsisTestRunner extends JUnit4ClassRunner {
+
+    private final Field mockeryField;
+
+    /**
+     * Only used during object construction.
+     */
+    public IsisTestRunner(final Class<?> testClass) throws InitializationError {
+        super(testClass);
+
+        // JMock initialization, adapted to allow for no mockery field.
+        mockeryField = findFieldAndMakeAccessible(testClass, Mockery.class);
+    }
+
+    private static String getConfigDir(final Class<?> javaClass) {
+        final ConfigDir fixturesAnnotation = javaClass.getAnnotation(ConfigDir.class);
+        if (fixturesAnnotation != null) {
+            return fixturesAnnotation.value();
+        }
+        return null;
+    }
+
+    @Override
+    protected void invokeTestMethod(final Method method, final RunNotifier notifier) {
+
+        final TestClass testClass = getTestClass();
+        final String configDirIfAny = getConfigDir(testClass.getJavaClass());
+
+        final Description description = methodDescription(method);
+
+        final IsisConfigurationBuilder isisConfigurationBuilder = new IsisConfigurationBuilderDefault(configDirIfAny);
+        isisConfigurationBuilder.add(SystemConstants.NOSPLASH_KEY, "" + true); // switch
+                                                                               // off
+                                                                               // splash
+
+        final InstallerLookup installerLookup = new InstallerLookup();
+        isisConfigurationBuilder.injectInto(installerLookup);
+        installerLookup.init();
+
+        IsisSystemUsingInstallersWithinJunit system = null;
+        AuthenticationSession session = null;
+        try {
+            // init the system; cf similar code in Isis and
+            // IsisServletContextInitializer
+            final DeploymentType deploymentType = DeploymentType.UNIT_TESTING;
+
+            // TODO: replace with regular IsisSystem and remove this subclass.
+            system = new IsisSystemUsingInstallersWithinJunit(deploymentType, installerLookup, testClass);
+
+            system.init();
+
+            // specific to this bootstrap mechanism
+            AuthenticationRequest request;
+            final LogonFixture logonFixture = system.getFixturesInstaller().getLogonFixture();
+            if (logonFixture != null) {
+                request = new AuthenticationRequestLogonFixture(logonFixture);
+            } else {
+                request = new AuthenticationRequestExploration(logonFixture);
+            }
+            session = IsisContext.getAuthenticationManager().authenticate(request);
+
+            IsisContext.openSession(session);
+            getTransactionManager().startTransaction();
+
+            final Object test = createTest();
+            getServicesInjector().injectServicesInto(test);
+
+            final TestMethod testMethod = wrapMethod(method);
+            new MethodRoadie(test, testMethod, notifier, description).run();
+
+            getTransactionManager().endTransaction();
+
+        } catch (final InvocationTargetException e) {
+            testAborted(notifier, description, e.getCause());
+            getTransactionManager().abortTransaction();
+            return;
+        } catch (final Exception e) {
+            testAborted(notifier, description, e);
+            return;
+        } finally {
+            if (system != null) {
+                if (session != null) {
+                    IsisContext.closeSession();
+                }
+                system.shutdown();
+            }
+        }
+    }
+
+    private void testAborted(final RunNotifier notifier, final Description description, final Throwable e) {
+        notifier.fireTestStarted(description);
+        notifier.fireTestFailure(new Failure(description, e));
+        notifier.fireTestFinished(description);
+    }
+
+    /**
+     * Taken from JMock's runner.
+     */
+    @Override
+    protected TestMethod wrapMethod(final Method method) {
+        return new TestMethod(method, getTestClass()) {
+            @Override
+            public void invoke(final Object testFixture) throws IllegalAccessException, InvocationTargetException {
+
+                super.invoke(testFixture);
+
+                if (mockeryField != null) {
+                    mockeryOf(testFixture).assertIsSatisfied();
+                }
+            }
+        };
+    }
+
+    /**
+     * JMock code.
+     * 
+     * @param test
+     * @return
+     */
+    protected Mockery mockeryOf(final Object test) {
+        if (mockeryField == null) {
+            return null;
+        }
+        try {
+            final Mockery mockery = (Mockery) mockeryField.get(test);
+            if (mockery == null) {
+                throw new IllegalStateException(String.format("Mockery named '%s' is null", mockeryField.getName()));
+            }
+            return mockery;
+        } catch (final IllegalAccessException e) {
+            throw new IllegalStateException(String.format("cannot get value of field %s", mockeryField.getName()), e);
+        }
+    }
+
+    /**
+     * Adapted from JMock code.
+     */
+    static Field findFieldAndMakeAccessible(final Class<?> testClass, final Class<?> clazz) throws InitializationError {
+        for (Class<?> c = testClass; c != Object.class; c = c.getSuperclass()) {
+            for (final Field field : c.getDeclaredFields()) {
+                if (clazz.isAssignableFrom(field.getType())) {
+                    field.setAccessible(true);
+                    return field;
+                }
+            }
+        }
+        return null;
+    }
+
+    // /////////////////////////////////////////////////////
+    // Dependencies (from context)
+    // /////////////////////////////////////////////////////
+
+    private static PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    private static ServicesInjectorSpi getServicesInjector() {
+        return getPersistenceSession().getServicesInjector();
+    }
+
+    private static IsisTransactionManager getTransactionManager() {
+        return getPersistenceSession().getTransactionManager();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java
new file mode 100644
index 0000000..32ad6e0
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java
@@ -0,0 +1,32 @@
+/*
+ *  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.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Persistor {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
new file mode 100644
index 0000000..4e52531
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
@@ -0,0 +1,33 @@
+/*
+ *  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.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Service {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
new file mode 100644
index 0000000..f4290d5
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
@@ -0,0 +1,33 @@
+/*
+ *  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.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Services {
+    Service[] value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java
new file mode 100644
index 0000000..151de42
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java
@@ -0,0 +1,94 @@
+/*
+ *  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.legacy.components;
+
+import org.apache.isis.core.integtestsupport.legacy.Authenticator;
+import org.apache.isis.core.integtestsupport.legacy.Authorizor;
+import org.apache.isis.core.integtestsupport.legacy.Persistor;
+import org.apache.isis.core.runtime.authentication.AuthenticationManagerInstaller;
+import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
+import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.core.security.authentication.BypassAuthenticationManagerInstaller;
+import org.apache.isis.core.security.authorization.BypassAuthorizationManagerInstaller;
+import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
+
+public class AnnotationInstaller {
+
+    /**
+     * Should be called prior to installing; typically called immediately after
+     * instantiation.
+     * 
+     * <p>
+     * Note: an alternative design would be to have a 1-arg constructor, but the
+     * convention for installers is to make them no-arg.
+     */
+    // {{ AuthenticationManagerInstaller
+    public AuthenticationManagerInstaller addAuthenticatorAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final Authenticator authenticatorAnnotation = javaClass.getAnnotation(Authenticator.class);
+        if (authenticatorAnnotation != null) {
+            return addAuthenticatorRepresentedBy(authenticatorAnnotation);
+        } else {
+            return new BypassAuthenticationManagerInstaller();
+        }
+
+    }
+
+    private AuthenticationManagerInstaller addAuthenticatorRepresentedBy(final Authenticator authenticatorAnnotation) throws InstantiationException, IllegalAccessException {
+        final Class<?> fixtureClass = authenticatorAnnotation.value();
+        return (AuthenticationManagerInstaller) fixtureClass.newInstance();
+    }
+
+    // }}
+
+    // {{ AuthorizationManagerInstaller
+    public AuthorizationManagerInstaller addAuthorizerAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final Authorizor authorizorAnnotation = javaClass.getAnnotation(Authorizor.class);
+        if (authorizorAnnotation != null) {
+            return addAuthorizerRepresentedBy(authorizorAnnotation);
+        } else {
+            return new BypassAuthorizationManagerInstaller();
+        }
+
+    }
+
+    private AuthorizationManagerInstaller addAuthorizerRepresentedBy(final Authorizor authorizorAnnotation) throws InstantiationException, IllegalAccessException {
+        final Class<?> fixtureClass = authorizorAnnotation.value();
+        return (AuthorizationManagerInstaller) fixtureClass.newInstance();
+    }
+
+    // }}
+
+    // {{ PersistenceMechanismInstaller
+    public PersistenceMechanismInstaller addPersistorAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final Persistor annotation = javaClass.getAnnotation(Persistor.class);
+        return annotation != null
+                ? addPersistorRepresentedBy(annotation)
+                : new DataNucleusPersistenceMechanismInstaller();
+
+    }
+
+    private PersistenceMechanismInstaller addPersistorRepresentedBy(
+            final Persistor annotation)
+            throws InstantiationException, IllegalAccessException {
+        final Class<?> fixtureClass = annotation.value();
+        return (PersistenceMechanismInstaller) fixtureClass.newInstance();
+    }
+    // }}
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
new file mode 100644
index 0000000..43b30ed
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
@@ -0,0 +1,88 @@
+/*
+ *  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.legacy.components;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.integtestsupport.legacy.Fixture;
+import org.apache.isis.core.integtestsupport.legacy.Fixtures;
+import org.apache.isis.core.runtime.fixtures.FixturesInstallerAbstract;
+import org.apache.isis.core.runtime.fixtures.FixturesInstallerDelegate;
+
+public class FixtureInstallerAnnotatedClass extends FixturesInstallerAbstract {
+
+    private final List<Object> fixtures = new ArrayList<Object>();
+
+    /**
+     * @see #addFixturesAnnotatedOn(Class)
+     */
+    public FixtureInstallerAnnotatedClass() {
+        super("annotated");
+    }
+
+    // ///////////////////////////////////////////
+    // Hook method
+    // ///////////////////////////////////////////
+
+    /**
+     * Just copies the fixtures added using
+     * {@link #addFixturesAnnotatedOn(Class)} into the delegate.
+     */
+    @Override
+    protected void addFixturesTo(final FixturesInstallerDelegate delegate) {
+        for (final Object fixture : fixtures) {
+            delegate.addFixture(fixture);
+        }
+    }
+
+    // ///////////////////////////////////////////
+    // addFixturesAnnotatedOn (not API)
+    // ///////////////////////////////////////////
+
+    /**
+     * Should be called prior to installing; typically called immediately after
+     * instantiation.
+     * 
+     * <p>
+     * Note: an alternative design would be to have a 1-arg constructor, but the
+     * convention for installers is to make them no-arg.
+     */
+    public void addFixturesAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final Fixtures fixturesAnnotation = javaClass.getAnnotation(Fixtures.class);
+        if (fixturesAnnotation != null) {
+            final Fixture[] fixtureAnnotations = fixturesAnnotation.value();
+            for (final Fixture fixtureAnnotation : fixtureAnnotations) {
+                addFixtureRepresentedBy(fixtureAnnotation, fixtures);
+            }
+        }
+
+        final Fixture fixtureAnnotation = javaClass.getAnnotation(Fixture.class);
+        if (fixtureAnnotation != null) {
+            addFixtureRepresentedBy(fixtureAnnotation, fixtures);
+        }
+    }
+
+    private void addFixtureRepresentedBy(final Fixture fixtureAnnotation, final List<Object> fixtures) throws InstantiationException, IllegalAccessException {
+        final Class<?> fixtureClass = fixtureAnnotation.value();
+        fixtures.add(fixtureClass.newInstance());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
new file mode 100644
index 0000000..b4bbc87
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
@@ -0,0 +1,73 @@
+/*
+ *  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.legacy.components;
+
+import org.junit.internal.runners.TestClass;
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.systemusinginstallers.IsisSystemUsingInstallers;
+
+public class IsisSystemUsingInstallersWithinJunit extends IsisSystemUsingInstallers {
+
+    private final TestClass testClass;
+
+    public IsisSystemUsingInstallersWithinJunit(final DeploymentType deploymentType, final InstallerLookup installerLookup, final TestClass testClass) {
+        super(deploymentType, installerLookup);
+        installerLookup.getConfigurationBuilder().add("isis.deploymentType", deploymentType.nameLowerCase());
+        
+        this.testClass = testClass;
+
+        final AnnotationInstaller installer = new AnnotationInstaller();
+
+        try {
+            setAuthenticationInstaller(getInstallerLookup().injectDependenciesInto(installer.addAuthenticatorAnnotatedOn(this.testClass.getJavaClass())));
+
+            setAuthorizationInstaller(getInstallerLookup().injectDependenciesInto(installer.addAuthorizerAnnotatedOn(this.testClass.getJavaClass())));
+
+            setPersistenceMechanismInstaller(getInstallerLookup().injectDependenciesInto(installer.addPersistorAnnotatedOn(this.testClass.getJavaClass())));
+
+            // fixture installer
+            final FixtureInstallerAnnotatedClass fixtureInstaller = new FixtureInstallerAnnotatedClass();
+            fixtureInstaller.addFixturesAnnotatedOn(this.testClass.getJavaClass());
+            setFixtureInstaller(fixtureInstaller);
+        } catch (final InstantiationException e) {
+            throw new IsisException(e);
+        } catch (final IllegalAccessException e) {
+            throw new IsisException(e);
+        }
+
+        // services installer
+        final ServicesInstallerAnnotatedClass servicesInstaller = new ServicesInstallerAnnotatedClass();
+        try {
+            servicesInstaller.addServicesAnnotatedOn(this.testClass.getJavaClass());
+        } catch (final InstantiationException e) {
+            throw new IsisException(e);
+        } catch (final IllegalAccessException e) {
+            throw new IsisException(e);
+        }
+        setServicesInstaller(servicesInstaller);
+    }
+
+    public TestClass getTestClass() {
+        return testClass;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6549e1eb/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
----------------------------------------------------------------------
diff --git a/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
new file mode 100644
index 0000000..3d6fec2
--- /dev/null
+++ b/mothballed/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
@@ -0,0 +1,91 @@
+/*
+ *  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.legacy.components;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.core.integtestsupport.legacy.Service;
+import org.apache.isis.core.integtestsupport.legacy.Services;
+import org.apache.isis.core.metamodel.services.container.DomainObjectContainerDefault;
+import org.apache.isis.core.runtime.services.ServicesInstallerAbstract;
+
+public class ServicesInstallerAnnotatedClass extends ServicesInstallerAbstract {
+
+    public ServicesInstallerAnnotatedClass() {
+        super("annotated");
+    }
+
+    public void addServicesAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final List<Object> services = new ArrayList<Object>();
+        addServicesAnnotatedOn(javaClass, services);
+
+        final DomainObjectContainer doc = lookupContainerIn(services);
+        if(doc == null) {
+            services.add(new DomainObjectContainerDefault());
+        }
+
+        addServices(services);
+
+    }
+
+    private static DomainObjectContainer lookupContainerIn(List<Object> services1) {
+        for (Object service : services1) {
+            if(service instanceof DomainObjectContainer) {
+                return (DomainObjectContainer) service;
+            }
+        }
+        return null;
+    }
+
+
+    private void addServicesAnnotatedOn(final Class<?> testClass, final List<Object> services) throws InstantiationException, IllegalAccessException {
+        final Services servicesAnnotation = testClass.getAnnotation(Services.class);
+        if (servicesAnnotation != null) {
+            final Service[] serviceAnnotations = servicesAnnotation.value();
+            for (final Service serviceAnnotation : serviceAnnotations) {
+                addServiceRepresentedBy(serviceAnnotation, services);
+            }
+        }
+
+        final Service serviceAnnotation = testClass.getAnnotation(Service.class);
+        if (serviceAnnotation != null) {
+            addServiceRepresentedBy(serviceAnnotation, services);
+        }
+    }
+
+    private void addServiceRepresentedBy(final Service serviceAnnotation, final List<Object> services) throws InstantiationException, IllegalAccessException {
+        final Class<?> serviceClass = serviceAnnotation.value();
+        // there's no need to unravel any Collections of services,
+        // because the ServiceLoader will do it for us later.
+        services.add(serviceClass.newInstance());
+    }
+
+    @Override
+    public List<Class<?>> getTypes() {
+        return listOf(List.class); // ie List<Object.class>, of services
+    }
+
+    @Override
+    public void setIgnoreFailures(boolean ignoreFailures) {
+        // no-op
+    }
+}


[3/9] isis git commit: ISIS-1188: removed requirement to create an anonymous subclass of IsisSystemDefault.

Posted by da...@apache.org.
ISIS-1188: removed requirement to create an anonymous subclass of IsisSystemDefault.


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

Branch: refs/heads/ISIS-848
Commit: d16add77b71f4ed0d576b7cdf0cb45c03c46cd42
Parents: a930c1d
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 08:20:31 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 08:20:31 2015 +0100

----------------------------------------------------------------------
 .../integtestsupport/IsisSystemDefault.java     | 54 ++++++++++++--------
 .../integtestsupport/IsisSystemForTest.java     | 47 +++++------------
 2 files changed, 46 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/d16add77/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
index 4c7b875..47979aa 100644
--- 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
@@ -19,7 +19,6 @@
 package org.apache.isis.core.integtestsupport;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
@@ -58,13 +57,26 @@ import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
 
 public class IsisSystemDefault extends IsisSystemAbstract {
 
-    private final IsisConfigurationDefault configuration;
+    private final IsisConfiguration configuration;
     private final List<Object> servicesIfAny;
-
-    public IsisSystemDefault(DeploymentType deploymentType, List<Object> services) {
+    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 = new IsisConfigurationDefault(ResourceStreamSourceContextLoaderClassPath.create("config"));
+        this.configuration = configuration;
         this.servicesIfAny = services;
+        this.programmingModelOverride = programmingModelOverride;
+        this.metaModelValidatorOverride = metaModelValidatorOverride;
+    }
+
+    static IsisConfiguration defaultConfiguration() {
+        return new IsisConfigurationDefault(ResourceStreamSourceContextLoaderClassPath.create("config"));
     }
 
     /**
@@ -112,7 +124,8 @@ public class IsisSystemDefault extends IsisSystemAbstract {
      */
     @Override
     protected SpecificationLoaderSpi obtainSpecificationLoaderSpi(DeploymentType deploymentType, Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
-        
+
+
         final ProgrammingModel programmingModel = obtainReflectorProgrammingModel();
         final Set<FacetDecorator> facetDecorators = obtainReflectorFacetDecoratorSet();
         final MetaModelValidator mmv = obtainReflectorMetaModelValidator();
@@ -125,6 +138,11 @@ public class IsisSystemDefault extends IsisSystemAbstract {
      * 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.
@@ -138,13 +156,16 @@ public class IsisSystemDefault extends IsisSystemAbstract {
      * Optional hook method.
      */
     protected Set<FacetDecorator> obtainReflectorFacetDecoratorSet() {
-        return Sets.newHashSet((FacetDecorator)new StandardTransactionFacetDecorator(getConfiguration()));
+        return Sets.newHashSet((FacetDecorator) new StandardTransactionFacetDecorator(getConfiguration()));
     }
 
     /**
      * Optional hook method.
      */
     protected MetaModelValidator obtainReflectorMetaModelValidator() {
+        if(metaModelValidatorOverride != null) {
+            return metaModelValidatorOverride;
+        }
         return new MetaModelValidatorDefault();
     }
 
@@ -175,27 +196,16 @@ public class IsisSystemDefault extends IsisSystemAbstract {
         return new AuthorizationManagerStandard(getConfiguration());
     }
 
-    /**
-     * The in-memory object store (unless overridden by {@link #obtainPersistenceMechanismInstaller(IsisConfiguration)}).
-     */
     @Override
     protected PersistenceSessionFactory obtainPersistenceSessionFactory(DeploymentType deploymentType, final List<Object> services) throws IsisSystemException {
-        PersistenceMechanismInstaller installer = obtainPersistenceMechanismInstaller(getConfiguration());
-        if(installer == null) {
-            final DataNucleusPersistenceMechanismInstaller persistenceMechanismInstaller = new DataNucleusPersistenceMechanismInstaller();
-            persistenceMechanismInstaller.setConfiguration(getConfiguration());
-            installer = persistenceMechanismInstaller;
-        }
+        PersistenceMechanismInstaller installer =
+                createPersistenceMechanismInstaller(getConfiguration());
         return installer.createPersistenceSessionFactory(deploymentType, services);
     }
 
-
-    /**
-     * Optional hook; if returns <tt>null</tt> then the {@link #obtainPersistenceSessionFactory(DeploymentType)} is used.
-     */
-    protected PersistenceMechanismInstaller obtainPersistenceMechanismInstaller(IsisConfiguration configuration) throws IsisSystemException {
+    private PersistenceMechanismInstaller createPersistenceMechanismInstaller(IsisConfiguration configuration) throws IsisSystemException {
         DataNucleusPersistenceMechanismInstaller installer = new DataNucleusPersistenceMechanismInstaller();
-        installer.setConfiguration(getConfiguration());
+        installer.setConfiguration(configuration);
         return installer;
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/d16add77/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 d55efcc..a645f5c 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
@@ -452,45 +452,26 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
         IsisContext.closeSession();
     }
 
+    private IsisConfiguration getConfigurationElseDefault() {
+        if(this.configuration != null) {
+            return this.configuration;
+        } else {
+            return IsisSystemDefault.defaultConfiguration();
+        }
+    }
+
+
     private IsisSystemDefault createIsisSystem(List<Object> services) {
 
-        final IsisSystemDefault system = new IsisSystemDefault(DeploymentType.UNIT_TESTING, services) {
-            @Override
-            public IsisConfiguration getConfiguration() {
-                if(IsisSystemForTest.this.configuration != null) {
-                    return IsisSystemForTest.this.configuration;
-                } else {
-                    return super.getConfiguration();
-                }
-            }
-            @Override
-            protected ProgrammingModel obtainReflectorProgrammingModel() {
-                if(IsisSystemForTest.this.programmingModel != null) {
-                    return IsisSystemForTest.this.programmingModel;
-                } else {
-                    return super.obtainReflectorProgrammingModel();
-                }
-            }
-            @Override
-            protected MetaModelValidator obtainReflectorMetaModelValidator() {
-                if(IsisSystemForTest.this.metaModelValidator != null) {
-                    return IsisSystemForTest.this.metaModelValidator;
-                } else {
-                    return super.obtainReflectorMetaModelValidator();
-                }
-            }
-            @Override
-            protected PersistenceMechanismInstaller obtainPersistenceMechanismInstaller(IsisConfiguration configuration) {
-                final PersistenceMechanismInstaller installer = IsisSystemForTest.this.persistenceMechanismInstaller;
-                configuration.injectInto(installer);
-                return installer;
-            }
-        };
+        final IsisSystemDefault system = new IsisSystemDefault(
+                DeploymentType.UNIT_TESTING, services,
+                getConfigurationElseDefault(),
+                this.programmingModel,
+                this.metaModelValidator);
         return system;
     }
 
 
-
     ////////////////////////////////////////////////////////////
     // listeners
     ////////////////////////////////////////////////////////////


[2/9] isis git commit: ISIS-1188: removed IsisSystemFixturesHookAbstract (collapsed down into IsisSystemAbstract).

Posted by da...@apache.org.
ISIS-1188: removed IsisSystemFixturesHookAbstract (collapsed down into IsisSystemAbstract).

Also deprecated DebugSelection interface; no longer used.


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

Branch: refs/heads/ISIS-848
Commit: a930c1da1e3ec9e9d6aadf58856524d0a8a420a0
Parents: 6549e1e
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 07:38:20 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 07:39:34 2015 +0100

----------------------------------------------------------------------
 .../integtestsupport/IsisSystemDefault.java     |  16 -
 .../core/runtime/system/DebugSelection.java     |   3 +
 .../system/IsisSystemFixturesHookAbstract.java  | 469 -------------------
 .../IsisSystemAbstract.java                     | 366 ++++++++++++---
 .../IsisSystemUsingInstallers.java              |  64 +--
 5 files changed, 311 insertions(+), 607 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/a930c1da/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
index 7a1bae9..4c7b875 100644
--- 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
@@ -61,28 +61,12 @@ public class IsisSystemDefault extends IsisSystemAbstract {
     private final IsisConfigurationDefault configuration;
     private final List<Object> servicesIfAny;
 
-    public IsisSystemDefault(Object... servicesIfAny) {
-        this(DeploymentType.SERVER, servicesIfAny);
-    }
-
-    public IsisSystemDefault(List<Object> services) {
-        this(DeploymentType.SERVER, services);
-    }
-
-    public IsisSystemDefault(DeploymentType deploymentType, Object... servicesIfAny) {
-        this(deploymentType, asList(servicesIfAny));
-    }
-
     public IsisSystemDefault(DeploymentType deploymentType, List<Object> services) {
         super(deploymentType);
         this.configuration = new IsisConfigurationDefault(ResourceStreamSourceContextLoaderClassPath.create("config"));
         this.servicesIfAny = services;
     }
 
-    private static List<Object> asList(Object... objects) {
-        return objects != null? Collections.unmodifiableList(Lists.newArrayList(objects)): null;
-    }
-
     /**
      * Reads <tt>isis.properties</tt> (and other optional property files) from the &quot;config&quot; package on the current classpath.
      */

http://git-wip-us.apache.org/repos/asf/isis/blob/a930c1da/core/runtime/src/main/java/org/apache/isis/core/runtime/system/DebugSelection.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/DebugSelection.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/DebugSelection.java
index 153a9d5..543592b 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/DebugSelection.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/DebugSelection.java
@@ -24,7 +24,10 @@ import org.apache.isis.core.commons.debug.DebuggableWithTitle;
 /**
  * Provides a mechanism for providing a series of DebugInfo objects, keyed on
  * name.
+ *
+ * @deprecated
  */
+@Deprecated
 public interface DebugSelection {
 
     DebuggableWithTitle debugSection(String sectionName);

http://git-wip-us.apache.org/repos/asf/isis/blob/a930c1da/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java
deleted file mode 100644
index 799bc96..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/IsisSystemFixturesHookAbstract.java
+++ /dev/null
@@ -1,469 +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;
-
-import java.io.File;
-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.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.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.about.AboutIsis;
-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.installerregistry.InstallerLookup;
-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.IsisSession;
-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;
-
-/**
- * An implementation of {@link IsisSystem} that has a hook for installing
- * fixtures but does not install them itself.
- */
-public abstract class IsisSystemFixturesHookAbstract implements IsisSystem {
-
-    public static final Logger LOG = LoggerFactory.getLogger(IsisSystemFixturesHookAbstract.class);
-
-    private final IsisLocaleInitializer localeInitializer;
-    private final IsisTimeZoneInitializer timeZoneInitializer;
-    private final DeploymentType deploymentType;
-
-    private boolean initialized = false;
-
-    private IsisSessionFactory sessionFactory;
-
-    private ServiceInitializer serviceInitializer;
-
-    // ///////////////////////////////////////////
-    // Constructors
-    // ///////////////////////////////////////////
-
-    public IsisSystemFixturesHookAbstract(final DeploymentType deploymentType) {
-        this(deploymentType, new IsisLocaleInitializer(), new IsisTimeZoneInitializer());
-    }
-
-    public IsisSystemFixturesHookAbstract(final DeploymentType deploymentType, final IsisLocaleInitializer localeInitializer, final IsisTimeZoneInitializer timeZoneInitializer) {
-        this.deploymentType = deploymentType;
-        this.localeInitializer = localeInitializer;
-        this.timeZoneInitializer = timeZoneInitializer;
-    }
-
-    // ///////////////////////////////////////////
-    // DeploymentType
-    // ///////////////////////////////////////////
-
-    @Override
-    public DeploymentType getDeploymentType() {
-        return deploymentType;
-    }
-
-    // ///////////////////////////////////////////
-    // init, shutdown
-    // ///////////////////////////////////////////
-
-    @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 = doCreateSessionFactory(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 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();
-        }
-    }
-
-    /**
-     * 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();
-    }
-
-    @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();
-        }
-    }
-    
-    // ///////////////////////////////////////////
-    // Hook:
-    // ///////////////////////////////////////////
-
-    /**
-     * Hook method; the returned implementation is expected to use the same
-     * general approach as the subclass itself.
-     * 
-     * <p>
-     * So, for example, <tt>IsisSystemUsingInstallers</tt> uses the
-     * {@link InstallerLookup} mechanism to find its components. The
-     * corresponding <tt>ExecutionContextFactoryUsingInstallers</tt> object
-     * returned by this method should use {@link InstallerLookup} likewise.
-     */
-    protected abstract IsisSessionFactory doCreateSessionFactory(final DeploymentType deploymentType) throws IsisSystemException;
-
-
-    // ///////////////////////////////////////////
-    // Configuration
-    // ///////////////////////////////////////////
-
-    /**
-     * Populated after {@link #init()}.
-     */
-    @Override
-    public IsisSessionFactory getSessionFactory() {
-        return sessionFactory;
-    }
-
-    // ///////////////////////////////////////////
-    // Configuration
-    // ///////////////////////////////////////////
-
-    @Override
-    public abstract IsisConfiguration getConfiguration();
-
-
-    // ///////////////////////////////////////////
-    // OidMarshaller
-    // ///////////////////////////////////////////
-
-    /**
-     * Just returns a {@link OidMarshaller}; subclasses may override if
-     * required.
-     */
-    protected OidMarshaller obtainOidMarshaller() {
-        return new OidMarshaller();
-    }
-
-    // ///////////////////////////////////////////
-    // Reflector
-    // ///////////////////////////////////////////
-
-    protected abstract SpecificationLoaderSpi obtainSpecificationLoaderSpi(DeploymentType deploymentType, Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException;
-
-    // ///////////////////////////////////////////
-    // PersistenceSessionFactory
-    // ///////////////////////////////////////////
-
-    protected abstract PersistenceSessionFactory obtainPersistenceSessionFactory(DeploymentType deploymentType, final List<Object> services) throws IsisSystemException;
-
-    // ///////////////////////////////////////////
-    // Fixtures (hooks)
-    // ///////////////////////////////////////////
-
-    /**
-     * Optional hook for appending debug information pertaining to fixtures
-     * installer if required.
-     */
-    protected void appendFixturesInstallerDebug(final DebugBuilder debug) {
-    }
-
-    /**
-     * 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.
-     * 
-     * <p>
-     * This implementation always returns <tt>null</tt>.
-     */
-    @Override
-    public LogonFixture getLogonFixture() {
-        return null;
-    }
-
-    /**
-     * Optional hook for installing fixtures.
-     * 
-     * <p>
-     * This implementation does nothing.
-     */
-    protected void installFixturesIfRequired() throws IsisSystemException {
-    }
-
-    // ///////////////////////////////////////////
-    // Authentication & Authorization Manager
-    // ///////////////////////////////////////////
-
-    protected abstract AuthenticationManager obtainAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException;
-
-    protected abstract AuthorizationManager obtainAuthorizationManager(final DeploymentType deploymentType);
-
-    // ///////////////////////////////////////////
-    // Services
-    // ///////////////////////////////////////////
-
-    protected abstract List<Object> obtainServices();
-
-
-    // ///////////////////////////////////////////
-    // 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();
-        } /*
-           * else if (selectionName.equals("Overview")) { debugOverview(debug);
-           * } else if (selectionName.equals("Authenticator")) { deb =
-           * IsisContext.getAuthenticationManager(); } else if
-           * (selectionName.equals("Reflector")) { deb =
-           * IsisContext.getSpecificationLoader(); } else if
-           * (selectionName.equals("Contexts")) { deb =
-           * debugListContexts(debug); } else { deb =
-           * debugDisplayContext(selectionName, debug); }
-           */
-        return null;
-    }
-
-    private void debugDisplayContext(final String selector, final DebugBuilder debug) {
-        final IsisSession d = IsisContext.getSession(selector);
-        if (d != null) {
-            d.debugAll(debug);
-        } else {
-            debug.appendln("No context: " + selector);
-        }
-    }
-
-    private void debugListContexts(final DebugBuilder debug) {
-        final String[] contextIds = IsisContext.getInstance().allSessionIds();
-        for (final String contextId : contextIds) {
-            debug.appendln(contextId);
-            debug.appendln("-----");
-            final IsisSession d = IsisContext.getSession(contextId);
-            d.debug(debug);
-            debug.appendln();
-        }
-    }
-
-    @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;
-    }
-
-    private void debugOverview(final DebugBuilder debug) {
-        try {
-            debug.appendln(AboutIsis.getFrameworkName());
-            debug.appendln(AboutIsis.getFrameworkVersion());
-            if (AboutIsis.getApplicationName() != null) {
-                debug.appendln("application: " + AboutIsis.getApplicationName());
-            }
-            if (AboutIsis.getApplicationVersion() != null) {
-                debug.appendln("version" + AboutIsis.getApplicationVersion());
-            }
-
-            final String user = System.getProperty("user.name");
-            final String system = System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") " + System.getProperty("os.version");
-            final String java = System.getProperty("java.vm.name") + " " + System.getProperty("java.vm.version");
-            debug.appendln("user: " + user);
-            debug.appendln("os: " + system);
-            debug.appendln("java: " + java);
-            debug.appendln("working directory: " + new File(".").getAbsolutePath());
-
-            debug.appendTitle("System Installer");
-            appendFixturesInstallerDebug(debug);
-
-            debug.appendTitle("System Components");
-            debug.appendln("Authentication manager", IsisContext.getAuthenticationManager().getClass().getName());
-            debug.appendln("Configuration", getConfiguration().getClass().getName());
-
-            final DebuggableWithTitle[] inf = IsisContext.debugSystem();
-            for (final DebuggableWithTitle element : inf) {
-                if (element != null) {
-                    element.debugData(debug);
-                }
-            }
-        } catch (final RuntimeException e) {
-            debug.appendException(e);
-        }
-    }
-
-    IsisTransactionManager getTransactionManager() {
-        return IsisContext.getTransactionManager();
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/a930c1da/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 9341c50..73e27bf 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,6 +19,7 @@
 
 package org.apache.isis.core.runtime.systemusinginstallers;
 
+import java.io.File;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
@@ -26,6 +27,7 @@ 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;
@@ -33,11 +35,14 @@ 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;
@@ -45,41 +50,184 @@ 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.IsisSystemFixturesHookAbstract;
 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 extends IsisSystemFixturesHookAbstract {
+public abstract class IsisSystemAbstract implements IsisSystem {
 
     public static final Logger LOG = LoggerFactory.getLogger(IsisSystemAbstract.class);
 
-    private FixturesInstaller fixtureInstaller;
 
-    private LogonFixture logonFixture;
+    private final IsisLocaleInitializer localeInitializer;
+    private final IsisTimeZoneInitializer timeZoneInitializer;
+    private final DeploymentType deploymentType;
+
+    private boolean initialized = false;
 
-    // ///////////////////////////////////////////
-    // Constructors
-    // ///////////////////////////////////////////
+    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) {
-        super(deploymentType, localeInitializer, timeZoneInitializer);
+        this.deploymentType = deploymentType;
+        this.localeInitializer = localeInitializer;
+        this.timeZoneInitializer = timeZoneInitializer;
     }
+    //endregion
 
+    //region > deploymentType
     @Override
-    protected void installFixturesIfRequired() throws IsisSystemException {
+    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)) {
@@ -103,15 +251,75 @@ public abstract class IsisSystemAbstract extends IsisSystemFixturesHookAbstract
         return candidate == null || (fixtureInstaller instanceof Noop);
     }
 
-    // ///////////////////////////////////////////
-    // Fixtures
-    // ///////////////////////////////////////////
+    /**
+     * 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
@@ -120,17 +328,56 @@ public abstract class IsisSystemAbstract extends IsisSystemFixturesHookAbstract
      */
     protected abstract FixturesInstaller obtainFixturesInstaller() throws IsisSystemException;
 
-    // ///////////////////////////////////////////
-    // Fixtures Installer
-    // ///////////////////////////////////////////
 
-    public FixturesInstaller getFixturesInstaller() {
-        return fixtureInstaller;
+    //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
@@ -141,68 +388,45 @@ public abstract class IsisSystemAbstract extends IsisSystemFixturesHookAbstract
     public LogonFixture getLogonFixture() {
         return logonFixture;
     }
+    //endregion
 
-    @Override
-    protected void appendFixturesInstallerDebug(final DebugBuilder debug) {
-        debug.appendln("Fixture Installer", fixtureInstaller == null ? "none" : fixtureInstaller.getClass().getName());
-    }
 
-    
+    //region > debugging
 
-    // ///////////////////////////////////////////
-    // Session Factory
-    // ///////////////////////////////////////////
+    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 IsisSessionFactory doCreateSessionFactory(final DeploymentType deploymentType) throws IsisSystemException {
-        final List<Object> services = obtainServices();
-        final PersistenceSessionFactory persistenceSessionFactory = obtainPersistenceSessionFactory(deploymentType, services);
-        return createSessionFactory(deploymentType, persistenceSessionFactory);
+    public DebuggableWithTitle debugSection(final String selectionName) {
+        // DebugInfo deb;
+        if (selectionName.equals("Configuration")) {
+            return getConfiguration();
+        }
+        return null;
     }
 
-    /**
-     * Overloaded version designed to be called by subclasses that need to
-     * explicitly specify different persistence mechanisms.
-     *
-     * <p>
-     * This is <i>not</i> a hook method, rather it is designed to be called
-     * <i>from</i> the {@link #doCreateSessionFactory(DeploymentType) hook
-     * method}.
-     */
-    protected final IsisSessionFactory createSessionFactory(
-            final DeploymentType deploymentType,
-    final PersistenceSessionFactory persistenceSessionFactory) throws IsisSystemException {
-
-        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);
+    @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;
     }
 
-    protected RuntimeContextFromSession obtainRuntimeContextFromSession() {
-        return new RuntimeContextFromSession();
+    IsisTransactionManager getTransactionManager() {
+        return IsisContext.getTransactionManager();
     }
 
-    private static Collection<MetaModelRefiner> refiners(Object... possibleRefiners ) {
-        return ListExtensions.filtered(Arrays.asList(possibleRefiners), MetaModelRefiner.class);
-    }
+    //endregion
 
-    
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/a930c1da/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
index 46a046e..fa96621 100644
--- 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
@@ -21,8 +21,10 @@ 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;
@@ -34,17 +36,18 @@ 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.system.persistence.PersistenceSessionFactory;
 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.systemdependencyinjector.SystemDependencyInjector;
+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.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
 
 public class IsisSystemUsingInstallers extends IsisSystemAbstract {
 
@@ -59,6 +62,7 @@ public class IsisSystemUsingInstallers extends IsisSystemAbstract {
     private PersistenceMechanismInstaller persistenceMechanismInstaller;
     private FixturesInstaller fixtureInstaller;
 
+
     // ///////////////////////////////////////////
     // Constructors
     // ///////////////////////////////////////////
@@ -69,32 +73,18 @@ public class IsisSystemUsingInstallers extends IsisSystemAbstract {
         this.installerLookup = installerLookup;
     }
 
-    // ///////////////////////////////////////////
-    // InstallerLookup
-    // ///////////////////////////////////////////
-
-    /**
-     * As per
-     * {@link #IsisSystemUsingInstallers(DeploymentType, InstallerLookup)
-     * constructor}.
-     */
-    public SystemDependencyInjector getInstallerLookup() {
-        return installerLookup;
-    }
-
-    // ///////////////////////////////////////////
-    // Create context hooks
-    // ///////////////////////////////////////////
-
 
     // ///////////////////////////////////////////
     // Configuration
     // ///////////////////////////////////////////
 
     /**
-     * Returns a <i>snapshot</i> of the {@link IsisConfiguration configuration}
-     * held by the {@link #getInstallerLookup() installer lookup}.
-     * 
+     * Returns a <i>snapshot</i> of the {@link IsisConfiguration configuration}.
+     *
+     * <p>
+     *     ... as held by the internal {@link InstallerLookup}.
+     * </p>
+     *
      * @see InstallerLookup#getConfiguration()
      */
     @Override
@@ -143,10 +133,6 @@ public class IsisSystemUsingInstallers extends IsisSystemAbstract {
         return authorizationInstaller.createAuthorizationManager();
     }
 
-    // ///////////////////////////////////////////
-    // Fixtures
-    // ///////////////////////////////////////////
-
     public void lookupAndSetFixturesInstaller() {
         final IsisConfiguration configuration = installerLookup.getConfiguration();
         final String fixture = configuration.getString(SystemConstants.FIXTURES_INSTALLER_KEY);
@@ -157,10 +143,6 @@ public class IsisSystemUsingInstallers extends IsisSystemAbstract {
         }
     }
 
-    public void setFixtureInstaller(final FixturesInstaller fixtureInstaller) {
-        this.fixtureInstaller = fixtureInstaller;
-    }
-
     @Override
     protected FixturesInstaller obtainFixturesInstaller() throws IsisSystemException {
         return fixtureInstaller;
@@ -170,10 +152,6 @@ public class IsisSystemUsingInstallers extends IsisSystemAbstract {
     // Reflector
     // ///////////////////////////////////////////
 
-    public void setReflectorInstaller(final ObjectReflectorInstaller reflectorInstaller) {
-        this.reflectorInstaller = reflectorInstaller;
-    }
-
     @Override
     protected SpecificationLoaderSpi obtainSpecificationLoaderSpi(final DeploymentType deploymentType, final Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
         if (reflectorInstaller == null) {
@@ -188,14 +166,6 @@ public class IsisSystemUsingInstallers extends IsisSystemAbstract {
         return reflectorInstaller.createReflector(metaModelRefiners);
     }
 
-    // ///////////////////////////////////////////
-    // Container and Services
-    // ///////////////////////////////////////////
-
-    public void setServicesInstaller(final ServicesInstaller servicesInstaller) {
-        this.servicesInstaller = servicesInstaller;
-    }
-
     @Override
     protected List<Object> obtainServices() {
         if (servicesInstaller == null) {
@@ -207,14 +177,6 @@ public class IsisSystemUsingInstallers extends IsisSystemAbstract {
     }
 
 
-    // ///////////////////////////////////////////
-    // PersistenceSessionFactory
-    // ///////////////////////////////////////////
-
-    public void setPersistenceMechanismInstaller(final PersistenceMechanismInstaller persistenceMechanismInstaller) {
-        this.persistenceMechanismInstaller = persistenceMechanismInstaller;
-    }
-
     @Override
     protected PersistenceSessionFactory obtainPersistenceSessionFactory(final DeploymentType deploymentType, final List<Object> services) throws IsisSystemException {
 


[7/9] isis git commit: ISIS-1188: pass runtimeContext into PersistenceSessionFactory, perform some basic wiring in constructor.

Posted by da...@apache.org.
ISIS-1188: pass runtimeContext into PersistenceSessionFactory, perform some basic wiring in constructor.


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

Branch: refs/heads/ISIS-848
Commit: d3eb90a7ac7e90a521b13e8cc93a5483e0eba526
Parents: 78dbc9a
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 18:47:46 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 18:47:46 2015 +0100

----------------------------------------------------------------------
 .../IsisComponentProviderDefault.java           | 15 +----
 .../JavaReflectorInstallerNoDecorators.java     |  2 +-
 .../PersistenceMechanismInstaller.java          |  6 +-
 .../persistence/PersistenceSessionFactory.java  | 58 ++++++++------------
 .../IsisComponentProviderUsingInstallers.java   |  4 +-
 ...ataNucleusPersistenceMechanismInstaller.java |  9 ++-
 6 files changed, 38 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/d3eb90a7/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
index 17f6f4b..7290190 100644
--- 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
@@ -45,7 +45,6 @@ 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;
@@ -179,14 +178,10 @@ public class IsisComponentProviderDefault implements IsisComponentProvider {
         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).
      */
@@ -210,16 +205,8 @@ public class IsisComponentProviderDefault implements IsisComponentProvider {
     public PersistenceSessionFactory providePersistenceSessionFactory(
             DeploymentType deploymentType,
             final ServicesInjectorSpi servicesInjectorSpi) throws IsisSystemException {
-        PersistenceMechanismInstaller installer =
-                createPersistenceMechanismInstaller(getConfiguration());
-        return installer.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi);
-    }
-
-    private PersistenceMechanismInstaller createPersistenceMechanismInstaller(IsisConfiguration configuration) throws IsisSystemException {
         DataNucleusPersistenceMechanismInstaller installer = new DataNucleusPersistenceMechanismInstaller();
-        installer.setConfiguration(configuration);
-        return installer;
+        return installer.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi, getConfiguration());
     }
 
-
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/d3eb90a7/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
index 3841e4d..ba36810 100644
--- a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
+++ b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/JavaReflectorInstallerNoDecorators.java
@@ -45,7 +45,7 @@ import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidator;
 
 /**
  * An implementation of {@link ObjectReflectorInstaller} without support for {@link FacetDecoratorInstaller}
- * being looked up (since this functionality is only available from <tt>runtimes.dflt</tt>).
+ * being looked up (since this functionality is only available from <tt>core.runtime</tt>).
  */
 public class JavaReflectorInstallerNoDecorators extends InstallerAbstract implements ObjectReflectorInstaller {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/d3eb90a7/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
index 6044b83..2626acd 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
@@ -20,6 +20,7 @@
 package org.apache.isis.core.runtime.installerregistry.installerapi;
 
 import org.apache.isis.core.commons.components.Installer;
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.runtime.persistence.ObjectStoreFactory;
 import org.apache.isis.core.runtime.system.DeploymentType;
@@ -33,6 +34,9 @@ public interface PersistenceMechanismInstaller extends Installer, ObjectStoreFac
 
     static String TYPE = "persistor";
 
-    PersistenceSessionFactory createPersistenceSessionFactory(DeploymentType deploymentType, final ServicesInjectorSpi services);
+    PersistenceSessionFactory createPersistenceSessionFactory(
+            DeploymentType deploymentType,
+            final ServicesInjectorSpi services,
+            final IsisConfiguration configuration);
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/d3eb90a7/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
index 7f32d69..606cae0 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
@@ -30,7 +30,6 @@ import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
 import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
@@ -62,20 +61,40 @@ public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationS
     private Boolean fixturesInstalled;
 
     private final ServicesInjectorSpi servicesInjector;
-    private RuntimeContext runtimeContext;
+    private RuntimeContextFromSession runtimeContext;
 
     public PersistenceSessionFactory(
             final DeploymentType deploymentType,
             final ServicesInjectorSpi servicesInjector,
             final IsisConfiguration isisConfiguration,
-            final ObjectStoreFactory objectStoreFactory) {
+            final ObjectStoreFactory objectStoreFactory,
+            final RuntimeContextFromSession runtimeContext) {
 
+        ensureThatState(deploymentType, is(notNullValue()));
         ensureThatState(servicesInjector, is(notNullValue()));
+        ensureThatState(isisConfiguration, is(not(nullValue())));
+        ensureThatState(objectStoreFactory, is(not(nullValue())));
+        ensureThatState(runtimeContext, is(not(nullValue())));
 
         this.deploymentType = deploymentType;
         this.configuration = isisConfiguration;
         this.objectStoreFactory = objectStoreFactory;
         this.servicesInjector = servicesInjector;
+        this.runtimeContext = runtimeContext;
+
+        final Properties properties = applicationPropertiesFrom(getConfiguration());
+        runtimeContext.setProperties(properties);
+    }
+
+    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
+        final Properties properties = new Properties();
+        final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
+        for (final String key : applicationConfiguration) {
+            final String value = applicationConfiguration.getString(key);
+            final String newKey = key.substring("application.".length());
+            properties.setProperty(newKey, value);
+        }
+        return properties;
     }
 
     public DeploymentType getDeploymentType() {
@@ -88,12 +107,6 @@ public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationS
 
     public PersistenceSession createPersistenceSession() {
 
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("installing " + this.getClass().getName());
-        }
-
-        ServicesInjectorSpi servicesInjector = getServicesInjector();
-
         final ObjectStore objectStore = objectStoreFactory.createObjectStore(getConfiguration());
         ensureThatArg(objectStore, is(not(nullValue())));
 
@@ -113,12 +126,8 @@ public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationS
             FixtureClock.initialize();
         }
 
-        runtimeContext = createRuntimeContext(getConfiguration());
-        ensureThatState(runtimeContext, is(not(nullValue())));
-
-        // inject the specification loader etc.
         runtimeContext.injectInto(servicesInjector);
-        
+
         // wire up components
         getSpecificationLoader().injectInto(runtimeContext);
 
@@ -129,23 +138,6 @@ public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationS
         servicesInjector.init();
     }
 
-    private RuntimeContext createRuntimeContext(final IsisConfiguration configuration) {
-        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
-        final Properties properties = applicationPropertiesFrom(configuration);
-        runtimeContext.setProperties(properties);
-        return runtimeContext;
-    }
-
-    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
-        final Properties properties = new Properties();
-        final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
-        for (final String key : applicationConfiguration) {
-            final String value = applicationConfiguration.getString(key);
-            final String newKey = key.substring("application.".length());
-            properties.setProperty(newKey, value);
-        }
-        return properties;
-    }
 
 
 
@@ -203,10 +195,6 @@ public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationS
     }
     
     // //////////////////////////////////////////////////////
-    // Dependencies (injected via setters)
-    // //////////////////////////////////////////////////////
-
-    // //////////////////////////////////////////////////////
     // Dependencies (from context)
     // //////////////////////////////////////////////////////
 

http://git-wip-us.apache.org/repos/asf/isis/blob/d3eb90a7/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
index a28dea3..7294c7f 100644
--- 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
@@ -147,13 +147,11 @@ public class IsisComponentProviderUsingInstallers implements IsisComponentProvid
     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());
     }
 
@@ -161,7 +159,7 @@ public class IsisComponentProviderUsingInstallers implements IsisComponentProvid
     public PersistenceSessionFactory providePersistenceSessionFactory(
             final DeploymentType deploymentType,
             final ServicesInjectorSpi servicesInjectorSpi) throws IsisSystemException {
-        return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi);
+        return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi, getConfiguration());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/d3eb90a7/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
index f5a6f7c..042bc5e 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
@@ -35,6 +35,7 @@ import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.context.IsisContext;
 import org.apache.isis.core.runtime.system.persistence.ObjectStore;
@@ -91,8 +92,12 @@ public class DataNucleusPersistenceMechanismInstaller extends InstallerAbstract
     //region > createPersistenceSessionFactory
     @Override
     public PersistenceSessionFactory createPersistenceSessionFactory(
-            final DeploymentType deploymentType, final ServicesInjectorSpi servicesInjector) {
-        return new PersistenceSessionFactory(deploymentType, servicesInjector, getConfiguration(), this);
+            final DeploymentType deploymentType,
+            final ServicesInjectorSpi servicesInjector,
+            final IsisConfiguration configuration) {
+        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
+        DataNucleusPersistenceMechanismInstaller objectStoreFactory = this;
+        return new PersistenceSessionFactory(deploymentType, servicesInjector, configuration, objectStoreFactory, runtimeContext);
     }
     //endregion
 


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

Posted by da...@apache.org.
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/ISIS-848
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) {
         };
     }
 }


[8/9] isis git commit: ISIS-1188: where how RuntimeContextFromSession is instantiated (and in particular, instantiate it only once, passing it from IsisSystem through to PersistenceMechanismInstaller and thence PersistenceSessionFactory).

Posted by da...@apache.org.
ISIS-1188: where how RuntimeContextFromSession is instantiated (and in particular, instantiate it only once, passing it from IsisSystem through to PersistenceMechanismInstaller and thence PersistenceSessionFactory).


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

Branch: refs/heads/ISIS-848
Commit: 1ed4eef484f491491657d0d4142fee005de76b9f
Parents: d3eb90a
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 19:34:25 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 19:34:25 2015 +0100

----------------------------------------------------------------------
 .../IsisComponentProviderDefault.java           |  6 ++++--
 .../runtimecontext/RuntimeContextAbstract.java  |  2 +-
 .../PersistenceMechanismInstaller.java          | 12 +++++++----
 .../internal/RuntimeContextFromSession.java     | 22 +++++++++++++++++++-
 .../isis/core/runtime/system/IsisSystem.java    | 13 ++++--------
 .../persistence/PersistenceSessionFactory.java  | 15 -------------
 .../IsisComponentProvider.java                  |  4 +++-
 .../IsisComponentProviderUsingInstallers.java   |  6 ++++--
 ...ataNucleusPersistenceMechanismInstaller.java |  6 ++++--
 .../persistence/PersistenceSessionTest.java     |  2 +-
 10 files changed, 50 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/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
index 7290190..a6e677c 100644
--- 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
@@ -45,6 +45,7 @@ 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.persistence.internal.RuntimeContextFromSession;
 import org.apache.isis.core.runtime.services.ServicesInstallerFromConfiguration;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.IsisSystemException;
@@ -204,9 +205,10 @@ public class IsisComponentProviderDefault implements IsisComponentProvider {
     @Override
     public PersistenceSessionFactory providePersistenceSessionFactory(
             DeploymentType deploymentType,
-            final ServicesInjectorSpi servicesInjectorSpi) throws IsisSystemException {
+            final ServicesInjectorSpi servicesInjectorSpi,
+            final RuntimeContextFromSession runtimeContext) throws IsisSystemException {
         DataNucleusPersistenceMechanismInstaller installer = new DataNucleusPersistenceMechanismInstaller();
-        return installer.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi, getConfiguration());
+        return installer.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi, getConfiguration(), runtimeContext);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java
index ea13704..a77be38 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/RuntimeContextAbstract.java
@@ -156,7 +156,7 @@ public abstract class RuntimeContextAbstract implements RuntimeContext, Specific
         });
     }
 
-    public void setProperties(final Properties properties) {
+    protected void setProperties(final Properties properties) {
         this.properties = properties;
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
index 2626acd..5cea3f5 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
@@ -21,8 +21,11 @@ package org.apache.isis.core.runtime.installerregistry.installerapi;
 
 import org.apache.isis.core.commons.components.Installer;
 import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilderAware;
+import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.runtime.persistence.ObjectStoreFactory;
+import org.apache.isis.core.runtime.persistence.internal.RuntimeContextFromSession;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
@@ -30,13 +33,14 @@ import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory
 /**
  * Installs a {@link PersistenceSession} during system start up.
  */
-public interface PersistenceMechanismInstaller extends Installer, ObjectStoreFactory {
+public interface PersistenceMechanismInstaller extends Installer, ObjectStoreFactory, IsisConfigurationBuilderAware,
+        MetaModelRefiner {
 
     static String TYPE = "persistor";
 
     PersistenceSessionFactory createPersistenceSessionFactory(
-            DeploymentType deploymentType,
-            final ServicesInjectorSpi services,
-            final IsisConfiguration configuration);
+            final DeploymentType deploymentType,
+            final ServicesInjectorSpi servicesInjector,
+            final IsisConfiguration configuration, final RuntimeContextFromSession runtimeContext);
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
index a9c1495..06e97bd 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
@@ -20,6 +20,8 @@
 package org.apache.isis.core.runtime.persistence.internal;
 
 import java.util.List;
+import java.util.Properties;
+
 import org.apache.isis.applib.RecoverableException;
 import org.apache.isis.applib.profiles.Localization;
 import org.apache.isis.applib.query.Query;
@@ -28,6 +30,7 @@ import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProvider;
 import org.apache.isis.core.commons.authentication.AuthenticationSessionProviderAbstract;
 import org.apache.isis.core.commons.authentication.MessageBroker;
+import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.adapter.DomainObjectServices;
 import org.apache.isis.core.metamodel.adapter.DomainObjectServicesAbstract;
 import org.apache.isis.core.metamodel.adapter.LocalizationProviderAbstract;
@@ -82,7 +85,12 @@ public class RuntimeContextFromSession extends RuntimeContextAbstract {
     // Constructor
     // //////////////////////////////////////////////////////////////////
 
-    public RuntimeContextFromSession() {
+
+    public RuntimeContextFromSession(final IsisConfiguration configuration) {
+
+        final Properties properties = applicationPropertiesFrom(configuration);
+        setProperties(properties);
+
         this.authenticationSessionProvider = new AuthenticationSessionProviderAbstract() {
 
             @Override
@@ -308,6 +316,18 @@ public class RuntimeContextFromSession extends RuntimeContextAbstract {
         };
     }
 
+    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
+        final Properties properties = new Properties();
+        final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
+        for (final String key : applicationConfiguration) {
+            final String value = applicationConfiguration.getString(key);
+            final String newKey = key.substring("application.".length());
+            properties.setProperty(newKey, value);
+        }
+        return properties;
+    }
+
+
     // //////////////////////////////////////////////////////////////////
     // Components
     // //////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/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 4baa3fb..ed595ff 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
@@ -152,16 +152,18 @@ public class IsisSystem implements DebugSelection, ApplicationScopedComponent {
 
     private IsisSessionFactory createSessionFactory(final DeploymentType deploymentType) throws IsisSystemException {
 
+        final IsisConfiguration configuration = isisComponentProvider.getConfiguration();
         final List<Object> services = isisComponentProvider.obtainServices();
 
         ServicesInjectorSpi servicesInjectorSpi = new ServicesInjectorDefault(services);
         servicesInjectorSpi.addFallbackIfRequired(FixtureScripts.class, new FixtureScriptsDefault());
         servicesInjectorSpi.validateServices();
 
+        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession(configuration);
+
         final PersistenceSessionFactory persistenceSessionFactory =
-                isisComponentProvider.providePersistenceSessionFactory(deploymentType, servicesInjectorSpi);
+                isisComponentProvider.providePersistenceSessionFactory(deploymentType, servicesInjectorSpi, runtimeContext);
 
-        final IsisConfiguration configuration = getConfiguration();
         final AuthenticationManager authenticationManager =
                 isisComponentProvider.provideAuthenticationManager(deploymentType);
         final AuthorizationManager authorizationManager =
@@ -172,9 +174,7 @@ public class IsisSystem implements DebugSelection, ApplicationScopedComponent {
         final SpecificationLoaderSpi reflector =
                 isisComponentProvider.provideSpecificationLoaderSpi(deploymentType, metaModelRefiners);
 
-
         // bind metamodel to the (runtime) framework
-        final RuntimeContextFromSession runtimeContext = createRuntimeContextFromSession();
         runtimeContext.injectInto(reflector);
 
         return new IsisSessionFactory (
@@ -289,11 +289,6 @@ public class IsisSystem implements DebugSelection, ApplicationScopedComponent {
         return IsisContext.getSpecificationLoader().allSpecifications();
     }
 
-
-    private RuntimeContextFromSession createRuntimeContextFromSession() {
-        return new RuntimeContextFromSession();
-    }
-
     //endregion
 
     //region > shutdown

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
index 606cae0..387dc90 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
@@ -19,8 +19,6 @@
 
 package org.apache.isis.core.runtime.system.persistence;
 
-import java.util.Properties;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -82,19 +80,6 @@ public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationS
         this.servicesInjector = servicesInjector;
         this.runtimeContext = runtimeContext;
 
-        final Properties properties = applicationPropertiesFrom(getConfiguration());
-        runtimeContext.setProperties(properties);
-    }
-
-    private static Properties applicationPropertiesFrom(final IsisConfiguration configuration) {
-        final Properties properties = new Properties();
-        final IsisConfiguration applicationConfiguration = configuration.getProperties("application");
-        for (final String key : applicationConfiguration) {
-            final String value = applicationConfiguration.getString(key);
-            final String newKey = key.substring("application.".length());
-            properties.setProperty(newKey, value);
-        }
-        return properties;
     }
 
     public DeploymentType getDeploymentType() {

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/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
index 77a904e..a14aa80 100644
--- 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
@@ -29,6 +29,7 @@ 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.persistence.internal.RuntimeContextFromSession;
 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;
@@ -49,7 +50,8 @@ public interface IsisComponentProvider {
 
     PersistenceSessionFactory providePersistenceSessionFactory(
             final DeploymentType deploymentType,
-            final ServicesInjectorSpi servicesInjectorSpi) throws IsisSystemException;
+            final ServicesInjectorSpi servicesInjectorSpi,
+            final RuntimeContextFromSession runtimeContext) throws IsisSystemException;
 
     AuthenticationManager provideAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/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
index 7294c7f..0b61357 100644
--- 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
@@ -34,6 +34,7 @@ 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.persistence.internal.RuntimeContextFromSession;
 import org.apache.isis.core.runtime.services.ServicesInstaller;
 import org.apache.isis.core.runtime.system.DeploymentType;
 import org.apache.isis.core.runtime.system.IsisSystemException;
@@ -158,8 +159,9 @@ public class IsisComponentProviderUsingInstallers implements IsisComponentProvid
     @Override
     public PersistenceSessionFactory providePersistenceSessionFactory(
             final DeploymentType deploymentType,
-            final ServicesInjectorSpi servicesInjectorSpi) throws IsisSystemException {
-        return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi, getConfiguration());
+            final ServicesInjectorSpi servicesInjectorSpi, final RuntimeContextFromSession runtimeContext) throws IsisSystemException {
+        return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi, getConfiguration(),
+                runtimeContext);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
index 042bc5e..a5b8786 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
@@ -94,13 +94,15 @@ public class DataNucleusPersistenceMechanismInstaller extends InstallerAbstract
     public PersistenceSessionFactory createPersistenceSessionFactory(
             final DeploymentType deploymentType,
             final ServicesInjectorSpi servicesInjector,
-            final IsisConfiguration configuration) {
-        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
+            final IsisConfiguration configuration,
+            final RuntimeContextFromSession runtimeContext) {
+
         DataNucleusPersistenceMechanismInstaller objectStoreFactory = this;
         return new PersistenceSessionFactory(deploymentType, servicesInjector, configuration, objectStoreFactory, runtimeContext);
     }
     //endregion
 
+
     //region > createObjectStore
 
     @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/1ed4eef4/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
index 87408d4..91674db 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionTest.java
@@ -142,7 +142,7 @@ public class PersistenceSessionTest {
             }
         });
 
-        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession();
+        final RuntimeContextFromSession runtimeContext = new RuntimeContextFromSession(mockConfiguration);
         final DomainObjectContainerDefault container = new DomainObjectContainerDefault();
 
         runtimeContext.injectInto(container);


[9/9] isis git commit: ISIS-848: defined GlobSpec interface in applib, also started reworking simpleapp.

Posted by da...@apache.org.
ISIS-848: defined GlobSpec interface in applib, also started reworking simpleapp.


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

Branch: refs/heads/ISIS-848
Commit: 6ccf96c9addba9175b08ca99c4f80da8a8440c41
Parents: 1ed4eef
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 06:42:47 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 22:34:50 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/isis/applib/GlobSpec.java   | 134 +++++++++++++++++
 .../domainapp/dom/DomainAppDomainModule.java    |  24 +++
 .../dom/app/homepage/HomePageService.java       |  51 -------
 .../dom/app/homepage/HomePageViewModel.java     |  50 -------
 .../app/homepage/HomePageViewModel.layout.json  |  43 ------
 .../dom/app/homepage/HomePageViewModel.png      | Bin 456 -> 0 bytes
 .../dom/modules/simple/SimpleObject.java        | 149 -------------------
 .../dom/modules/simple/SimpleObject.layout.json |  56 -------
 .../dom/modules/simple/SimpleObject.png         | Bin 653 -> 0 bytes
 .../dom/modules/simple/SimpleObjects.java       | 107 -------------
 .../java/domainapp/dom/simple/SimpleObject.java | 149 +++++++++++++++++++
 .../dom/simple/SimpleObject.layout.json         |  56 +++++++
 .../java/domainapp/dom/simple/SimpleObject.png  | Bin 0 -> 653 bytes
 .../domainapp/dom/simple/SimpleObjects.java     | 107 +++++++++++++
 .../dom/modules/simple/SimpleObjectTest.java    |  49 ------
 .../dom/modules/simple/SimpleObjectsTest.java   | 104 -------------
 .../domainapp/dom/simple/SimpleObjectTest.java  |  49 ++++++
 .../domainapp/dom/simple/SimpleObjectsTest.java | 104 +++++++++++++
 .../modules/simple/SimpleObjectCreate.java      |   4 +-
 .../scenarios/RecreateSimpleObjects.java        |   2 +-
 example/application/simpleapp/glob/pom.xml      |  77 ++++++++++
 .../java/domainapp/glob/DomainAppGlobSpec.java  |  60 ++++++++
 .../glob/app/homepage/HomePageService.java      |  51 +++++++
 .../glob/app/homepage/HomePageViewModel.java    |  50 +++++++
 .../app/homepage/HomePageViewModel.layout.json  |  43 ++++++
 .../glob/app/homepage/HomePageViewModel.png     | Bin 0 -> 456 bytes
 .../application/simpleapp/integtests/pom.xml    |   3 +-
 .../modules/simple/SimpleObjectGlue.java        |   4 +-
 .../modules/simple/SimpleObjectIntegTest.java   |   2 +-
 .../modules/simple/SimpleObjectsIntegTest.java  |   4 +-
 example/application/simpleapp/pom.xml           |   6 +
 example/application/simpleapp/webapp/pom.xml    |  21 +--
 .../src/main/webapp/WEB-INF/isis.properties     |   5 +-
 .../WEB-INF/persistor_datanucleus.properties    |   2 +-
 34 files changed, 923 insertions(+), 643 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/core/applib/src/main/java/org/apache/isis/applib/GlobSpec.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/GlobSpec.java b/core/applib/src/main/java/org/apache/isis/applib/GlobSpec.java
new file mode 100644
index 0000000..c5ede73
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/GlobSpec.java
@@ -0,0 +1,134 @@
+/*
+ *  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.applib;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.isis.applib.fixturescripts.FixtureScript;
+
+/**
+ * Specifies the "glob", in other words the set of modules (containing domain services and possibly entities), that
+ * together make up the running application.
+ *
+ * <p>
+ * To use, implement this interface and then define as the <tt>isis.globspec</tt> key within the
+ * <tt>isis.properties</tt> configuration file, or programmatically.
+ * </p>
+ *
+ * <p>
+ * The intention is to centralize, so far as possible, the configuration that previously has been duplicated between
+ * the <tt>xxx-integtests</tt> (Maven) module and the <tt>xxx-webapp</tt> integtests.
+ * </p>
+ *
+ * <p>
+ * There are a number of subsidiary goals:
+ * <ul>
+ *     <li>
+ *         <p>
+ *             by having multiple classes implementing this interface, it allows separate "profiles" of the application
+ *             to be run.
+ *         </p>
+ *         <p>For example, a developer could define a globspec that</p>
+ *         <ul>
+ *             <li>uses the <tt>bypass</tt> security rather than the full-blown Shiro security</li>
+ *             <li>excludes some or all addon modules, eg auditing and security</li>
+ *             <li>for a large app whose domain has been broken out into multiple <tt>dom-xxx</tt> (Maven) modules, to
+ *                 run subsets of the application</li>
+ *         </ul>
+ *         <p>This applies to both running the main app and also the integration tests.</p>
+ *    </li>
+ *    <li>
+ *        <p>Allow different integration tests to run with different globspecs.  Normally the running application is
+ *           shared (on a thread-local) between integration tests.  What the framework could do is to be intelligent
+ *           enough to keep track of the globspec used for each integration test and tear down
+ *           the shared state if the "next" test uses a different globspec</p>
+ *    </li>
+ *    <li>
+ *        Speed up bootstrapping by only scanning for classes annotated by
+ *        {@link org.apache.isis.applib.annotation.DomainService} and {@link javax.jdo.annotations.PersistenceCapable}
+ *        once.
+ *    </li>
+ *    <li>
+ *        Provide a programmatic way to contribute elements of `web.xml`.  This is not yet implemented.
+ *    </li>
+ *    <li>
+ *        Provide a programmatic way to configure Shiro security.  This is not yet implemented.
+ *    </li>
+ *    <li>
+ *        <p>Anticipate the module changes forthcoming in Java 9.  Eventually we see that the globspec class will
+ *        become an application manifest, while the list of modules will become Java 9 modules each advertising the
+ *        types that they export.</p>
+ *    </li>
+ * </ul>
+ * </p>
+ * <p>
+ *     <b>Note:</b> at this time the integration tests do not keep track of different globspecs; rather the
+ *     globspec used for the first test is used for all subsequent tests.
+ * </p>
+ */
+public interface GlobSpec {
+
+    /**
+     * A list of classes, each of which representing the root of one of the modules containing services and possibly
+     * entities, which together makes up the running application.
+     *
+     * <p>
+     *     The package of each such class is used as the basis for searching for domain services and registered
+     *     entities.  As such it replaces and overrides both the
+     *     <tt>isis.services.ServicesInstallerFromAnnotation.packagePrefix</tt> key (usually found in the
+     *     <tt>isis.properties</tt> file) and the
+     *     <tt>isis.persistor.datanucleus.RegisterEntities.packagePrefix</tt> key (usually found in the
+     *     <tt>persistor_datanucleus.properties</tt> file).
+     * </p>
+     *
+     * <p>
+     *     If a globspec has been provided then the value of <tt>isis.services-installer</tt> configuration property
+     *     will be ignored and the <tt>isis.services</tt> configuration property will also be ignored.
+     * </p>
+     *
+     * <p>
+     *     Note: the class implementing this interface will typically include itself in the list of classes, so that any
+     *     "global" services (for example an application home page) are also picked up.
+     * </p>
+     */
+    public List<Class<?>> getModules();
+
+    /**
+     * If non-null, overrides the value of <tt>isis.authentication</tt> configuration property.
+     */
+    public String getAuthenticationMechanism();
+
+    /**
+     * If non-null, overrides the value of <tt>isis.authorization</tt> configuration property.
+     */
+    public String getAuthorizationMechanism();
+
+    /**
+     * If non-null, overrides the value of <tt>isis.fixtures</tt> configuration property.
+     */
+    public List<FixtureScript> getFixtures();
+
+    /**
+     * Overrides for any other configuration properties.
+     */
+    public Map<String,String> getConfiguration();
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomainModule.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomainModule.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomainModule.java
new file mode 100644
index 0000000..1818053
--- /dev/null
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/DomainAppDomainModule.java
@@ -0,0 +1,24 @@
+/*
+ *  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 domainapp.dom;
+
+public final class DomainAppDomainModule {
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java
deleted file mode 100644
index 641c39a..0000000
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageService.java
+++ /dev/null
@@ -1,51 +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 domainapp.dom.app.homepage;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.annotation.Action;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.HomePage;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.SemanticsOf;
-
-@DomainService(
-        nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY // trick to suppress the actions from the top-level menu
-)
-public class HomePageService {
-
-    //region > homePage (action)
-
-    @Action(
-            semantics = SemanticsOf.SAFE
-    )
-    @HomePage
-    public HomePageViewModel homePage() {
-        return container.injectServicesInto(new HomePageViewModel());
-    }
-
-    //endregion
-
-    //region > injected services
-
-    @javax.inject.Inject
-    DomainObjectContainer container;
-
-    //endregion
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java
deleted file mode 100644
index 83015d0..0000000
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.java
+++ /dev/null
@@ -1,50 +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 domainapp.dom.app.homepage;
-
-import java.util.List;
-
-import org.apache.isis.applib.annotation.ViewModel;
-
-import domainapp.dom.modules.simple.SimpleObject;
-import domainapp.dom.modules.simple.SimpleObjects;
-
-@ViewModel
-public class HomePageViewModel {
-
-    //region > title
-    public String title() {
-        return getObjects().size() + " objects";
-    }
-    //endregion
-
-    //region > object (collection)
-    @org.apache.isis.applib.annotation.HomePage
-    public List<SimpleObject> getObjects() {
-        return simpleObjects.listAll();
-    }
-    //endregion
-
-    //region > injected services
-
-    @javax.inject.Inject
-    SimpleObjects simpleObjects;
-
-    //endregion
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.layout.json
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.layout.json b/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.layout.json
deleted file mode 100644
index 34f78e0..0000000
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.layout.json
+++ /dev/null
@@ -1,43 +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.
- */
-{
-    "columns": [
-        {
-            "span": 0,
-            "memberGroups": {}
-        },
-        {
-            "span": 0,
-            "memberGroups": {}
-        },
-        {
-            "span": 0,
-            "memberGroups": {}
-        },
-        {
-            "span": 12,
-            "collections": {
-                "objects": {
-                    "collectionLayout": {
-                        "render": "EAGERLY"
-                    }
-                }
-            }
-        }
-    ],
-    "actions": {}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.png
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.png b/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.png
deleted file mode 100644
index cb03785..0000000
Binary files a/example/application/simpleapp/dom/src/main/java/domainapp/dom/app/homepage/HomePageViewModel.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java
deleted file mode 100644
index a4fba6d..0000000
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.java
+++ /dev/null
@@ -1,149 +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 domainapp.dom.modules.simple;
-
-import javax.jdo.JDOHelper;
-import javax.jdo.annotations.IdentityType;
-import javax.jdo.annotations.VersionStrategy;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.annotation.Action;
-import org.apache.isis.applib.annotation.BookmarkPolicy;
-import org.apache.isis.applib.annotation.DomainObject;
-import org.apache.isis.applib.annotation.DomainObjectLayout;
-import org.apache.isis.applib.annotation.Editing;
-import org.apache.isis.applib.annotation.Parameter;
-import org.apache.isis.applib.annotation.ParameterLayout;
-import org.apache.isis.applib.annotation.Property;
-import org.apache.isis.applib.annotation.Title;
-import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
-import org.apache.isis.applib.services.i18n.TranslatableString;
-import org.apache.isis.applib.util.ObjectContracts;
-
-@javax.jdo.annotations.PersistenceCapable(
-        identityType=IdentityType.DATASTORE,
-        schema = "simple",
-        table = "SimpleObject"
-)
-@javax.jdo.annotations.DatastoreIdentity(
-        strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY,
-         column="id")
-@javax.jdo.annotations.Version(
-        strategy=VersionStrategy.VERSION_NUMBER, 
-        column="version")
-@javax.jdo.annotations.Queries({
-        @javax.jdo.annotations.Query(
-                name = "find", language = "JDOQL",
-                value = "SELECT "
-                        + "FROM domainapp.dom.modules.simple.SimpleObject "),
-        @javax.jdo.annotations.Query(
-                name = "findByName", language = "JDOQL",
-                value = "SELECT "
-                        + "FROM domainapp.dom.modules.simple.SimpleObject "
-                        + "WHERE name.indexOf(:name) >= 0 ")
-})
-@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ", members = {"name"})
-@DomainObject
-@DomainObjectLayout(
-        bookmarking = BookmarkPolicy.AS_ROOT,
-        cssClassFa = "fa-flag"
-)
-public class SimpleObject implements Comparable<SimpleObject> {
-
-
-    //region > identificatiom
-    public TranslatableString title() {
-        return TranslatableString.tr("Object: {name}", "name", getName());
-    }
-    //endregion
-
-    //region > name (property)
-
-    private String name;
-
-    @javax.jdo.annotations.Column(allowsNull="false", length = 40)
-    @Title(sequence="1")
-    @Property(
-            editing = Editing.DISABLED
-    )
-    public String getName() {
-        return name;
-    }
-
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    // endregion
-
-    //region > updateName (action)
-
-    public static class UpdateNameDomainEvent extends ActionDomainEvent<SimpleObject> {
-        public UpdateNameDomainEvent(final SimpleObject source, final Identifier identifier, final Object... arguments) {
-            super(source, identifier, arguments);
-        }
-    }
-
-    @Action(
-            domainEvent = UpdateNameDomainEvent.class
-    )
-    public SimpleObject updateName(
-            @Parameter(maxLength = 40)
-            @ParameterLayout(named = "New name")
-            final String name) {
-        setName(name);
-        return this;
-    }
-
-    public String default0UpdateName() {
-        return getName();
-    }
-
-    public TranslatableString validateUpdateName(final String name) {
-        return name.contains("!")? TranslatableString.tr("Exclamation mark is not allowed"): null;
-    }
-
-    //endregion
-
-    //region > version (derived property)
-    public Long getVersionSequence() {
-        return (Long) JDOHelper.getVersion(this);
-    }
-    //endregion
-
-    //region > compareTo
-
-    @Override
-    public int compareTo(final SimpleObject other) {
-        return ObjectContracts.compare(this, other, "name");
-    }
-
-    //endregion
-
-    //region > injected services
-
-    @javax.inject.Inject
-    @SuppressWarnings("unused")
-    private DomainObjectContainer container;
-
-    //endregion
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.layout.json
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.layout.json b/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.layout.json
deleted file mode 100644
index 3d5e23f..0000000
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.layout.json
+++ /dev/null
@@ -1,56 +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.
- */
-{
-    "columns": [
-        {
-            "span": 6,
-            "memberGroups": {
-                "General": {
-                    "members": {
-                        "name": {
-                            "actions": {
-                                "updateName": {
-                                    "actionLayout": {
-                                        "position": "BOTTOM"
-                                    }
-                                }
-                            }
-                        },
-                        "versionSequence": {
-                            "propertyLayout": {
-                                "name": "version"
-                            }
-                        }
-                    }
-                }
-            }
-        },
-        {
-            "span": 0,
-            "memberGroups": {}
-        },
-        {
-            "span": 0,
-            "memberGroups": {}
-        },
-        {
-            "span": 6,
-            "collections": {}
-        }
-    ],
-    "actions": {}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.png
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.png b/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.png
deleted file mode 100644
index 0bd6f57..0000000
Binary files a/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObject.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java
deleted file mode 100644
index 0634dd1..0000000
--- a/example/application/simpleapp/dom/src/main/java/domainapp/dom/modules/simple/SimpleObjects.java
+++ /dev/null
@@ -1,107 +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 domainapp.dom.modules.simple;
-
-import java.util.List;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.annotation.Action;
-import org.apache.isis.applib.annotation.ActionLayout;
-import org.apache.isis.applib.annotation.BookmarkPolicy;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.DomainServiceLayout;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.ParameterLayout;
-import org.apache.isis.applib.annotation.SemanticsOf;
-import org.apache.isis.applib.query.QueryDefault;
-import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
-import org.apache.isis.applib.services.i18n.TranslatableString;
-
-@DomainService(repositoryFor = SimpleObject.class)
-@DomainServiceLayout(menuOrder = "10")
-public class SimpleObjects {
-
-    //region > title
-    public TranslatableString title() {
-        return TranslatableString.tr("Simple Objects");
-    }
-    //endregion
-
-    //region > listAll (action)
-    @Action(
-            semantics = SemanticsOf.SAFE
-    )
-    @ActionLayout(
-            bookmarking = BookmarkPolicy.AS_ROOT
-    )
-    @MemberOrder(sequence = "1")
-    public List<SimpleObject> listAll() {
-        return container.allInstances(SimpleObject.class);
-    }
-    //endregion
-
-    //region > findByName (action)
-    @Action(
-            semantics = SemanticsOf.SAFE
-    )
-    @ActionLayout(
-            bookmarking = BookmarkPolicy.AS_ROOT
-    )
-    @MemberOrder(sequence = "2")
-    public List<SimpleObject> findByName(
-            @ParameterLayout(named="Name")
-            final String name
-    ) {
-        return container.allMatches(
-                new QueryDefault<>(
-                        SimpleObject.class,
-                        "findByName",
-                        "name", name));
-    }
-    //endregion
-
-    //region > create (action)
-    public static class CreateDomainEvent extends ActionDomainEvent<SimpleObjects> {
-        public CreateDomainEvent(final SimpleObjects source, final Identifier identifier, final Object... arguments) {
-            super(source, identifier, arguments);
-        }
-    }
-
-    @Action(
-            domainEvent = CreateDomainEvent.class
-    )
-    @MemberOrder(sequence = "3")
-    public SimpleObject create(
-            final @ParameterLayout(named="Name") String name) {
-        final SimpleObject obj = container.newTransientInstance(SimpleObject.class);
-        obj.setName(name);
-        container.persistIfNotAlready(obj);
-        return obj;
-    }
-
-    //endregion
-
-    //region > injected services
-
-    @javax.inject.Inject 
-    DomainObjectContainer container;
-
-    //endregion
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
new file mode 100644
index 0000000..1bd9c35
--- /dev/null
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.java
@@ -0,0 +1,149 @@
+/*
+ *  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 domainapp.dom.simple;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.annotations.IdentityType;
+import javax.jdo.annotations.VersionStrategy;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.BookmarkPolicy;
+import org.apache.isis.applib.annotation.DomainObject;
+import org.apache.isis.applib.annotation.DomainObjectLayout;
+import org.apache.isis.applib.annotation.Editing;
+import org.apache.isis.applib.annotation.Parameter;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.Property;
+import org.apache.isis.applib.annotation.Title;
+import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
+import org.apache.isis.applib.services.i18n.TranslatableString;
+import org.apache.isis.applib.util.ObjectContracts;
+
+@javax.jdo.annotations.PersistenceCapable(
+        identityType=IdentityType.DATASTORE,
+        schema = "simple",
+        table = "SimpleObject"
+)
+@javax.jdo.annotations.DatastoreIdentity(
+        strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY,
+         column="id")
+@javax.jdo.annotations.Version(
+        strategy=VersionStrategy.VERSION_NUMBER, 
+        column="version")
+@javax.jdo.annotations.Queries({
+        @javax.jdo.annotations.Query(
+                name = "find", language = "JDOQL",
+                value = "SELECT "
+                        + "FROM domainapp.dom.modules.simple.SimpleObject "),
+        @javax.jdo.annotations.Query(
+                name = "findByName", language = "JDOQL",
+                value = "SELECT "
+                        + "FROM domainapp.dom.modules.simple.SimpleObject "
+                        + "WHERE name.indexOf(:name) >= 0 ")
+})
+@javax.jdo.annotations.Unique(name="SimpleObject_name_UNQ", members = {"name"})
+@DomainObject
+@DomainObjectLayout(
+        bookmarking = BookmarkPolicy.AS_ROOT,
+        cssClassFa = "fa-flag"
+)
+public class SimpleObject implements Comparable<SimpleObject> {
+
+
+    //region > identificatiom
+    public TranslatableString title() {
+        return TranslatableString.tr("Object: {name}", "name", getName());
+    }
+    //endregion
+
+    //region > name (property)
+
+    private String name;
+
+    @javax.jdo.annotations.Column(allowsNull="false", length = 40)
+    @Title(sequence="1")
+    @Property(
+            editing = Editing.DISABLED
+    )
+    public String getName() {
+        return name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    // endregion
+
+    //region > updateName (action)
+
+    public static class UpdateNameDomainEvent extends ActionDomainEvent<SimpleObject> {
+        public UpdateNameDomainEvent(final SimpleObject source, final Identifier identifier, final Object... arguments) {
+            super(source, identifier, arguments);
+        }
+    }
+
+    @Action(
+            domainEvent = UpdateNameDomainEvent.class
+    )
+    public SimpleObject updateName(
+            @Parameter(maxLength = 40)
+            @ParameterLayout(named = "New name")
+            final String name) {
+        setName(name);
+        return this;
+    }
+
+    public String default0UpdateName() {
+        return getName();
+    }
+
+    public TranslatableString validateUpdateName(final String name) {
+        return name.contains("!")? TranslatableString.tr("Exclamation mark is not allowed"): null;
+    }
+
+    //endregion
+
+    //region > version (derived property)
+    public Long getVersionSequence() {
+        return (Long) JDOHelper.getVersion(this);
+    }
+    //endregion
+
+    //region > compareTo
+
+    @Override
+    public int compareTo(final SimpleObject other) {
+        return ObjectContracts.compare(this, other, "name");
+    }
+
+    //endregion
+
+    //region > injected services
+
+    @javax.inject.Inject
+    @SuppressWarnings("unused")
+    private DomainObjectContainer container;
+
+    //endregion
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.json
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.json b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.json
new file mode 100644
index 0000000..3d5e23f
--- /dev/null
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.layout.json
@@ -0,0 +1,56 @@
+/**
+ *  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.
+ */
+{
+    "columns": [
+        {
+            "span": 6,
+            "memberGroups": {
+                "General": {
+                    "members": {
+                        "name": {
+                            "actions": {
+                                "updateName": {
+                                    "actionLayout": {
+                                        "position": "BOTTOM"
+                                    }
+                                }
+                            }
+                        },
+                        "versionSequence": {
+                            "propertyLayout": {
+                                "name": "version"
+                            }
+                        }
+                    }
+                }
+            }
+        },
+        {
+            "span": 0,
+            "memberGroups": {}
+        },
+        {
+            "span": 0,
+            "memberGroups": {}
+        },
+        {
+            "span": 6,
+            "collections": {}
+        }
+    ],
+    "actions": {}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.png
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.png b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.png
new file mode 100644
index 0000000..0bd6f57
Binary files /dev/null and b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObject.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjects.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjects.java b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjects.java
new file mode 100644
index 0000000..ea629d5
--- /dev/null
+++ b/example/application/simpleapp/dom/src/main/java/domainapp/dom/simple/SimpleObjects.java
@@ -0,0 +1,107 @@
+/*
+ *  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 domainapp.dom.simple;
+
+import java.util.List;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.ActionLayout;
+import org.apache.isis.applib.annotation.BookmarkPolicy;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.DomainServiceLayout;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.ParameterLayout;
+import org.apache.isis.applib.annotation.SemanticsOf;
+import org.apache.isis.applib.query.QueryDefault;
+import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
+import org.apache.isis.applib.services.i18n.TranslatableString;
+
+@DomainService(repositoryFor = SimpleObject.class)
+@DomainServiceLayout(menuOrder = "10")
+public class SimpleObjects {
+
+    //region > title
+    public TranslatableString title() {
+        return TranslatableString.tr("Simple Objects");
+    }
+    //endregion
+
+    //region > listAll (action)
+    @Action(
+            semantics = SemanticsOf.SAFE
+    )
+    @ActionLayout(
+            bookmarking = BookmarkPolicy.AS_ROOT
+    )
+    @MemberOrder(sequence = "1")
+    public List<SimpleObject> listAll() {
+        return container.allInstances(SimpleObject.class);
+    }
+    //endregion
+
+    //region > findByName (action)
+    @Action(
+            semantics = SemanticsOf.SAFE
+    )
+    @ActionLayout(
+            bookmarking = BookmarkPolicy.AS_ROOT
+    )
+    @MemberOrder(sequence = "2")
+    public List<SimpleObject> findByName(
+            @ParameterLayout(named="Name")
+            final String name
+    ) {
+        return container.allMatches(
+                new QueryDefault<>(
+                        SimpleObject.class,
+                        "findByName",
+                        "name", name));
+    }
+    //endregion
+
+    //region > create (action)
+    public static class CreateDomainEvent extends ActionDomainEvent<SimpleObjects> {
+        public CreateDomainEvent(final SimpleObjects source, final Identifier identifier, final Object... arguments) {
+            super(source, identifier, arguments);
+        }
+    }
+
+    @Action(
+            domainEvent = CreateDomainEvent.class
+    )
+    @MemberOrder(sequence = "3")
+    public SimpleObject create(
+            final @ParameterLayout(named="Name") String name) {
+        final SimpleObject obj = container.newTransientInstance(SimpleObject.class);
+        obj.setName(name);
+        container.persistIfNotAlready(obj);
+        return obj;
+    }
+
+    //endregion
+
+    //region > injected services
+
+    @javax.inject.Inject 
+    DomainObjectContainer container;
+
+    //endregion
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java b/example/application/simpleapp/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java
deleted file mode 100644
index e29b3f2..0000000
--- a/example/application/simpleapp/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectTest.java
+++ /dev/null
@@ -1,49 +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 domainapp.dom.modules.simple;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SimpleObjectTest {
-
-    SimpleObject simpleObject;
-
-    @Before
-    public void setUp() throws Exception {
-        simpleObject = new SimpleObject();
-    }
-
-    public static class Name extends SimpleObjectTest {
-
-        @Test
-        public void happyCase() throws Exception {
-            // given
-            String name = "Foobar";
-            assertThat(simpleObject.getName()).isNull();
-
-            // when
-            simpleObject.setName(name);
-
-            // then
-            assertThat(simpleObject.getName()).isEqualTo(name);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java b/example/application/simpleapp/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java
deleted file mode 100644
index a41d25a..0000000
--- a/example/application/simpleapp/dom/src/test/java/domainapp/dom/modules/simple/SimpleObjectsTest.java
+++ /dev/null
@@ -1,104 +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 domainapp.dom.modules.simple;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import org.jmock.Expectations;
-import org.jmock.Sequence;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class SimpleObjectsTest {
-
-    @Rule
-    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
-    @Mock
-    DomainObjectContainer mockContainer;
-    
-    SimpleObjects simpleObjects;
-
-    @Before
-    public void setUp() throws Exception {
-        simpleObjects = new SimpleObjects();
-        simpleObjects.container = mockContainer;
-    }
-
-    public static class Create extends SimpleObjectsTest {
-
-        @Test
-        public void happyCase() throws Exception {
-
-            // given
-            final SimpleObject simpleObject = new SimpleObject();
-
-            final Sequence seq = context.sequence("create");
-            context.checking(new Expectations() {
-                {
-                    oneOf(mockContainer).newTransientInstance(SimpleObject.class);
-                    inSequence(seq);
-                    will(returnValue(simpleObject));
-
-                    oneOf(mockContainer).persistIfNotAlready(simpleObject);
-                    inSequence(seq);
-                }
-            });
-
-            // when
-            final SimpleObject obj = simpleObjects.create("Foobar");
-
-            // then
-            assertThat(obj).isEqualTo(simpleObject);
-            assertThat(obj.getName()).isEqualTo("Foobar");
-        }
-
-    }
-
-    public static class ListAll extends SimpleObjectsTest {
-
-        @Test
-        public void happyCase() throws Exception {
-
-            // given
-            final List<SimpleObject> all = Lists.newArrayList();
-
-            context.checking(new Expectations() {
-                {
-                    oneOf(mockContainer).allInstances(SimpleObject.class);
-                    will(returnValue(all));
-                }
-            });
-
-            // when
-            final List<SimpleObject> list = simpleObjects.listAll();
-
-            // then
-            assertThat(list).isEqualTo(all);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectTest.java b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectTest.java
new file mode 100644
index 0000000..b9dbcb4
--- /dev/null
+++ b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectTest.java
@@ -0,0 +1,49 @@
+/**
+ *  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 domainapp.dom.simple;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SimpleObjectTest {
+
+    SimpleObject simpleObject;
+
+    @Before
+    public void setUp() throws Exception {
+        simpleObject = new SimpleObject();
+    }
+
+    public static class Name extends SimpleObjectTest {
+
+        @Test
+        public void happyCase() throws Exception {
+            // given
+            String name = "Foobar";
+            assertThat(simpleObject.getName()).isNull();
+
+            // when
+            simpleObject.setName(name);
+
+            // then
+            assertThat(simpleObject.getName()).isEqualTo(name);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectsTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectsTest.java b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectsTest.java
new file mode 100644
index 0000000..13dce0b
--- /dev/null
+++ b/example/application/simpleapp/dom/src/test/java/domainapp/dom/simple/SimpleObjectsTest.java
@@ -0,0 +1,104 @@
+/**
+ *  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 domainapp.dom.simple;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+import org.jmock.Expectations;
+import org.jmock.Sequence;
+import org.jmock.auto.Mock;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class SimpleObjectsTest {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    DomainObjectContainer mockContainer;
+    
+    SimpleObjects simpleObjects;
+
+    @Before
+    public void setUp() throws Exception {
+        simpleObjects = new SimpleObjects();
+        simpleObjects.container = mockContainer;
+    }
+
+    public static class Create extends SimpleObjectsTest {
+
+        @Test
+        public void happyCase() throws Exception {
+
+            // given
+            final SimpleObject simpleObject = new SimpleObject();
+
+            final Sequence seq = context.sequence("create");
+            context.checking(new Expectations() {
+                {
+                    oneOf(mockContainer).newTransientInstance(SimpleObject.class);
+                    inSequence(seq);
+                    will(returnValue(simpleObject));
+
+                    oneOf(mockContainer).persistIfNotAlready(simpleObject);
+                    inSequence(seq);
+                }
+            });
+
+            // when
+            final SimpleObject obj = simpleObjects.create("Foobar");
+
+            // then
+            assertThat(obj).isEqualTo(simpleObject);
+            assertThat(obj.getName()).isEqualTo("Foobar");
+        }
+
+    }
+
+    public static class ListAll extends SimpleObjectsTest {
+
+        @Test
+        public void happyCase() throws Exception {
+
+            // given
+            final List<SimpleObject> all = Lists.newArrayList();
+
+            context.checking(new Expectations() {
+                {
+                    oneOf(mockContainer).allInstances(SimpleObject.class);
+                    will(returnValue(all));
+                }
+            });
+
+            // when
+            final List<SimpleObject> list = simpleObjects.listAll();
+
+            // then
+            assertThat(list).isEqualTo(all);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java
index 926217d..b23f2be 100644
--- a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java
+++ b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java
@@ -21,8 +21,8 @@ package domainapp.fixture.modules.simple;
 
 import org.apache.isis.applib.fixturescripts.FixtureScript;
 
-import domainapp.dom.modules.simple.SimpleObject;
-import domainapp.dom.modules.simple.SimpleObjects;
+import domainapp.dom.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObjects;
 
 public class SimpleObjectCreate extends FixtureScript {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java
index 072769e..6b8943b 100644
--- a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java
+++ b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java
@@ -27,7 +27,7 @@ import com.google.common.collect.Lists;
 
 import org.apache.isis.applib.fixturescripts.FixtureScript;
 
-import domainapp.dom.modules.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObject;
 import domainapp.fixture.modules.simple.SimpleObjectCreate;
 import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/glob/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/glob/pom.xml b/example/application/simpleapp/glob/pom.xml
new file mode 100644
index 0000000..0281d43
--- /dev/null
+++ b/example/application/simpleapp/glob/pom.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.isis.example.application</groupId>
+        <artifactId>simpleapp</artifactId>
+        <version>1.9.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>simpleapp-glob</artifactId>
+    <name>Simple App Glob</name>
+
+    <build>
+        <resources>
+            <resource>
+                <filtering>false</filtering>
+                <directory>src/main/resources</directory>
+            </resource>
+            <resource>
+                <filtering>false</filtering>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**</include>
+                </includes>
+                <excludes>
+                    <exclude>**/*.java</exclude>
+                </excludes>
+            </resource>
+        </resources>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>simpleapp-dom</artifactId>
+            <exclusions>
+                <exclusion>
+                    <!-- so don't pick up transitive dependency to asm 4.0.0 -->
+                    <groupId>org.datanucleus</groupId>
+                    <artifactId>datanucleus-enhancer</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>simpleapp-fixture</artifactId>
+            <exclusions>
+                <exclusion>
+                    <!-- so don't pick up transitive dependency to asm 4.0.0 -->
+                    <groupId>org.datanucleus</groupId>
+                    <artifactId>datanucleus-enhancer</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/glob/src/main/java/domainapp/glob/DomainAppGlobSpec.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/glob/src/main/java/domainapp/glob/DomainAppGlobSpec.java b/example/application/simpleapp/glob/src/main/java/domainapp/glob/DomainAppGlobSpec.java
new file mode 100644
index 0000000..552cd32
--- /dev/null
+++ b/example/application/simpleapp/glob/src/main/java/domainapp/glob/DomainAppGlobSpec.java
@@ -0,0 +1,60 @@
+/*
+ *  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 domainapp.glob;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.isis.applib.GlobSpec;
+import org.apache.isis.applib.fixturescripts.FixtureScript;
+
+import domainapp.dom.DomainAppDomainModule;
+
+public final class DomainAppGlobSpec implements GlobSpec {
+
+    @Override
+    public List<Class<?>> getModules() {
+        return Arrays.asList(
+                DomainAppDomainModule.class,
+                DomainAppGlobSpec.class
+        );
+    }
+
+    @Override
+    public String getAuthenticationMechanism() {
+        return null;
+    }
+
+    @Override
+    public String getAuthorizationMechanism() {
+        return null;
+    }
+
+    @Override
+    public List<FixtureScript> getFixtures() {
+        return null;
+    }
+
+    @Override
+    public Map<String, String> getConfiguration() {
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageService.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageService.java b/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageService.java
new file mode 100644
index 0000000..3870c27
--- /dev/null
+++ b/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageService.java
@@ -0,0 +1,51 @@
+/*
+ *  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 domainapp.glob.app.homepage;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.DomainService;
+import org.apache.isis.applib.annotation.HomePage;
+import org.apache.isis.applib.annotation.NatureOfService;
+import org.apache.isis.applib.annotation.SemanticsOf;
+
+@DomainService(
+        nature = NatureOfService.VIEW_CONTRIBUTIONS_ONLY // trick to suppress the actions from the top-level menu
+)
+public class HomePageService {
+
+    //region > homePage (action)
+
+    @Action(
+            semantics = SemanticsOf.SAFE
+    )
+    @HomePage
+    public HomePageViewModel homePage() {
+        return container.injectServicesInto(new HomePageViewModel());
+    }
+
+    //endregion
+
+    //region > injected services
+
+    @javax.inject.Inject
+    DomainObjectContainer container;
+
+    //endregion
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.java b/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.java
new file mode 100644
index 0000000..c7c584c
--- /dev/null
+++ b/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.java
@@ -0,0 +1,50 @@
+/*
+ *  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 domainapp.glob.app.homepage;
+
+import java.util.List;
+
+import org.apache.isis.applib.annotation.ViewModel;
+
+import domainapp.dom.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObjects;
+
+@ViewModel
+public class HomePageViewModel {
+
+    //region > title
+    public String title() {
+        return getObjects().size() + " objects";
+    }
+    //endregion
+
+    //region > object (collection)
+    @org.apache.isis.applib.annotation.HomePage
+    public List<SimpleObject> getObjects() {
+        return simpleObjects.listAll();
+    }
+    //endregion
+
+    //region > injected services
+
+    @javax.inject.Inject
+    SimpleObjects simpleObjects;
+
+    //endregion
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.layout.json
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.layout.json b/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.layout.json
new file mode 100644
index 0000000..34f78e0
--- /dev/null
+++ b/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.layout.json
@@ -0,0 +1,43 @@
+/**
+ *  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.
+ */
+{
+    "columns": [
+        {
+            "span": 0,
+            "memberGroups": {}
+        },
+        {
+            "span": 0,
+            "memberGroups": {}
+        },
+        {
+            "span": 0,
+            "memberGroups": {}
+        },
+        {
+            "span": 12,
+            "collections": {
+                "objects": {
+                    "collectionLayout": {
+                        "render": "EAGERLY"
+                    }
+                }
+            }
+        }
+    ],
+    "actions": {}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.png
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.png b/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.png
new file mode 100644
index 0000000..cb03785
Binary files /dev/null and b/example/application/simpleapp/glob/src/main/java/domainapp/glob/app/homepage/HomePageViewModel.png differ

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/integtests/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/pom.xml b/example/application/simpleapp/integtests/pom.xml
index cc7ad71..d40db1d 100644
--- a/example/application/simpleapp/integtests/pom.xml
+++ b/example/application/simpleapp/integtests/pom.xml
@@ -83,10 +83,9 @@
     </build>
     <dependencies>
 
-        <!-- other modules in this project -->
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>simpleapp-fixture</artifactId>
+            <artifactId>simpleapp-glob</artifactId>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java
index 63d96bd..8263915 100644
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/specglue/modules/simple/SimpleObjectGlue.java
@@ -23,8 +23,8 @@ import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
 
 import cucumber.api.java.en.Given;
 import cucumber.api.java.en.When;
-import domainapp.dom.modules.simple.SimpleObject;
-import domainapp.dom.modules.simple.SimpleObjects;
+import domainapp.dom.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObjects;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java
index 610136b..5abc8cd 100644
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectIntegTest.java
@@ -28,7 +28,7 @@ import org.apache.isis.applib.fixturescripts.FixtureScripts;
 import org.apache.isis.applib.services.wrapper.DisabledException;
 import org.apache.isis.applib.services.wrapper.InvalidException;
 
-import domainapp.dom.modules.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObject;
 import domainapp.fixture.scenarios.RecreateSimpleObjects;
 import domainapp.integtests.tests.SimpleAppIntegTest;
 import static org.assertj.core.api.Assertions.assertThat;

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
index fd3b0ff..db6e3c1 100644
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
@@ -33,8 +33,8 @@ import org.junit.Test;
 import org.apache.isis.applib.fixturescripts.FixtureScript;
 import org.apache.isis.applib.fixturescripts.FixtureScripts;
 
-import domainapp.dom.modules.simple.SimpleObject;
-import domainapp.dom.modules.simple.SimpleObjects;
+import domainapp.dom.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObjects;
 import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
 import domainapp.fixture.scenarios.RecreateSimpleObjects;
 import domainapp.integtests.tests.SimpleAppIntegTest;

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/pom.xml b/example/application/simpleapp/pom.xml
index 9c2442d..9ac4077 100644
--- a/example/application/simpleapp/pom.xml
+++ b/example/application/simpleapp/pom.xml
@@ -334,6 +334,7 @@
     <modules>
         <module>dom</module>
         <module>fixture</module>
+        <module>glob</module>
         <module>integtests</module>
         <module>webapp</module>
     </modules>
@@ -377,6 +378,11 @@
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
+                <artifactId>simpleapp-glob</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
                 <artifactId>simpleapp-webapp</artifactId>
                 <version>${project.version}</version>
             </dependency>

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index 1112924..006583c 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -143,28 +143,9 @@
 
     <dependencies>
     
-        <!-- other modules in this project -->
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>simpleapp-dom</artifactId>
-            <exclusions>
-                <exclusion>
-                    <!-- so don't pick up transitive dependency to asm 4.0.0 -->
-                    <groupId>org.datanucleus</groupId>
-                    <artifactId>datanucleus-enhancer</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>simpleapp-fixture</artifactId>
-            <exclusions>
-                <exclusion>
-                    <!-- so don't pick up transitive dependency to asm 4.0.0 -->
-                    <groupId>org.datanucleus</groupId>
-                    <artifactId>datanucleus-enhancer</artifactId>
-                </exclusion>
-            </exclusions>
+            <artifactId>simpleapp-glob</artifactId>
         </dependency>
         
         <!-- other isis components -->

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties
index 929d177..0ec356a 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/isis.properties
@@ -38,11 +38,10 @@
 
 
 #
-# configure the persistor (object store) to use
 #
+#
+isis.globspec=domainapp.glob.DomainAppGlobSpec
 
-# JDO/DataNucleus objectstore
-isis.persistor=datanucleus
 
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6ccf96c9/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties
index 675ced3..f27533c 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor_datanucleus.properties
@@ -21,7 +21,7 @@
 
 # identifies @PersistenceCapable entities to be eagerly registered
 # if move class to other package (eg com.mycompany.myapp.dom) then update 
-isis.persistor.datanucleus.RegisterEntities.packagePrefix=domainapp.dom.modules
+isis.persistor.datanucleus.RegisterEntities.packagePrefix=domainapp.dom
 
 #
 # hook to perform additional initialization when JDO class metadata is loaded


[6/9] isis git commit: ISIS-1188: IsisSessionFactory create OidMarshaller directly rather than passed in; pass ServicesInjectorSpi to PersistenceSessionFactory.

Posted by da...@apache.org.
ISIS-1188: IsisSessionFactory create OidMarshaller directly rather than passed in; pass ServicesInjectorSpi to PersistenceSessionFactory.


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

Branch: refs/heads/ISIS-848
Commit: 78dbc9a73bd068d03e8e97288a16933aff493408
Parents: fd9a217
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Wed Aug 5 18:16:36 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Wed Aug 5 18:16:36 2015 +0100

----------------------------------------------------------------------
 .../IsisComponentProviderDefault.java           |  5 ++--
 .../PersistenceMechanismInstaller.java          |  7 ++---
 .../isis/core/runtime/system/IsisSystem.java    | 30 +++++++++-----------
 .../persistence/PersistenceSessionFactory.java  |  8 ++----
 .../system/session/IsisSessionFactory.java      |  7 ++---
 .../IsisComponentProvider.java                  |  5 ++--
 .../IsisComponentProviderUsingInstallers.java   |  6 ++--
 ...ataNucleusPersistenceMechanismInstaller.java |  5 ++--
 .../core/runtime/context/IsisContextTest.java   |  2 +-
 ...onFactoryAbstractTest_init_and_shutdown.java |  2 +-
 10 files changed, 37 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/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
index b710fe1..17f6f4b 100644
--- 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
@@ -35,6 +35,7 @@ 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.services.ServicesInjectorSpi;
 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;
@@ -208,10 +209,10 @@ public class IsisComponentProviderDefault implements IsisComponentProvider {
     @Override
     public PersistenceSessionFactory providePersistenceSessionFactory(
             DeploymentType deploymentType,
-            final List<Object> services) throws IsisSystemException {
+            final ServicesInjectorSpi servicesInjectorSpi) throws IsisSystemException {
         PersistenceMechanismInstaller installer =
                 createPersistenceMechanismInstaller(getConfiguration());
-        return installer.createPersistenceSessionFactory(deploymentType, services);
+        return installer.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi);
     }
 
     private PersistenceMechanismInstaller createPersistenceMechanismInstaller(IsisConfiguration configuration) throws IsisSystemException {

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
index d18f351..6044b83 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/PersistenceMechanismInstaller.java
@@ -19,13 +19,12 @@
 
 package org.apache.isis.core.runtime.installerregistry.installerapi;
 
-import java.util.List;
-
 import org.apache.isis.core.commons.components.Installer;
+import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.runtime.persistence.ObjectStoreFactory;
-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 org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
 
 /**
  * Installs a {@link PersistenceSession} during system start up.
@@ -34,6 +33,6 @@ public interface PersistenceMechanismInstaller extends Installer, ObjectStoreFac
 
     static String TYPE = "persistor";
 
-    PersistenceSessionFactory createPersistenceSessionFactory(DeploymentType deploymentType, final List<Object> services);
+    PersistenceSessionFactory createPersistenceSessionFactory(DeploymentType deploymentType, final ServicesInjectorSpi services);
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/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 f6c25ea..4baa3fb 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
@@ -36,8 +36,8 @@ 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.ServicesInjectorDefault;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
@@ -153,24 +153,25 @@ public class IsisSystem implements DebugSelection, ApplicationScopedComponent {
     private IsisSessionFactory createSessionFactory(final DeploymentType deploymentType) throws IsisSystemException {
 
         final List<Object> services = isisComponentProvider.obtainServices();
+
+        ServicesInjectorSpi servicesInjectorSpi = new ServicesInjectorDefault(services);
+        servicesInjectorSpi.addFallbackIfRequired(FixtureScripts.class, new FixtureScriptsDefault());
+        servicesInjectorSpi.validateServices();
+
         final PersistenceSessionFactory persistenceSessionFactory =
-                isisComponentProvider.providePersistenceSessionFactory(deploymentType, services);
+                isisComponentProvider.providePersistenceSessionFactory(deploymentType, servicesInjectorSpi);
 
         final IsisConfiguration configuration = getConfiguration();
-        final AuthenticationManager authenticationManager = isisComponentProvider
-                .provideAuthenticationManager(deploymentType);
-        final AuthorizationManager authorizationManager = isisComponentProvider
-                .provideAuthorizationManager(deploymentType);
-        final OidMarshaller oidMarshaller = createOidMarshaller();
+        final AuthenticationManager authenticationManager =
+                isisComponentProvider.provideAuthenticationManager(deploymentType);
+        final AuthorizationManager authorizationManager =
+                isisComponentProvider.provideAuthorizationManager(deploymentType);
 
         final Collection<MetaModelRefiner> metaModelRefiners =
                 refiners(authenticationManager, authorizationManager, persistenceSessionFactory);
-        final SpecificationLoaderSpi reflector = isisComponentProvider
-                .provideSpecificationLoaderSpi(deploymentType, metaModelRefiners);
+        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();
@@ -179,7 +180,7 @@ public class IsisSystem implements DebugSelection, ApplicationScopedComponent {
         return new IsisSessionFactory (
                 deploymentType, configuration, reflector,
                 authenticationManager, authorizationManager,
-                persistenceSessionFactory, oidMarshaller);
+                persistenceSessionFactory);
     }
 
     private static Collection<MetaModelRefiner> refiners(Object... possibleRefiners ) {
@@ -288,9 +289,6 @@ public class IsisSystem implements DebugSelection, ApplicationScopedComponent {
         return IsisContext.getSpecificationLoader().allSpecifications();
     }
 
-    private OidMarshaller createOidMarshaller() {
-        return new OidMarshaller();
-    }
 
     private RuntimeContextFromSession createRuntimeContextFromSession() {
         return new RuntimeContextFromSession();

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
index fe989cb..7f32d69 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSessionFactory.java
@@ -19,7 +19,6 @@
 
 package org.apache.isis.core.runtime.system.persistence;
 
-import java.util.List;
 import java.util.Properties;
 
 import org.slf4j.Logger;
@@ -32,7 +31,6 @@ import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.facetapi.MetaModelRefiner;
 import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
 import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.services.ServicesInjectorDefault;
 import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
@@ -68,16 +66,16 @@ public class PersistenceSessionFactory implements MetaModelRefiner, ApplicationS
 
     public PersistenceSessionFactory(
             final DeploymentType deploymentType,
-            final List<Object> serviceList,
+            final ServicesInjectorSpi servicesInjector,
             final IsisConfiguration isisConfiguration,
             final ObjectStoreFactory objectStoreFactory) {
 
-        ensureThatState(serviceList, is(notNullValue()));
+        ensureThatState(servicesInjector, is(notNullValue()));
 
         this.deploymentType = deploymentType;
         this.configuration = isisConfiguration;
         this.objectStoreFactory = objectStoreFactory;
-        servicesInjector = new ServicesInjectorDefault(serviceList);
+        this.servicesInjector = servicesInjector;
     }
 
     public DeploymentType getDeploymentType() {

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/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 1af2136..cc9124a 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
@@ -73,14 +73,13 @@ public class IsisSessionFactory implements ApplicationScopedComponent {
     private final PersistenceSessionFactory persistenceSessionFactory;
     private final OidMarshaller oidMarshaller;
 
-    public IsisSessionFactory (
+    public IsisSessionFactory(
             final DeploymentType deploymentType,
             final IsisConfiguration configuration,
             final SpecificationLoaderSpi specificationLoader,
             final AuthenticationManager authenticationManager,
             final AuthorizationManager authorizationManager,
-            final PersistenceSessionFactory persistenceSessionFactory,
-            final OidMarshaller oidMarshaller) {
+            final PersistenceSessionFactory persistenceSessionFactory) {
 
         ensureThatArg(deploymentType, is(not(nullValue())));
         ensureThatArg(configuration, is(not(nullValue())));
@@ -95,7 +94,7 @@ public class IsisSessionFactory implements ApplicationScopedComponent {
         this.authenticationManager = authenticationManager;
         this.authorizationManager = authorizationManager;
         this.persistenceSessionFactory = persistenceSessionFactory;
-        this.oidMarshaller = oidMarshaller;
+        this.oidMarshaller = new OidMarshaller();;
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/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
index 8194a6c..77a904e 100644
--- 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
@@ -24,6 +24,7 @@ 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.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;
@@ -47,8 +48,8 @@ public interface IsisComponentProvider {
             IsisSystemException;
 
     PersistenceSessionFactory providePersistenceSessionFactory(
-            DeploymentType deploymentType,
-            final List<Object> services) throws IsisSystemException;
+            final DeploymentType deploymentType,
+            final ServicesInjectorSpi servicesInjectorSpi) throws IsisSystemException;
 
     AuthenticationManager provideAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException;
 

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/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
index 561d54c..a28dea3 100644
--- 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
@@ -24,6 +24,7 @@ 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.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.ObjectReflectorInstaller;
 import org.apache.isis.core.runtime.authentication.AuthenticationManager;
@@ -147,7 +148,6 @@ public class IsisComponentProviderUsingInstallers implements IsisComponentProvid
             final DeploymentType deploymentType,
             final Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
 
-
         return reflectorInstaller.createReflector(metaModelRefiners);
     }
 
@@ -160,8 +160,8 @@ public class IsisComponentProviderUsingInstallers implements IsisComponentProvid
     @Override
     public PersistenceSessionFactory providePersistenceSessionFactory(
             final DeploymentType deploymentType,
-            final List<Object> services) throws IsisSystemException {
-        return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, services);
+            final ServicesInjectorSpi servicesInjectorSpi) throws IsisSystemException {
+        return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
index 7aeb633..f5a6f7c 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
@@ -31,6 +31,7 @@ import org.apache.isis.core.commons.components.Installer;
 import org.apache.isis.core.commons.config.InstallerAbstract;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
 import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
 import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
 import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
@@ -90,8 +91,8 @@ public class DataNucleusPersistenceMechanismInstaller extends InstallerAbstract
     //region > createPersistenceSessionFactory
     @Override
     public PersistenceSessionFactory createPersistenceSessionFactory(
-            final DeploymentType deploymentType, final List<Object> services) {
-        return new PersistenceSessionFactory(deploymentType, services, getConfiguration(), this);
+            final DeploymentType deploymentType, final ServicesInjectorSpi servicesInjector) {
+        return new PersistenceSessionFactory(deploymentType, servicesInjector, getConfiguration(), this);
     }
     //endregion
 

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/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 6b01e83..920d67d 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
@@ -101,7 +101,7 @@ public class IsisContextTest {
             }
         });
 
-        sessionFactory = new IsisSessionFactory(DeploymentType.UNIT_TESTING, configuration, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockPersistenceSessionFactory, oidMarshaller);
+        sessionFactory = new IsisSessionFactory(DeploymentType.UNIT_TESTING, configuration, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockPersistenceSessionFactory);
         authSession = new SimpleSession("tester", Collections.<String>emptyList());
         
         IsisContext.setConfiguration(configuration);

http://git-wip-us.apache.org/repos/asf/isis/blob/78dbc9a7/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 ec8e1e0..b2435aa 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 IsisSessionFactory(mockDeploymentType, configuration, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockPersistenceSessionFactory, mockOidMarshaller) {
+        isf = new IsisSessionFactory(mockDeploymentType, configuration, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockPersistenceSessionFactory) {
         };
     }
 }


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

Posted by da...@apache.org.
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/ISIS-848
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);
-    }
-}