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 2012/12/06 11:10:36 UTC

[38/51] [partial] ISIS-188: moving modules into core

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/IsisRunner.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/IsisRunner.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/IsisRunner.java
new file mode 100644
index 0000000..3585682
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/IsisRunner.java
@@ -0,0 +1,260 @@
+/*
+ *  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.runtimes.dflt.runtime.runner;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.cli.BasicParser;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilderDefault;
+import org.apache.isis.core.runtime.logging.IsisLoggingConfigurer;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandler;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.runtimes.dflt.runtime.installers.InstallerLookupDefault;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerAdditionalProperty;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerConfiguration;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerDebug;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerDeploymentType;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerDiagnostics;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerFixture;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerHelp;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerNoSplash;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerPersistor;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerQuiet;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerReflector;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerUserProfileStore;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerVerbose;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerVersion;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionHandlerViewer;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionValidator;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionValidatorForPersistor;
+import org.apache.isis.runtimes.dflt.runtime.runner.opts.OptionValidatorForViewers;
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+
+public class IsisRunner {
+
+    private final IsisLoggingConfigurer loggingConfigurer = new IsisLoggingConfigurer();
+
+    private final String[] args;
+    private final OptionHandlerDeploymentType optionHandlerDeploymentType;
+    private final InstallerLookup installerLookup;
+
+    private final OptionHandlerViewer optionHandlerViewer;
+
+    private final List<OptionHandler> optionHandlers = Lists.newArrayList();
+    private final List<OptionValidator> validators = Lists.newArrayList();
+    private IsisConfigurationBuilder isisConfigurationBuilder = new IsisConfigurationBuilderDefault();
+
+    private Injector globalInjector;;
+
+    // ///////////////////////////////////////////////////////////////////////////////////////
+    // Construction and adjustments
+    // ///////////////////////////////////////////////////////////////////////////////////////
+
+    public IsisRunner(final String[] args, final OptionHandlerDeploymentType optionHandlerDeploymentType) {
+
+        this.args = args;
+        this.optionHandlerDeploymentType = optionHandlerDeploymentType;
+
+        // setup logging immediately
+        loggingConfigurer.configureLogging(determineConfigDirectory(), args);
+
+        this.installerLookup = new InstallerLookupDefault();
+
+        addOptionHandler(optionHandlerDeploymentType);
+        this.optionHandlerViewer = addStandardOptionHandlersAndValidators(this.installerLookup);
+    }
+
+    private String determineConfigDirectory() {
+        if (new File(ConfigurationConstants.WEBINF_FULL_DIRECTORY).exists()) {
+            return ConfigurationConstants.WEBINF_FULL_DIRECTORY;
+        } else {
+            return ConfigurationConstants.DEFAULT_CONFIG_DIRECTORY;
+        }
+    }
+
+    /**
+     * Adds additional option handlers; may also require additional
+     * {@link OptionValidator validator}s to be
+     * {@link #addValidator(OptionValidator) add}ed.
+     * <p>
+     * An adjustment (as per GOOS book).
+     */
+    public final boolean addOptionHandler(final OptionHandler optionHandler) {
+        return optionHandlers.add(optionHandler);
+    }
+
+    /**
+     * Adds additional validators; typically goes hand-in-hand will calls to
+     * {@link #addOptionHandler(OptionHandler)}.
+     * <p>
+     * An adjustment (as per GOOS book).
+     */
+    public void addValidator(final OptionValidator validator) {
+        validators.add(validator);
+    }
+
+    /**
+     * The default implementation is a {@link IsisConfigurationBuilderDefault},
+     * which looks to the <tt>config/</tt> directory, the
+     * <tt>src/main/webapp/WEB-INF</tt> directory, and then finally to the
+     * classpath. However, this could be a security concern in a production
+     * environment; a user could edit the <tt>isis.properties</tt> config files
+     * to disable security, for example.
+     * <p>
+     * This method therefore allows this system to be configured using a
+     * different {@link IsisConfigurationBuilder}. For example, a
+     * security-conscious subclass could return a
+     * {@link IsisConfigurationBuilder} that only reads from the classpath. This
+     * would allow the application to be deployed as a single sealed JAR that
+     * could not be tampered with.
+     * <p>
+     * An adjustment (as per GOOS book).
+     */
+    public void setConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        this.isisConfigurationBuilder = isisConfigurationBuilder;
+    }
+
+    // ///////////////////////////////////////////////////////////////////////////////////////
+    // parse and validate
+    // ///////////////////////////////////////////////////////////////////////////////////////
+
+    public final boolean parseAndValidate() {
+
+        // add options (ie cmd line flags)
+        final Options options = createOptions();
+
+        // parse & validate options from the cmd line
+        final BootPrinter printer = new BootPrinter(getClass());
+        return parseOptions(options, printer) && validateOptions(options, printer);
+    }
+
+    private Options createOptions() {
+        final Options options = new Options();
+        for (final OptionHandler optionHandler : optionHandlers) {
+            optionHandler.addOption(options);
+        }
+        return options;
+    }
+
+    private boolean parseOptions(final Options options, final BootPrinter printer) {
+        final CommandLineParser parser = new BasicParser();
+        try {
+            final CommandLine commandLine = parser.parse(options, args);
+            for (final OptionHandler optionHandler : optionHandlers) {
+                if (!optionHandler.handle(commandLine, printer, options)) {
+                    return false;
+                }
+            }
+        } catch (final ParseException e) {
+            printer.printErrorMessage(e.getMessage());
+            printer.printHelp(options);
+            return false;
+        }
+        return true;
+    }
+
+    private boolean validateOptions(final Options options, final BootPrinter printer) {
+        final DeploymentType deploymentType = optionHandlerDeploymentType.getDeploymentType();
+
+        for (final OptionValidator validator : validators) {
+            final Optional<String> errorMessage = validator.validate(deploymentType);
+            if (errorMessage.isPresent()) {
+                printer.printErrorAndHelp(options, errorMessage.get());
+                return false;
+            }
+        }
+        return true;
+    }
+
+    // ///////////////////////////////////////////////////////////////////////////////////////
+    // Bootstrapping
+    // ///////////////////////////////////////////////////////////////////////////////////////
+
+    public final void bootstrap(final IsisBootstrapper bootstrapper) {
+
+        final DeploymentType deploymentType = optionHandlerDeploymentType.getDeploymentType();
+
+        this.globalInjector = createGuiceInjector(deploymentType, isisConfigurationBuilder, installerLookup, optionHandlers);
+
+        bootstrapper.bootstrap(globalInjector);
+    }
+
+    private Injector createGuiceInjector(final DeploymentType deploymentType, final IsisConfigurationBuilder isisConfigurationBuilder, final InstallerLookup installerLookup, final List<OptionHandler> optionHandlers) {
+        final IsisModule isisModule = new IsisModule(deploymentType, isisConfigurationBuilder, installerLookup);
+        isisModule.addConfigurationPrimers(optionHandlers);
+        isisModule.addViewerNames(optionHandlerViewer.getViewerNames());
+        return Guice.createInjector(isisModule);
+    }
+
+    // ///////////////////////////////////////////////////////////////////////////////////////
+    // Handlers & Validators
+    // ///////////////////////////////////////////////////////////////////////////////////////
+
+    public final List<OptionHandler> getOptionHandlers() {
+        return Collections.unmodifiableList(optionHandlers);
+    }
+
+    private OptionHandlerViewer addStandardOptionHandlersAndValidators(final InstallerLookup installerLookup) {
+
+        addOptionHandler(new OptionHandlerConfiguration());
+
+        OptionHandlerPersistor optionHandlerPersistor;
+        OptionHandlerViewer optionHandlerViewer;
+
+        addOptionHandler(optionHandlerPersistor = new OptionHandlerPersistor(installerLookup));
+        addOptionHandler(optionHandlerViewer = new OptionHandlerViewer(installerLookup));
+
+        addOptionHandler(new OptionHandlerReflector(installerLookup));
+        addOptionHandler(new OptionHandlerUserProfileStore(installerLookup));
+
+        addOptionHandler(new OptionHandlerFixture());
+        addOptionHandler(new OptionHandlerNoSplash());
+        addOptionHandler(new OptionHandlerAdditionalProperty());
+
+        addOptionHandler(new OptionHandlerDebug());
+        addOptionHandler(new OptionHandlerDiagnostics());
+        addOptionHandler(new OptionHandlerQuiet());
+        addOptionHandler(new OptionHandlerVerbose());
+
+        addOptionHandler(new OptionHandlerHelp());
+        addOptionHandler(new OptionHandlerVersion());
+
+        // validators
+        addValidator(new OptionValidatorForViewers(optionHandlerViewer));
+        addValidator(new OptionValidatorForPersistor(optionHandlerPersistor));
+
+        return optionHandlerViewer;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerAdditionalProperty.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerAdditionalProperty.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerAdditionalProperty.java
new file mode 100644
index 0000000..3e9ec6c
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerAdditionalProperty.java
@@ -0,0 +1,75 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.ADDITIONAL_PROPERTY;
+
+import java.util.List;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+
+public class OptionHandlerAdditionalProperty extends OptionHandlerAbstract {
+
+    private List<String> additionalProperties;
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Option option = OptionBuilder.withArgName("property=value").hasArg().withValueSeparator().withDescription("use value for given property").create(ADDITIONAL_PROPERTY);
+        option.setArgs(Option.UNLIMITED_VALUES);
+        options.addOption(option);
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        additionalProperties = getOptionValues(commandLine, Constants.ADDITIONAL_PROPERTY);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        addConfigurationProperties(isisConfigurationBuilder, additionalProperties);
+    }
+
+    private void addConfigurationProperties(final IsisConfigurationBuilder isisConfigurationBuilder, final List<String> additionalProperties) {
+        if (additionalProperties == null) {
+            return;
+        }
+        String key = null, value = null;
+        for (final String additionalProperty : additionalProperties) {
+            if (key == null) {
+                key = additionalProperty;
+            } else {
+                value = additionalProperty;
+                isisConfigurationBuilder.add(key, value);
+                key = null;
+            }
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerConfiguration.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerConfiguration.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerConfiguration.java
new file mode 100644
index 0000000..872d9a3
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerConfiguration.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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.CONFIGURATION_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.CONFIGURATION_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.commons.config.NotFoundPolicy;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+
+public class OptionHandlerConfiguration extends OptionHandlerAbstract {
+
+    private String configurationResource;
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Option option = OptionBuilder.withArgName("config file").hasArg().withLongOpt(CONFIGURATION_LONG_OPT).withDescription("read in configuration file (as well as isis.properties)").create(CONFIGURATION_OPT);
+        options.addOption(option);
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        configurationResource = commandLine.getOptionValue(Constants.CONFIGURATION_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        if (configurationResource == null) {
+            return;
+        }
+        isisConfigurationBuilder.addConfigurationResource(configurationResource, NotFoundPolicy.FAIL_FAST);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDebug.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDebug.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDebug.java
new file mode 100644
index 0000000..adc1cad
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDebug.java
@@ -0,0 +1,52 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.DEBUG_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+
+public class OptionHandlerDebug extends OptionHandlerAbstract {
+
+    public OptionHandlerDebug() {
+        super();
+    }
+
+    @Override
+    public void addOption(final Options options) {
+        options.addOption(DEBUG_OPT, false, "print debugging messages");
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        // TODO need to prime or otherwise set logging.
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDeploymentType.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDeploymentType.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDeploymentType.java
new file mode 100644
index 0000000..10cfc1d
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDeploymentType.java
@@ -0,0 +1,89 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.TYPE_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.TYPE_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.commons.config.NotFoundPolicy;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public abstract class OptionHandlerDeploymentType extends OptionHandlerAbstract {
+
+    private final DeploymentType defaultDeploymentType;
+    private final String types;
+
+    private DeploymentType deploymentType;
+
+    public OptionHandlerDeploymentType(final DeploymentType defaultDeploymentType, final String types) {
+        this.defaultDeploymentType = defaultDeploymentType;
+        this.types = types;
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Option option = OptionBuilder.withArgName("name").hasArg().withLongOpt(TYPE_LONG_OPT).withDescription("deployment type: " + types).create(TYPE_OPT);
+        options.addOption(option);
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        final String deploymentTypeName = commandLine.getOptionValue(Constants.TYPE_OPT);
+
+        if (deploymentTypeName == null) {
+            deploymentType = defaultDeploymentType;
+            return true;
+        }
+
+        deploymentType = DeploymentType.lookup(deploymentTypeName.toUpperCase());
+        if (deploymentType != null) {
+            return true;
+        }
+        bootPrinter.printErrorAndHelp(options, "Unable to determine deployment type");
+        return false;
+    }
+
+    /**
+     * Only populated after {@link #handle(CommandLine, BootPrinter, Options)}.
+     */
+    public DeploymentType getDeploymentType() {
+        return deploymentType;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        final String type = deploymentType.nameLowerCase();
+        isisConfigurationBuilder.addConfigurationResource(type + ".properties", NotFoundPolicy.CONTINUE);
+
+        isisConfigurationBuilder.add(SystemConstants.DEPLOYMENT_TYPE_KEY, deploymentType.name());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDeploymentTypeIsis.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDeploymentTypeIsis.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDeploymentTypeIsis.java
new file mode 100644
index 0000000..74f879d
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDeploymentTypeIsis.java
@@ -0,0 +1,38 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+
+public class OptionHandlerDeploymentTypeIsis extends OptionHandlerDeploymentType {
+
+    public static final String TYPE_EXPLORATION = DeploymentType.EXPLORATION.friendlyName();
+    public static final String TYPE_PROTOTYPE = DeploymentType.PROTOTYPE.friendlyName();
+    public static final String TYPE_SINGLE_USER = DeploymentType.SINGLE_USER.friendlyName();
+    public static final String TYPE_CLIENT = DeploymentType.CLIENT.friendlyName();
+    public static final String TYPE_SERVER_EXPLORATION = DeploymentType.SERVER_EXPLORATION.friendlyName();
+    public static final String TYPE_SERVER_PROTOTYPE = DeploymentType.SERVER_PROTOTYPE.friendlyName();
+    public static final String TYPE_SERVER = DeploymentType.SERVER.friendlyName();
+
+    public OptionHandlerDeploymentTypeIsis() {
+        super(DeploymentType.PROTOTYPE, TYPE_EXPLORATION + "; " + TYPE_PROTOTYPE + " (default); " + TYPE_SINGLE_USER + "; " + TYPE_CLIENT + "; " + TYPE_SERVER_EXPLORATION + "; " + TYPE_SERVER_PROTOTYPE + "; " + TYPE_SERVER);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDiagnostics.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDiagnostics.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDiagnostics.java
new file mode 100644
index 0000000..777a94f
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerDiagnostics.java
@@ -0,0 +1,57 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.DIAGNOSTICS_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+
+public class OptionHandlerDiagnostics extends OptionHandlerAbstract {
+
+    public OptionHandlerDiagnostics() {
+        super();
+    }
+
+    @Override
+    public void addOption(final Options options) {
+        options.addOption(DIAGNOSTICS_OPT, false, "print information that can be used diagnose or report problems");
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        if (commandLine.hasOption(Constants.DIAGNOSTICS_OPT)) {
+            bootPrinter.printDiagnostics();
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        // TODO need to do what, exactly?
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerFixture.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerFixture.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerFixture.java
new file mode 100644
index 0000000..63ae669
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerFixture.java
@@ -0,0 +1,62 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.FIXTURE_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.FIXTURE_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public class OptionHandlerFixture extends OptionHandlerAbstract {
+
+    private String fixture;
+
+    public OptionHandlerFixture() {
+        super();
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Option option = OptionBuilder.withArgName("class name").hasArg().withLongOpt(FIXTURE_LONG_OPT).withDescription("fully qualified fixture class").create(FIXTURE_OPT);
+        options.addOption(option);
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        fixture = commandLine.getOptionValue(Constants.FIXTURE_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        isisConfigurationBuilder.add(SystemConstants.FIXTURE_KEY, fixture);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerHelp.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerHelp.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerHelp.java
new file mode 100644
index 0000000..f72c106
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerHelp.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 org.apache.isis.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.HELP_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.HELP_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+
+public class OptionHandlerHelp extends OptionHandlerAbstract {
+
+    public OptionHandlerHelp() {
+        super();
+    }
+
+    @Override
+    public void addOption(final Options options) {
+        options.addOption(HELP_OPT, HELP_LONG_OPT, false, "show this help");
+
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        if (commandLine.hasOption(Constants.HELP_OPT)) {
+            bootPrinter.printHelp(options);
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        // nothing to do
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerNoSplash.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerNoSplash.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerNoSplash.java
new file mode 100644
index 0000000..121be65
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerNoSplash.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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.NO_SPLASH_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.NO_SPLASH_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public class OptionHandlerNoSplash extends OptionHandlerAbstract {
+
+    private boolean noSplash;
+
+    public OptionHandlerNoSplash() {
+        super();
+    }
+
+    @Override
+    public void addOption(final Options options) {
+        options.addOption(NO_SPLASH_OPT, NO_SPLASH_LONG_OPT, false, "don't show splash window");
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        noSplash = commandLine.hasOption(NO_SPLASH_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        if (noSplash) {
+            isisConfigurationBuilder.add(SystemConstants.NOSPLASH_KEY, "true");
+        }
+        // configurationBuilder.add(SystemConstants.NOSPLASH_KEY, noSplash ?
+        // "true" : "false");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerPassword.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerPassword.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerPassword.java
new file mode 100644
index 0000000..4b53dbc
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerPassword.java
@@ -0,0 +1,66 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.PASSWORD_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.PASSWORD_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public class OptionHandlerPassword extends OptionHandlerAbstract {
+
+    private String password;
+
+    public OptionHandlerPassword() {
+        super();
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Option option = OptionBuilder.withArgName("password").hasArg().withLongOpt(PASSWORD_LONG_OPT).withDescription("password to automatically log in with").create(PASSWORD_OPT);
+        options.addOption(option);
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        password = commandLine.getOptionValue(Constants.PASSWORD_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        isisConfigurationBuilder.add(SystemConstants.PASSWORD_KEY, password);
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerPersistor.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerPersistor.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerPersistor.java
new file mode 100644
index 0000000..5317bc2
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerPersistor.java
@@ -0,0 +1,71 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.OBJECT_PERSISTENCE_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.OBJECT_PERSISTENCE_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerRepository;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public class OptionHandlerPersistor extends OptionHandlerAbstract {
+
+    private final InstallerRepository installerRepository;
+    private String persistorName;
+
+    public OptionHandlerPersistor(final InstallerRepository installerRepository) {
+        this.installerRepository = installerRepository;
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Object[] objectPersistenceMechanisms = installerRepository.getInstallers(PersistenceMechanismInstaller.class);
+        final Option option = OptionBuilder.withArgName("name|class name").hasArg().withLongOpt(OBJECT_PERSISTENCE_LONG_OPT).withDescription("object persistence mechanism to use (ignored if type is prototype or client): " + availableInstallers(objectPersistenceMechanisms) + "; or class name")
+                .create(OBJECT_PERSISTENCE_OPT);
+        options.addOption(option);
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        persistorName = commandLine.getOptionValue(Constants.OBJECT_PERSISTENCE_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        isisConfigurationBuilder.add(SystemConstants.OBJECT_PERSISTOR_INSTALLER_KEY, persistorName);
+    }
+
+    public String getPersistorName() {
+        return persistorName;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerQuiet.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerQuiet.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerQuiet.java
new file mode 100644
index 0000000..6e372a7
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerQuiet.java
@@ -0,0 +1,52 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.QUIET_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+
+public class OptionHandlerQuiet extends OptionHandlerAbstract {
+
+    public OptionHandlerQuiet() {
+        super();
+    }
+
+    @Override
+    public void addOption(final Options options) {
+        options.addOption(QUIET_OPT, false, "print error messages only");
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        // TODO need to do what, exactly???
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerReflector.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerReflector.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerReflector.java
new file mode 100644
index 0000000..ef04956
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerReflector.java
@@ -0,0 +1,67 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.REFLECTOR_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.REFLECTOR_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.metamodel.specloader.ObjectReflectorInstaller;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerRepository;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public class OptionHandlerReflector extends OptionHandlerAbstract {
+
+    private final InstallerRepository installerRepository;
+    private String reflector;
+
+    public OptionHandlerReflector(final InstallerRepository installerRepository) {
+        this.installerRepository = installerRepository;
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Object[] reflectors = installerRepository.getInstallers(ObjectReflectorInstaller.class);
+        final Option option = OptionBuilder.withArgName("name|class name").hasArg().withLongOpt(REFLECTOR_LONG_OPT).withDescription("reflector to use (ignored if type is prototype or client): " + availableInstallers(reflectors) + "; or class name").create(REFLECTOR_OPT);
+        options.addOption(option);
+
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        reflector = commandLine.getOptionValue(Constants.REFLECTOR_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        isisConfigurationBuilder.add(SystemConstants.REFLECTOR_KEY, reflector);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUser.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUser.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUser.java
new file mode 100644
index 0000000..417018b
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUser.java
@@ -0,0 +1,67 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.USER_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.USER_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public class OptionHandlerUser extends OptionHandlerAbstract {
+
+    private String userName;
+
+    public OptionHandlerUser() {
+        super();
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Option option = OptionBuilder.withArgName("user name").hasArg().withLongOpt(USER_LONG_OPT).withDescription("user name to log in with").create(USER_OPT);
+        options.addOption(option);
+
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        userName = commandLine.getOptionValue(Constants.USER_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        isisConfigurationBuilder.add(SystemConstants.USER_KEY, userName);
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUserProfileStore.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUserProfileStore.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUserProfileStore.java
new file mode 100644
index 0000000..2ec7f34
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerUserProfileStore.java
@@ -0,0 +1,70 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.USER_PROFILE_STORE_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.USER_PROFILE_STORE_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerRepository;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+import org.apache.isis.runtimes.dflt.runtime.userprofile.UserProfileStoreInstaller;
+
+public class OptionHandlerUserProfileStore extends OptionHandlerAbstract {
+
+    private final InstallerRepository installerRepository;
+    private String userProfileStoreName;
+
+    public OptionHandlerUserProfileStore(final InstallerRepository installerRepository) {
+        this.installerRepository = installerRepository;
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Object[] persistenceMechanisms = installerRepository.getInstallers(UserProfileStoreInstaller.class);
+        final Option option = OptionBuilder.withArgName("name|class name").hasArg().withLongOpt(USER_PROFILE_STORE_LONG_OPT).withDescription("user profile store to use: " + availableInstallers(persistenceMechanisms) + "; or class name").create(USER_PROFILE_STORE_OPT);
+        options.addOption(option);
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        userProfileStoreName = commandLine.getOptionValue(Constants.USER_PROFILE_STORE_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        isisConfigurationBuilder.add(SystemConstants.PROFILE_PERSISTOR_INSTALLER_KEY, userProfileStoreName);
+    }
+
+    public String getUserProfileStoreName() {
+        return userProfileStoreName;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVerbose.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVerbose.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVerbose.java
new file mode 100644
index 0000000..d6df27f
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVerbose.java
@@ -0,0 +1,53 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.VERBOSE_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+
+public class OptionHandlerVerbose extends OptionHandlerAbstract {
+
+    public OptionHandlerVerbose() {
+        super();
+    }
+
+    @Override
+    public void addOption(final Options options) {
+        options.addOption(VERBOSE_OPT, false, "print information, warning and error messages");
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        // TODO need to do what, exactly???
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVersion.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVersion.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVersion.java
new file mode 100644
index 0000000..c238e21
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerVersion.java
@@ -0,0 +1,58 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.VERSION_OPT;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+
+public class OptionHandlerVersion extends OptionHandlerAbstract {
+
+    public OptionHandlerVersion() {
+        super();
+    }
+
+    @Override
+    public void addOption(final Options options) {
+        options.addOption(VERSION_OPT, false, "print version information");
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        if (commandLine.hasOption(Constants.VERSION_OPT)) {
+            bootPrinter.printVersion();
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        // nothing to do
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerViewer.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerViewer.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerViewer.java
new file mode 100644
index 0000000..93cfd21
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionHandlerViewer.java
@@ -0,0 +1,74 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.VIEWER_LONG_OPT;
+import static org.apache.isis.runtimes.dflt.runtime.runner.Constants.VIEWER_OPT;
+
+import java.util.List;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.commons.lang.ListUtils;
+import org.apache.isis.core.runtime.optionhandler.BootPrinter;
+import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.InstallerRepository;
+import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.IsisViewerInstaller;
+import org.apache.isis.runtimes.dflt.runtime.runner.Constants;
+import org.apache.isis.runtimes.dflt.runtime.system.SystemConstants;
+
+public class OptionHandlerViewer extends OptionHandlerAbstract {
+
+    private final InstallerRepository installerRepository;
+    private List<String> viewerNames;
+
+    public OptionHandlerViewer(final InstallerRepository installerRepository) {
+        this.installerRepository = installerRepository;
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Object[] viewers = installerRepository.getInstallers(IsisViewerInstaller.class);
+        final Option option = OptionBuilder.withArgName("name|class name").hasArg().withLongOpt(VIEWER_LONG_OPT).withDescription("viewer to use, or for server to listen on: " + availableInstallers(viewers) + "; or class name").create(VIEWER_OPT);
+        options.addOption(option);
+
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final Options options) {
+        viewerNames = getOptionValues(commandLine, Constants.VIEWER_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
+        isisConfigurationBuilder.add(SystemConstants.VIEWER_KEY, ListUtils.listToString(viewerNames));
+    }
+
+    public List<String> getViewerNames() {
+        return viewerNames;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidator.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidator.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidator.java
new file mode 100644
index 0000000..5920902
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidator.java
@@ -0,0 +1,28 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+
+import com.google.common.base.Optional;
+
+public interface OptionValidator {
+    public Optional<String> validate(final DeploymentType deploymentType);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForPersistor.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForPersistor.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForPersistor.java
new file mode 100644
index 0000000..750e7bf
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForPersistor.java
@@ -0,0 +1,45 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import org.apache.isis.core.commons.lang.StringUtils;
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+
+import com.google.common.base.Optional;
+
+public final class OptionValidatorForPersistor implements OptionValidator {
+    private final OptionHandlerPersistor optionHandlerPersistor;
+
+    public OptionValidatorForPersistor(final OptionHandlerPersistor optionHandlerPersistor) {
+        this.optionHandlerPersistor = optionHandlerPersistor;
+    }
+
+    @Override
+    public Optional<String> validate(final DeploymentType deploymentType) {
+        final String objectPersistorName = optionHandlerPersistor.getPersistorName();
+        final boolean fail = (!StringUtils.isNullOrEmpty(objectPersistorName)) && !deploymentType.canSpecifyObjectStore();
+        final String failMsg = String.format("Error: cannot specify an object store (persistor) for deployment type %s\n", deploymentType.name().toLowerCase());
+        return setIf(fail, failMsg);
+    }
+
+    private static Optional<String> setIf(final boolean fail, final String failMsg) {
+        return fail? Optional.of(failMsg): Optional.<String>absent();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForViewers.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForViewers.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForViewers.java
new file mode 100644
index 0000000..96c264a
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorForViewers.java
@@ -0,0 +1,48 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import java.util.List;
+
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+
+import com.google.common.base.Optional;
+
+public final class OptionValidatorForViewers implements OptionValidator {
+    private final OptionHandlerViewer optionHandlerViewer;
+
+    public OptionValidatorForViewers(final OptionHandlerViewer optionHandlerViewer) {
+        this.optionHandlerViewer = optionHandlerViewer;
+    }
+
+    @Override
+    public Optional<String> validate(final DeploymentType deploymentType) {
+        final List<String> viewerNames = optionHandlerViewer.getViewerNames();
+
+        final boolean fail = !deploymentType.canSpecifyViewers(viewerNames);
+        final String failMsg = String.format("Error: cannot specify %s viewer%s for deployment type %s\n", Strings.plural(viewerNames, "more than one", "any"), Strings.plural(viewerNames, "", "s"), deploymentType.nameLowerCase());
+        return setIf(fail, failMsg);
+    }
+    
+    private static Optional<String> setIf(final boolean fail, final String failMsg) {
+        return fail? Optional.of(failMsg): Optional.<String>absent();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorUserAndPasswordCombo.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorUserAndPasswordCombo.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorUserAndPasswordCombo.java
new file mode 100644
index 0000000..0a132b2
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/OptionValidatorUserAndPasswordCombo.java
@@ -0,0 +1,48 @@
+/*
+ *  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.runtimes.dflt.runtime.runner.opts;
+
+import org.apache.isis.runtimes.dflt.runtime.system.DeploymentType;
+
+import com.google.common.base.Optional;
+
+public final class OptionValidatorUserAndPasswordCombo implements OptionValidator {
+
+    private final OptionHandlerUser optionHandlerUser;
+    private final OptionHandlerPassword optionHandlerPassword;
+
+    public OptionValidatorUserAndPasswordCombo(final OptionHandlerUser optionHandlerUser, final OptionHandlerPassword optionHandlerPassword) {
+        this.optionHandlerPassword = optionHandlerPassword;
+        this.optionHandlerUser = optionHandlerUser;
+    }
+
+    @Override
+    public Optional<String> validate(final DeploymentType deploymentType) {
+        final String user = optionHandlerUser.getUserName();
+        final String password = optionHandlerPassword.getPassword();
+        final boolean ok = (password == null && user == null) || (password != null && user != null);
+        return setIf(!ok, "A user name must be specified with a password");
+    }
+    
+    private static Optional<String> setIf(final boolean fail, final String failMsg) {
+        return fail? Optional.of(failMsg): Optional.<String>absent();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/Strings.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/Strings.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/Strings.java
new file mode 100644
index 0000000..b0c4157
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/runner/opts/Strings.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.runtimes.dflt.runtime.runner.opts;
+
+import java.util.List;
+
+final class Strings {
+
+    private Strings() {
+    }
+
+    static String plural(final List<String> collection, final String moreThanOne, final String ifNone) {
+        return (collection.size() > 1 ? moreThanOne : ifNone);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/InitialisationException.java
----------------------------------------------------------------------
diff --git a/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/InitialisationException.java b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/InitialisationException.java
new file mode 100644
index 0000000..a9a5ca4
--- /dev/null
+++ b/framework/core/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/services/InitialisationException.java
@@ -0,0 +1,45 @@
+/*
+ *  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.runtimes.dflt.runtime.services;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+
+/**
+ * Indicates a problem initialising the Apache Isis framework.
+ */
+public class InitialisationException extends IsisException {
+    private static final long serialVersionUID = 1L;
+
+    public InitialisationException() {
+        super();
+    }
+
+    public InitialisationException(final String s) {
+        super(s);
+    }
+
+    public InitialisationException(final Throwable cause) {
+        super(cause);
+    }
+
+    public InitialisationException(final String msg, final Throwable cause) {
+        super(msg, cause);
+    }
+}