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 2014/10/04 14:31:40 UTC
[05/12] git commit: ISIS-913: removing IsisViewerInstaller and
EmbeddedWebServerInstaller APIs (and implementations)
ISIS-913: removing IsisViewerInstaller and EmbeddedWebServerInstaller APIs (and implementations)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/b5a05ac7
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/b5a05ac7
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/b5a05ac7
Branch: refs/heads/master
Commit: b5a05ac7d4b7daf34c716f852b508f27bd2053ae
Parents: a5de745
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Oct 3 18:11:24 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri Oct 3 18:11:24 2014 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/isis/Isis.java | 27 -
.../java/org/apache/isis/core/runtime/Isis.java | 60 --
.../isis/core/runtime/RuntimeBootstrapper.java | 131 -----
.../installerregistry/InstallerLookup.java | 18 +-
.../EmbeddedWebServerInstaller.java | 30 -
.../installerapi/IsisViewerInstaller.java | 31 -
.../IsisViewerInstallerAbstract.java | 63 --
.../core/runtime/runner/IsisInjectModule.java | 33 --
.../isis/core/runtime/runner/IsisRunner.java | 15 +-
.../runner/opts/OptionHandlerViewer.java | 74 ---
.../runner/opts/OptionValidatorForViewers.java | 48 --
.../isis/core/runtime/viewer/IsisViewer.java | 45 --
.../core/runtime/viewer/IsisViewerAbstract.java | 163 ------
.../core/runtime/viewer/IsisViewerNoop.java | 54 --
.../core/runtime/web/EmbeddedWebServer.java | 29 -
.../runtime/web/EmbeddedWebServerAbstract.java | 77 ---
.../core/runtime/web/EmbeddedWebViewer.java | 26 -
.../core/runtime/installer-registry.properties | 10 -
.../EmbeddedWebViewerRestfulObjects.java | 61 --
.../embedded/RestfulObjectsViewerInstaller.java | 52 --
.../embedded/jetty/EmbeddedWebServerJetty.java | 228 --------
.../jetty/JettyEmbeddedWebServerInstaller.java | 49 --
.../simpleapp/webapp/coverage-error.log | 585 +++++++++++++++++++
.../todoapp/webapp/coverage-error.log | 585 +++++++++++++++++++
24 files changed, 1173 insertions(+), 1321 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/Isis.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/Isis.java b/core/runtime/src/main/java/org/apache/isis/Isis.java
deleted file mode 100644
index ab83165..0000000
--- a/core/runtime/src/main/java/org/apache/isis/Isis.java
+++ /dev/null
@@ -1,27 +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;
-
-public class Isis {
-
- public static void main(final String[] args) {
- org.apache.isis.core.runtime.Isis.main(args);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/Isis.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/Isis.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/Isis.java
deleted file mode 100644
index 68d7bc3..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/Isis.java
+++ /dev/null
@@ -1,60 +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;
-
-import org.apache.isis.core.commons.config.IsisConfigurationBuilderDefault;
-import org.apache.isis.core.runtime.runner.IsisRunner;
-import org.apache.isis.core.runtime.runner.opts.OptionHandlerDeploymentTypeIsis;
-import org.apache.isis.core.runtime.runner.opts.OptionHandlerPassword;
-import org.apache.isis.core.runtime.runner.opts.OptionHandlerUser;
-import org.apache.isis.core.runtime.runner.opts.OptionValidatorUserAndPasswordCombo;
-import org.apache.isis.core.runtime.system.SystemConstants;
-
-public class Isis {
-
- static final String DEFAULT_EMBEDDED_WEBSERVER = SystemConstants.WEBSERVER_DEFAULT;
-
- public static void main(final String[] args) {
- new Isis().run(args);
- }
-
- private void run(final String[] args) {
- final IsisRunner runner = new IsisRunner(args, new OptionHandlerDeploymentTypeIsis());
- addOptionHandlersAndValidators(runner);
- if (!runner.parseAndValidate()) {
- return;
- }
- runner.setConfigurationBuilder(new IsisConfigurationBuilderDefault());
- runner.primeConfigurationWithCommandLineOptions();
- runner.loadInitialProperties();
- runner.bootstrap(new RuntimeBootstrapper());
- }
-
- private void addOptionHandlersAndValidators(final IsisRunner runner) {
- final OptionHandlerUser optionHandlerUser = new OptionHandlerUser();
- final OptionHandlerPassword optionHandlerPassword = new OptionHandlerPassword();
-
- runner.addOptionHandler(optionHandlerUser);
- runner.addOptionHandler(optionHandlerPassword);
-
- runner.addValidator(new OptionValidatorUserAndPasswordCombo(optionHandlerUser, optionHandlerPassword));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/RuntimeBootstrapper.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/RuntimeBootstrapper.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/RuntimeBootstrapper.java
deleted file mode 100644
index 3cf1115..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/RuntimeBootstrapper.java
+++ /dev/null
@@ -1,131 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.inject.Injector;
-
-import org.apache.isis.core.commons.lang.RunnableExtensions;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
-import org.apache.isis.core.runtime.installerregistry.installerapi.EmbeddedWebServerInstaller;
-import org.apache.isis.core.runtime.runner.IsisBootstrapper;
-import org.apache.isis.core.runtime.runner.IsisInjectModule.ViewerList;
-import org.apache.isis.core.runtime.system.IsisSystem;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.viewer.IsisViewer;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-import org.apache.isis.core.runtime.web.EmbeddedWebServer;
-
-final class RuntimeBootstrapper implements IsisBootstrapper {
-
- @Override
- public void bootstrap(final Injector injector) {
-
- bootstrapSystem(injector);
- bootstrapViewers(injector);
- }
-
- private void bootstrapSystem(final Injector injector) {
-
- // sufficient just to look it up
- @SuppressWarnings("unused")
- final IsisSystem system = injector.getInstance(IsisSystem.class);
- }
-
- private void bootstrapViewers(final Injector injector) {
- final List<IsisViewer> viewers = lookupViewers(injector);
-
- // split viewers into web viewers and non-web viewers
- final List<IsisViewer> webViewers = findWebViewers(viewers);
- final List<IsisViewer> nonWebViewers = findNonWebViewers(viewers, webViewers);
-
- startNonWebViewers(nonWebViewers);
- startWebViewers(injector, webViewers);
- }
-
- private List<IsisViewer> lookupViewers(final Injector injector) {
- final List<IsisViewer> viewers = injector.getInstance(ViewerList.class).getViewers();
-
- // looking up viewers may have merged in some further config files,
- // so update the NOContext global
- // REVIEW: would rather inject this
- final InstallerLookup installerLookup = injector.getInstance(InstallerLookup.class);
- IsisContext.setConfiguration(installerLookup.getConfiguration());
-
- return viewers;
- }
-
- private List<IsisViewer> findWebViewers(final List<IsisViewer> viewers) {
- return Lists.newArrayList(
- Iterables.filter(viewers, new Predicate<IsisViewer>() {
- @Override
- public boolean apply(final IsisViewer viewer) {
- return viewer.getWebAppSpecification() != null;
- }
- }));
- }
-
- private List<IsisViewer> findNonWebViewers(final List<IsisViewer> viewers, final List<IsisViewer> webViewers) {
- final List<IsisViewer> nonWebViewers = new ArrayList<IsisViewer>(viewers);
- nonWebViewers.removeAll(webViewers);
- return nonWebViewers;
- }
-
- /**
- * Starts each (non web) {@link IsisViewer viewer} in its own thread.
- */
- private void startNonWebViewers(final List<IsisViewer> viewers) {
- for (final IsisViewer viewer : viewers) {
- final Runnable target = new Runnable() {
- @Override
- public void run() {
- viewer.init();
- }
- };
- RunnableExtensions.startThread(target, "Viewer");
- }
- }
-
- /**
- * Starts all the web {@link IsisViewer viewer}s in an instance of an
- * {@link EmbeddedWebServer}.
- */
- private void startWebViewers(final Injector injector, final List<IsisViewer> webViewers) {
- if (webViewers.size() == 0) {
- return;
- }
-
- final InstallerLookup installerLookup = injector.getInstance(InstallerLookup.class);
-
- // TODO: we could potentially offer pluggability here
- final EmbeddedWebServerInstaller webServerInstaller = installerLookup.embeddedWebServerInstaller(Isis.DEFAULT_EMBEDDED_WEBSERVER);
- final EmbeddedWebServer embeddedWebServer = webServerInstaller.createEmbeddedWebServer();
- for (final IsisViewer viewer : webViewers) {
- final WebAppSpecification webContainerRequirements = viewer.getWebAppSpecification();
- embeddedWebServer.addWebAppSpecification(webContainerRequirements);
- }
- embeddedWebServer.init();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/InstallerLookup.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/InstallerLookup.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/InstallerLookup.java
index 49a5275..7cb8b42 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/InstallerLookup.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/InstallerLookup.java
@@ -54,8 +54,6 @@ import org.apache.isis.core.runtime.authentication.AuthenticationManagerInstalle
import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
import org.apache.isis.core.runtime.fixtures.FixturesInstaller;
import org.apache.isis.core.runtime.imageloader.TemplateImageLoaderInstaller;
-import org.apache.isis.core.runtime.installerregistry.installerapi.EmbeddedWebServerInstaller;
-import org.apache.isis.core.runtime.installerregistry.installerapi.IsisViewerInstaller;
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;
@@ -65,9 +63,7 @@ import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInj
import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjectorAware;
import org.apache.isis.core.runtime.userprofile.UserProfileStoreInstaller;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.CoreMatchers.*;
/**
* The installers correspond more-or-less to the configurable top-level
@@ -242,18 +238,6 @@ public class InstallerLookup implements InstallerRepository, ApplicationScopedCo
return getInstaller(UserProfileStoreInstaller.class, requested, SystemConstants.USER_PROFILE_STORE_KEY, profileStoreDefault);
}
- public EmbeddedWebServerInstaller embeddedWebServerInstaller(final String requested) {
- return getInstaller(EmbeddedWebServerInstaller.class, requested, SystemConstants.WEBSERVER_KEY, SystemConstants.WEBSERVER_DEFAULT);
- }
-
- public IsisViewerInstaller viewerInstaller(final String name) {
- final IsisViewerInstaller installer = getInstaller(IsisViewerInstaller.class, name);
- if (installer == null) {
- throw new IsisException("No viewer installer of type " + name);
- }
- return installer;
- }
-
public ServicesInstaller servicesInstaller(final String requestedImplementationName) {
return getInstaller(ServicesInstaller.class, requestedImplementationName, SystemConstants.SERVICES_INSTALLER_KEY, SystemConstants.SERVICES_INSTALLER_DEFAULT);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/EmbeddedWebServerInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/EmbeddedWebServerInstaller.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/EmbeddedWebServerInstaller.java
deleted file mode 100644
index 22ee2b4..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/EmbeddedWebServerInstaller.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.installerregistry.installerapi;
-
-import org.apache.isis.core.commons.components.Installer;
-import org.apache.isis.core.runtime.web.EmbeddedWebServer;
-
-public interface EmbeddedWebServerInstaller extends Installer {
-
- static String TYPE = "embedded-web-server";
-
- EmbeddedWebServer createEmbeddedWebServer();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/IsisViewerInstaller.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/IsisViewerInstaller.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/IsisViewerInstaller.java
deleted file mode 100644
index 16e7702..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/IsisViewerInstaller.java
+++ /dev/null
@@ -1,31 +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.installerregistry.installerapi;
-
-import org.apache.isis.core.commons.components.Installer;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookupAware;
-import org.apache.isis.core.runtime.viewer.IsisViewer;
-
-public interface IsisViewerInstaller extends Installer, InstallerLookupAware {
-
- static String TYPE = "viewer";
-
- IsisViewer createViewer();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/IsisViewerInstallerAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/IsisViewerInstallerAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/IsisViewerInstallerAbstract.java
deleted file mode 100644
index 43bf24a..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/installerregistry/installerapi/IsisViewerInstallerAbstract.java
+++ /dev/null
@@ -1,63 +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.installerregistry.installerapi;
-
-import java.util.List;
-
-import org.apache.isis.core.commons.config.InstallerAbstract;
-import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
-import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjector;
-import org.apache.isis.core.runtime.viewer.IsisViewer;
-
-public abstract class IsisViewerInstallerAbstract extends InstallerAbstract implements IsisViewerInstaller {
-
- private SystemDependencyInjector installerLookup;
-
- public IsisViewerInstallerAbstract(final String name) {
- super(IsisViewerInstaller.TYPE, name);
- }
-
- @Override
- public IsisViewer createViewer() {
- return injectDependenciesInto(doCreateViewer());
- }
-
- /**
- * Subclasses should override (or else override {@link #createViewer()} if
- * they need to do anything more elaborate.
- */
- protected IsisViewer doCreateViewer() {
- return null;
- }
-
- protected <T> T injectDependenciesInto(final T candidate) {
- return installerLookup.injectDependenciesInto(candidate);
- }
-
- @Override
- public void setInstallerLookup(final InstallerLookup installerLookup) {
- this.installerLookup = installerLookup;
- }
-
- @Override
- public List<Class<?>> getTypes() {
- return listOf(IsisViewer.class);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisInjectModule.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisInjectModule.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisInjectModule.java
index 90e146b..5640ac5 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisInjectModule.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisInjectModule.java
@@ -19,7 +19,6 @@
package org.apache.isis.core.runtime.runner;
-import java.util.Collections;
import java.util.List;
import com.google.common.collect.Lists;
import com.google.inject.AbstractModule;
@@ -29,12 +28,10 @@ import com.google.inject.Singleton;
import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
import org.apache.isis.core.commons.config.IsisConfigurationBuilderDefault;
import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
-import org.apache.isis.core.runtime.installerregistry.installerapi.IsisViewerInstaller;
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.systemusinginstallers.IsisSystemThatUsesInstallersFactory;
-import org.apache.isis.core.runtime.viewer.IsisViewer;
public class IsisInjectModule extends AbstractModule {
@@ -137,34 +134,4 @@ public class IsisInjectModule extends AbstractModule {
return system;
}
- public static class ViewerList {
- private final List<IsisViewer> viewers;
-
- public ViewerList(final List<IsisViewer> viewers) {
- this.viewers = Collections.unmodifiableList(viewers);
- }
-
- public List<IsisViewer> getViewers() {
- return viewers;
- }
- }
-
- @SuppressWarnings("unused")
- @Provides
- @Inject
- @Singleton
- private ViewerList lookupViewers(final InstallerLookup installerLookup, final DeploymentType deploymentType) {
-
- final List<String> viewersToStart = Lists.newArrayList(viewerNames);
- deploymentType.addDefaultViewer(viewersToStart);
-
- final List<IsisViewer> viewers = Lists.newArrayList();
- for (final String requestedViewer : viewersToStart) {
- final IsisViewerInstaller viewerInstaller = installerLookup.viewerInstaller(requestedViewer);
- final IsisViewer viewer = viewerInstaller.createViewer();
- viewers.add(viewer);
- }
- return new ViewerList(viewers);
- }
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisRunner.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisRunner.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisRunner.java
index 2336d96..ab5d495 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisRunner.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/IsisRunner.java
@@ -51,8 +51,6 @@ public class IsisRunner {
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;
@@ -71,7 +69,7 @@ public class IsisRunner {
loggingConfigurer.configureLogging(determineConfigDirectory(), args);
this.installerLookup = new InstallerLookup();
- this.optionHandlerViewer = addStandardOptionHandlersAndValidators(this.installerLookup);
+ addStandardOptionHandlersAndValidators(this.installerLookup);
}
// REVIEW is this something that IsisConfigBuilder should know about?
@@ -212,7 +210,6 @@ public class IsisRunner {
private Injector createGuiceInjector(final DeploymentType deploymentType, final IsisConfigurationBuilder isisConfigurationBuilder, final InstallerLookup installerLookup, final List<OptionHandler> optionHandlers) {
final IsisInjectModule isisModule = new IsisInjectModule(deploymentType, isisConfigurationBuilder, installerLookup);
- isisModule.addViewerNames(optionHandlerViewer.getViewerNames());
return Guice.createInjector(isisModule);
}
@@ -224,14 +221,11 @@ public class IsisRunner {
return Collections.unmodifiableList(optionHandlers);
}
- private OptionHandlerViewer addStandardOptionHandlersAndValidators(final InstallerLookup installerLookup) {
+ private void addStandardOptionHandlersAndValidators(final InstallerLookup installerLookup) {
addOptionHandler(optionHandlerDeploymentType);
addOptionHandler(new OptionHandlerConfiguration());
- OptionHandlerViewer optionHandlerViewer;
-
addOptionHandler(new OptionHandlerPersistor(installerLookup));
- addOptionHandler(optionHandlerViewer = new OptionHandlerViewer(installerLookup));
addOptionHandler(new OptionHandlerReflector(installerLookup));
addOptionHandler(new OptionHandlerUserProfileStore(installerLookup));
@@ -249,11 +243,6 @@ public class IsisRunner {
addOptionHandler(new OptionHandlerHelp());
addOptionHandler(new OptionHandlerVersion());
-
- // validators
- addValidator(new OptionValidatorForViewers(optionHandlerViewer));
-
- return optionHandlerViewer;
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionHandlerViewer.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionHandlerViewer.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionHandlerViewer.java
deleted file mode 100644
index 0fef2b9..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionHandlerViewer.java
+++ /dev/null
@@ -1,74 +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.runner.opts;
-
-import static org.apache.isis.core.runtime.runner.Constants.VIEWER_LONG_OPT;
-import static org.apache.isis.core.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.ListExtensions;
-import org.apache.isis.core.runtime.installerregistry.InstallerRepository;
-import org.apache.isis.core.runtime.installerregistry.installerapi.IsisViewerInstaller;
-import org.apache.isis.core.runtime.optionhandler.BootPrinter;
-import org.apache.isis.core.runtime.optionhandler.OptionHandlerAbstract;
-import org.apache.isis.core.runtime.runner.Constants;
-import org.apache.isis.core.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, ListExtensions.listToString(viewerNames));
- }
-
- public List<String> getViewerNames() {
- return viewerNames;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionValidatorForViewers.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionValidatorForViewers.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionValidatorForViewers.java
deleted file mode 100644
index 0fc92fc..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionValidatorForViewers.java
+++ /dev/null
@@ -1,48 +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.runner.opts;
-
-import java.util.List;
-
-import com.google.common.base.Optional;
-
-import org.apache.isis.core.runtime.system.DeploymentType;
-
-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/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewer.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewer.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewer.java
deleted file mode 100644
index 1fe86af..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewer.java
+++ /dev/null
@@ -1,45 +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.viewer;
-
-import org.apache.isis.core.commons.components.ApplicationScopedComponent;
-import org.apache.isis.core.commons.config.IsisConfigurationBuilderAware;
-import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjectorAware;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-
-/**
- * Defines an mechanism for manipulating the domain objects.
- *
- * <p>
- * The mechanism may be realized as a user interface (for example the DnD viewer
- * or HTML viewer) but might also be an abstract 'remoting' viewer of sockets or
- * HTTP servlet requests.
- */
-public interface IsisViewer extends ApplicationScopedComponent, SystemDependencyInjectorAware, IsisConfigurationBuilderAware {
-
- /**
- * Provide requirement for running a viewer from within an embedded web
- * container.
- *
- * <p>
- * Returns <tt>null</tt> if does not run within a web container.
- */
- WebAppSpecification getWebAppSpecification();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewerAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewerAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewerAbstract.java
deleted file mode 100644
index 976f04b..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewerAbstract.java
+++ /dev/null
@@ -1,163 +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.viewer;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-
-import org.apache.isis.applib.fixtures.LogonFixture;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
-import org.apache.isis.core.commons.config.IsisConfigurationBuilderAware;
-import org.apache.isis.core.commons.ensure.Ensure;
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.IsisSystem;
-import org.apache.isis.core.runtime.system.SystemConstants;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjector;
-import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjectorAware;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-
-public abstract class IsisViewerAbstract implements IsisViewer {
-
- /**
- * @see {@link #setDeploymentType(DeploymentType)}
- */
- private DeploymentType deploymentType;
-
- private SystemDependencyInjector systemDependencyInjector;
- private IsisConfigurationBuilder isisConfigurationBuilder;
-
- /**
- * Optionally set, see
- * {@link #setAuthenticationRequestViaArgs(AuthenticationRequest)}
- */
- private AuthenticationRequest authenticationRequestViaArgs;
-
- // ////////////////////////////////////////////////////////////////
- // Settings
- // ////////////////////////////////////////////////////////////////
-
- @Override
- public void init() {
-
- ensureDependenciesInjected();
-
- final IsisConfiguration configuration = isisConfigurationBuilder.getConfiguration();
- deploymentType = DeploymentType.lookup(configuration.getString(SystemConstants.DEPLOYMENT_TYPE_KEY));
-
- final String user = configuration.getString(SystemConstants.USER_KEY);
- final String password = configuration.getString(SystemConstants.PASSWORD_KEY);
-
- if (user != null) {
- authenticationRequestViaArgs = new AuthenticationRequestPassword(user, password);
- }
- }
-
- @Override
- public void shutdown() {
- // does nothing
- }
-
- // ////////////////////////////////////////////////////////////////
- // Settings
- // ////////////////////////////////////////////////////////////////
-
- public final DeploymentType getDeploymentType() {
- return deploymentType;
- }
-
- /**
- * Default implementation to return null, indicating that this viewer should
- * not be run in a web container.
- */
- @Override
- public WebAppSpecification getWebAppSpecification() {
- return null;
- }
-
- public AuthenticationRequest getAuthenticationRequestViaArgs() {
- return authenticationRequestViaArgs;
- }
-
- protected void clearAuthenticationRequestViaArgs() {
- authenticationRequestViaArgs = null;
- }
-
- // ////////////////////////////////////////////////////////////////
- // Post-bootstrapping
- // ////////////////////////////////////////////////////////////////
-
- public LogonFixture getLogonFixture() {
- return null;
- }
-
- // ////////////////////////////////////////////////////////////////
- // Dependencies (injected)
- // ////////////////////////////////////////////////////////////////
-
- protected void ensureDependenciesInjected() {
- Ensure.ensureThatState(systemDependencyInjector, is(not(nullValue())));
- Ensure.ensureThatState(isisConfigurationBuilder, is(not(nullValue())));
- }
-
- /**
- * Injected by virtue of being {@link SystemDependencyInjectorAware}.
- */
- @Override
- public void setSystemDependencyInjector(final SystemDependencyInjector dependencyInjector) {
- this.systemDependencyInjector = dependencyInjector;
- }
-
- protected IsisConfigurationBuilder getConfigurationBuilder() {
- return isisConfigurationBuilder;
- }
-
- /**
- * Injected by virtue of being {@link IsisConfigurationBuilderAware}.
- */
- @Override
- public void setConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder) {
- this.isisConfigurationBuilder = isisConfigurationBuilder;
- }
-
- // ////////////////////////////////////////////////////////////////
- // Dependencies (from context)
- // ////////////////////////////////////////////////////////////////
-
- /**
- * Available after {@link IsisSystem} has been bootstrapped.
- */
- protected static IsisConfiguration getConfiguration() {
- return IsisContext.getConfiguration();
- }
-
- /**
- * Available after {@link IsisSystem} has been bootstrapped.
- */
- public static AuthenticationManager getAuthenticationManager() {
- return IsisContext.getAuthenticationManager();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewerNoop.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewerNoop.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewerNoop.java
deleted file mode 100644
index 638020f..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/viewer/IsisViewerNoop.java
+++ /dev/null
@@ -1,54 +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.viewer;
-
-import org.apache.isis.core.commons.components.Noop;
-import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
-import org.apache.isis.core.runtime.systemdependencyinjector.SystemDependencyInjector;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-
-public class IsisViewerNoop implements IsisViewer, Noop {
-
- @Override
- public void init() {
- }
-
- @Override
- public void shutdown() {
- }
-
- @Override
- public void setConfigurationBuilder(final IsisConfigurationBuilder configurationLoader) {
- }
-
- @Override
- public void setSystemDependencyInjector(final SystemDependencyInjector dependencyInjector) {
- }
-
- public boolean bootstrapsSystem() {
- return false;
- }
-
- @Override
- public WebAppSpecification getWebAppSpecification() {
- return null;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebServer.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebServer.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebServer.java
deleted file mode 100644
index 3b99df9..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebServer.java
+++ /dev/null
@@ -1,29 +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.web;
-
-import org.apache.isis.core.commons.components.ApplicationScopedComponent;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-
-public interface EmbeddedWebServer extends ApplicationScopedComponent {
-
- void addWebAppSpecification(WebAppSpecification webContainerRequirements);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebServerAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebServerAbstract.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebServerAbstract.java
deleted file mode 100644
index ce165fb..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebServerAbstract.java
+++ /dev/null
@@ -1,77 +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.web;
-
-import java.util.ArrayList;
-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.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-
-public abstract class EmbeddedWebServerAbstract implements EmbeddedWebServer {
-
- @SuppressWarnings("unused")
- private final static Logger LOG = LoggerFactory.getLogger(EmbeddedWebServerAbstract.class);
-
- private final List<WebAppSpecification> specifications = new ArrayList<WebAppSpecification>();
-
- // ///////////////////////////////////////////////////////
- // WebApp Specifications
- // ///////////////////////////////////////////////////////
-
- /**
- * Must be called prior to {@link #init() initialization}.
- */
- @Override
- public void addWebAppSpecification(final WebAppSpecification specification) {
- specifications.add(specification);
- }
-
- protected List<WebAppSpecification> getSpecifications() {
- return specifications;
- }
-
- // ///////////////////////////////////////////////////////
- // init, shutdown
- // ///////////////////////////////////////////////////////
-
- @Override
- public void init() {
- // does nothing
- }
-
- @Override
- public void shutdown() {
- // does nothing
- }
-
- // ///////////////////////////////////////////////////////
- // Dependencies (from context)
- // ///////////////////////////////////////////////////////
-
- protected static IsisConfiguration getConfiguration() {
- return IsisContext.getConfiguration();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebViewer.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebViewer.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebViewer.java
deleted file mode 100644
index 96b08a5..0000000
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/web/EmbeddedWebViewer.java
+++ /dev/null
@@ -1,26 +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.web;
-
-import org.apache.isis.core.runtime.viewer.IsisViewerAbstract;
-
-public abstract class EmbeddedWebViewer extends IsisViewerAbstract {
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties b/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
index 6360209..104f6d6 100644
--- a/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
+++ b/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
@@ -35,13 +35,6 @@ org.apache.isis.security.shiro.authorization.ShiroAuthorizationManagerInstaller
############################################################
-# VIEWERS
-############################################################
-
-org.apache.isis.viewer.restfulobjects.viewer.embedded.RestfulObjectsViewerInstaller # "restfulobjects"
-
-
-############################################################
# PROGRAMMING MODELS
############################################################
@@ -75,9 +68,6 @@ org.apache.isis.core.profilestore.InMemoryUserProfileStoreInstaller # "in-memory
# reflector decorators
org.apache.isis.core.runtime.transaction.facetdecorator.standard.TransactionFacetDecoratorInstaller # "transaction"
-# embedded web server
-org.apache.isis.core.webserver.embedded.jetty.JettyEmbeddedWebServerInstaller # "jetty"
-
####### END #########
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/embedded/EmbeddedWebViewerRestfulObjects.java
----------------------------------------------------------------------
diff --git a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/embedded/EmbeddedWebViewerRestfulObjects.java b/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/embedded/EmbeddedWebViewerRestfulObjects.java
deleted file mode 100644
index e0fecbb..0000000
--- a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/embedded/EmbeddedWebViewerRestfulObjects.java
+++ /dev/null
@@ -1,61 +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.viewer.restfulobjects.server.embedded;
-
-import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher;
-import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;
-
-import org.apache.isis.core.commons.lang.MapUtil;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-import org.apache.isis.core.runtime.web.EmbeddedWebViewer;
-import org.apache.isis.core.webapp.IsisSessionFilter;
-import org.apache.isis.core.webapp.IsisWebAppBootstrapper;
-import org.apache.isis.core.webapp.content.ResourceCachingFilter;
-import org.apache.isis.core.webapp.content.ResourceServlet;
-import org.apache.isis.viewer.restfulobjects.server.RestfulObjectsApplication;
-import org.apache.isis.viewer.restfulobjects.server.authentication.AuthenticationSessionStrategyTrusted;
-
-final class EmbeddedWebViewerRestfulObjects extends EmbeddedWebViewer {
- @Override
- public WebAppSpecification getWebAppSpecification() {
- final WebAppSpecification webAppSpec = new WebAppSpecification();
-
- webAppSpec.addServletContextListener(IsisWebAppBootstrapper.class);
-
- webAppSpec.addContextParams("isis.viewers", "restfulobjects");
-
- webAppSpec.addContextParams(RestfulObjectsViewerInstaller.JAVAX_WS_RS_APPLICATION, RestfulObjectsApplication.class.getName());
-
- webAppSpec.addFilterSpecification(IsisSessionFilter.class,
- MapUtil.<String,String>asMap(
- IsisSessionFilter.AUTHENTICATION_SESSION_STRATEGY_KEY, AuthenticationSessionStrategyTrusted.class.getName(),
- IsisSessionFilter.WHEN_NO_SESSION_KEY, IsisSessionFilter.WhenNoSession.CONTINUE.name().toLowerCase()),
- RestfulObjectsViewerInstaller.EVERYTHING);
-
- webAppSpec.addFilterSpecification(ResourceCachingFilter.class, RestfulObjectsViewerInstaller.STATIC_CONTENT);
- webAppSpec.addServletSpecification(ResourceServlet.class, RestfulObjectsViewerInstaller.STATIC_CONTENT);
-
-
- webAppSpec.addServletContextListener(ResteasyBootstrap.class);
- webAppSpec.addServletSpecification(HttpServletDispatcher.class, RestfulObjectsViewerInstaller.ROOT);
-
-
- return webAppSpec;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/embedded/RestfulObjectsViewerInstaller.java
----------------------------------------------------------------------
diff --git a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/embedded/RestfulObjectsViewerInstaller.java b/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/embedded/RestfulObjectsViewerInstaller.java
deleted file mode 100644
index da3f6a7..0000000
--- a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/embedded/RestfulObjectsViewerInstaller.java
+++ /dev/null
@@ -1,52 +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.viewer.restfulobjects.server.embedded;
-
-import org.apache.isis.Isis;
-import org.apache.isis.core.runtime.installerregistry.installerapi.IsisViewerInstallerAbstract;
-import org.apache.isis.core.runtime.viewer.IsisViewer;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-
-/**
- * Convenience implementation of a {@link IsisViewer} providing the ability to
- * configured for the JSON viewer from the {@link Isis command line} using
- * <tt>--viewer restful</tt> command line option.
- *
- * <p>
- * In a production deployment the configuration represented by the
- * {@link WebAppSpecification} would be specified in the <tt>web.xml<tt> file.
- */
-public class RestfulObjectsViewerInstaller extends IsisViewerInstallerAbstract {
-
- static final String JAVAX_WS_RS_APPLICATION = "javax.ws.rs.Application";
-
- protected static final String EVERYTHING = "*";
- protected static final String ROOT = "/";
- protected static final String[] STATIC_CONTENT = new String[] { "*.js", "*.gif", "*.png", "*.html" };
-
- public RestfulObjectsViewerInstaller() {
- super("restfulobjects");
- }
-
- @Override
- protected IsisViewer doCreateViewer() {
- return new EmbeddedWebViewerRestfulObjects();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/webserver/src/main/java/org/apache/isis/core/webserver/embedded/jetty/EmbeddedWebServerJetty.java
----------------------------------------------------------------------
diff --git a/core/webserver/src/main/java/org/apache/isis/core/webserver/embedded/jetty/EmbeddedWebServerJetty.java b/core/webserver/src/main/java/org/apache/isis/core/webserver/embedded/jetty/EmbeddedWebServerJetty.java
deleted file mode 100644
index 3e991ad..0000000
--- a/core/webserver/src/main/java/org/apache/isis/core/webserver/embedded/jetty/EmbeddedWebServerJetty.java
+++ /dev/null
@@ -1,228 +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.webserver.embedded.jetty;
-
-import java.util.List;
-
-import javax.servlet.ServletContextListener;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.NCSARequestLog;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.ContextHandler;
-import org.mortbay.jetty.handler.HandlerList;
-import org.mortbay.jetty.handler.RequestLogHandler;
-import org.mortbay.jetty.handler.ResourceHandler;
-import org.mortbay.jetty.servlet.FilterHolder;
-import org.mortbay.jetty.servlet.FilterMapping;
-import org.mortbay.jetty.servlet.ServletHandler;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.servlet.ServletMapping;
-import org.mortbay.jetty.servlet.SessionHandler;
-
-import org.apache.isis.core.commons.factory.InstanceUtil;
-import org.apache.isis.core.runtime.viewer.web.FilterSpecification;
-import org.apache.isis.core.runtime.viewer.web.ServletSpecification;
-import org.apache.isis.core.runtime.viewer.web.WebAppSpecification;
-import org.apache.isis.core.runtime.web.EmbeddedWebServerAbstract;
-import org.apache.isis.core.webserver.WebServerConstants;
-import org.apache.isis.core.webserver.WebServerException;
-
-public class EmbeddedWebServerJetty extends EmbeddedWebServerAbstract {
- private final static Logger LOG = LoggerFactory.getLogger(EmbeddedWebServerJetty.class);
-
- // ///////////////////////////////////////////////////////
- // init, shutdown
- // ///////////////////////////////////////////////////////
-
- @Override
- public void init() {
- super.init();
-
- final HandlerList handlers = createHandlers();
-
- final ContextHandler contextHandler = createContextHandler(handlers);
-
- startServer(contextHandler);
- }
-
- private HandlerList createHandlers() {
- final HandlerList handlers = new HandlerList();
-
- addResourcesAndWelcomeFiles(handlers);
-
- final ServletHandler servletHandler = new ServletHandler();
- addServletsAndFilters(servletHandler);
-
- final SessionHandler sessionHandler = new SessionHandler();
- sessionHandler.setHandler(servletHandler);
- handlers.addHandler(sessionHandler);
-
- // commenting out; this grabs '/' but we might want to use it ourselves,
- // instead?
- // handlers.addHandler(new DefaultHandler());
-
- // TODO use properties to set up
- final RequestLogHandler requestLogHandler = new RequestLogHandler();
- handlers.addHandler(requestLogHandler);
- final NCSARequestLog requestLog = new NCSARequestLog("./logs/jetty-yyyy_mm_dd.request.log");
- requestLog.setRetainDays(90);
- requestLog.setAppend(true);
- requestLog.setExtended(false);
- requestLog.setLogTimeZone("GMT");
- requestLogHandler.setRequestLog(requestLog);
-
- return handlers;
- }
-
- /**
- * TODO: the welcome files don't seem to be picked up.
- *
- * <p>
- * not sure if meant to add welcome files here or at the context handler
- * level, in fact, doesn't seem to work even when register in both...
- *
- * @see #setWelcomeFiles(ContextHandler)
- */
- private void addResourcesAndWelcomeFiles(final HandlerList handlers) {
- for (final WebAppSpecification specification : getSpecifications()) {
- final List<String> files = specification.getWelcomeFiles();
- final String[] welcomeFiles = files.toArray(new String[files.size()]);
- for (final String resourcePath : specification.getResourcePaths()) {
- final ResourceHandler resourceHandler = new ResourceHandler();
- resourceHandler.setResourceBase(resourcePath);
- resourceHandler.setWelcomeFiles(welcomeFiles);
- handlers.addHandler(resourceHandler);
- }
- }
- }
-
- private void addServletsAndFilters(final ServletHandler servletHandler) {
- for (final WebAppSpecification requirement : getSpecifications()) {
- addServletMappings(servletHandler, requirement);
- addFilterMappings(servletHandler, requirement);
- }
- }
-
- private void addServletMappings(final ServletHandler servletHandler, final WebAppSpecification webAppSpec) {
- for (final ServletSpecification servletSpec : webAppSpec.getServletSpecifications()) {
-
- final ServletHolder servletHolder = new ServletHolder(servletSpec.getServletClass());
- servletHolder.setInitParameters(servletSpec.getInitParams());
- servletHandler.addServlet(servletHolder);
-
- final ServletMapping servletMapping = new ServletMapping();
- servletMapping.setServletName(servletHolder.getName());
- servletMapping.setPathSpecs(servletSpec.getPathSpecs().toArray(new String[] {}));
-
- servletHandler.addServletMapping(servletMapping);
- }
- }
-
- private void addFilterMappings(final ServletHandler servletHandler, final WebAppSpecification webAppSpec) {
- for (final FilterSpecification filterSpec : webAppSpec.getFilterSpecifications()) {
-
- final FilterHolder filterHolder = new FilterHolder(filterSpec.getFilterClass());
- filterHolder.setInitParameters(filterSpec.getInitParams());
- servletHandler.addFilter(filterHolder);
-
- final FilterMapping filterMapping = new FilterMapping();
- filterMapping.setFilterName(filterHolder.getName());
- filterMapping.setPathSpecs(filterSpec.getPathSpecs().toArray(new String[] {}));
- filterMapping.setDispatches(Handler.DEFAULT);
- servletHandler.addFilterMapping(filterMapping);
- }
- }
-
- private ContextHandler createContextHandler(final HandlerList handlers) {
- final ContextHandler contextHandler = buildContextHandler(handlers);
- addContextParams(contextHandler);
- addServletContextListeners(contextHandler);
- setWelcomeFiles(contextHandler);
- return contextHandler;
- }
-
- private ContextHandler buildContextHandler(final HandlerList handlers) {
- final ContextHandler contextHandler = new ContextHandler("/");
- contextHandler.setClassLoader(Thread.currentThread().getContextClassLoader());
- contextHandler.setHandler(handlers);
- return contextHandler;
- }
-
- private void addContextParams(final ContextHandler contextHandler) {
- for (final WebAppSpecification specification : getSpecifications()) {
- contextHandler.setInitParams(specification.getContextParams());
- }
- }
-
- private void addServletContextListeners(final ContextHandler contextHandler) {
- for (final WebAppSpecification specification : getSpecifications()) {
- for (final Class<?> servletContextListenerClass : specification.getServletContextListeners()) {
- final ServletContextListener servletContext = (ServletContextListener) InstanceUtil.createInstance(servletContextListenerClass);
- contextHandler.addEventListener(servletContext);
- }
- }
- }
-
- /**
- * TODO: this doesn't seem to be being picked up
- *
- * <p>
- * not sure if meant to add welcome files here or at the resource base
- * level, in fact, doesn't seem to work even when register in both...
- *
- * @see #addResourcesAndWelcomeFiles(HandlerList)
- */
- private void setWelcomeFiles(final ContextHandler contextHandler) {
- for (final WebAppSpecification specification : getSpecifications()) {
- contextHandler.setWelcomeFiles(specification.getWelcomeFiles().toArray(new String[] {}));
- }
- }
-
- private void startServer(final ContextHandler contextHandler) {
- final int port = getConfiguration().getInteger(WebServerConstants.EMBEDDED_WEB_SERVER_PORT_KEY, WebServerConstants.EMBEDDED_WEB_SERVER_PORT_DEFAULT);
- if (LOG.isInfoEnabled()) {
- LOG.info("Starting web server on http://localhost:" + port);
- for (final WebAppSpecification specification : getSpecifications()) {
- final String logHint = specification.getLogHint();
- if (logHint != null) {
- LOG.info(logHint);
- }
- }
- }
- try {
- final Server server = new Server(port);
- server.addHandler(contextHandler);
- server.start();
- } catch (final RuntimeException e) {
- throw e;
- } catch (final Exception e) {
- throw new WebServerException("Web server failed to start", e);
- }
- }
-
- @Override
- public void shutdown() {
- // does nothing
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/b5a05ac7/core/webserver/src/main/java/org/apache/isis/core/webserver/embedded/jetty/JettyEmbeddedWebServerInstaller.java
----------------------------------------------------------------------
diff --git a/core/webserver/src/main/java/org/apache/isis/core/webserver/embedded/jetty/JettyEmbeddedWebServerInstaller.java b/core/webserver/src/main/java/org/apache/isis/core/webserver/embedded/jetty/JettyEmbeddedWebServerInstaller.java
deleted file mode 100644
index 4cf133d..0000000
--- a/core/webserver/src/main/java/org/apache/isis/core/webserver/embedded/jetty/JettyEmbeddedWebServerInstaller.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 org.apache.isis.core.webserver.embedded.jetty;
-
-import java.util.List;
-
-import org.apache.isis.core.commons.config.InstallerAbstract;
-import org.apache.isis.core.runtime.installerregistry.installerapi.EmbeddedWebServerInstaller;
-import org.apache.isis.core.runtime.installerregistry.installerapi.IsisViewerInstaller;
-import org.apache.isis.core.runtime.web.EmbeddedWebServer;
-import org.apache.isis.core.runtime.web.EmbeddedWebViewer;
-
-/**
- * Not to be confused with {@link IsisViewerInstaller}, this installer is for a
- * component to <i>host</i> any {@link EmbeddedWebViewer} implementations.
- */
-public class JettyEmbeddedWebServerInstaller extends InstallerAbstract implements EmbeddedWebServerInstaller {
-
- public JettyEmbeddedWebServerInstaller() {
- super(EmbeddedWebServerInstaller.TYPE, "jetty");
- }
-
- @Override
- public EmbeddedWebServer createEmbeddedWebServer() {
- return new EmbeddedWebServerJetty();
- }
-
- @Override
- public List<Class<?>> getTypes() {
- return listOf(EmbeddedWebServer.class);
- }
-}