isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject isis git commit: ISIS-848: adding new -m (or --manifest) to WebServer to specify the AppManifest
Date Thu, 13 Aug 2015 13:26:25 GMT
Repository: isis
Updated Branches:
  refs/heads/master 04b3f0ec8 -> 6fd0c75b5


ISIS-848: adding new -m (or --manifest) to WebServer to specify the AppManifest


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

Branch: refs/heads/master
Commit: 6fd0c75b5031aae1cc3cad018f204ec6bd173fd3
Parents: 04b3f0e
Author: Jeroen van der Wal <jeroen@stromboli.it>
Authored: Thu Aug 13 15:24:45 2015 +0200
Committer: Jeroen van der Wal <jeroen@stromboli.it>
Committed: Thu Aug 13 15:24:45 2015 +0200

----------------------------------------------------------------------
 .../isis/core/runtime/runner/Constants.java     |  6 +-
 .../isis/core/runtime/runner/IsisRunner.java    |  1 +
 .../runner/opts/OptionHandlerAppManifest.java   | 80 ++++++++++++++++++++
 3 files changed, 84 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/6fd0c75b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/Constants.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/Constants.java
b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/Constants.java
index 7b512db..54d5a48 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/Constants.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/Constants.java
@@ -38,12 +38,12 @@ public final class Constants {
     public static final String REFLECTOR_OPT = "l";
     public static final String REFLECTOR_LONG_OPT = ObjectReflectorInstaller.TYPE;
 
-    public static final String OBJECT_PERSISTENCE_OPT = "r";
-    public static final String OBJECT_PERSISTENCE_LONG_OPT = PersistenceMechanismInstaller.TYPE;
-
     public static final String CONFIGURATION_OPT = "c";
     public static final String CONFIGURATION_LONG_OPT = "config";
 
+    public static final String APP_MANIFEST_OPT = "m";
+    public static final String APP_MANIFEST_LONG_OPT = "manifest";
+
     public static final String FIXTURE_OPT = "f";
     public static final String FIXTURE_LONG_OPT = "fixture";
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6fd0c75b/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 fe192a7..9a5bd26 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
@@ -227,6 +227,7 @@ public class IsisRunner {
 
         addOptionHandler(new OptionHandlerReflector(installerLookup));
 
+        addOptionHandler(new OptionHandlerAppManifest());
         addOptionHandler(new OptionHandlerFixture());
         addOptionHandler(new OptionHandlerNoSplash());
         addOptionHandler(new OptionHandlerAdditionalProperty());

http://git-wip-us.apache.org/repos/asf/isis/blob/6fd0c75b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionHandlerAppManifest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionHandlerAppManifest.java
b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionHandlerAppManifest.java
new file mode 100644
index 0000000..f6e937f
--- /dev/null
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/runner/opts/OptionHandlerAppManifest.java
@@ -0,0 +1,80 @@
+/*
+ *  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 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.core.runtime.runner.Constants;
+import org.apache.isis.core.runtime.system.SystemConstants;
+
+import static org.apache.isis.core.runtime.runner.Constants.APP_MANIFEST_LONG_OPT;
+import static org.apache.isis.core.runtime.runner.Constants.APP_MANIFEST_OPT;
+import static org.apache.isis.core.runtime.runner.Constants.FIXTURE_LONG_OPT;
+import static org.apache.isis.core.runtime.runner.Constants.FIXTURE_OPT;
+
+public class OptionHandlerAppManifest extends OptionHandlerAbstract {
+
+    private static final Logger LOG = LoggerFactory.getLogger(OptionHandlerAppManifest.class);
+    private String appManifestClassName;
+
+    public OptionHandlerAppManifest() {
+        super();
+    }
+
+    @Override
+    @SuppressWarnings("static-access")
+    public void addOption(final Options options) {
+        final Option option = OptionBuilder
+                                    .withArgName("app manifest").hasArg()
+                                    .withLongOpt(APP_MANIFEST_LONG_OPT)
+                                    .withDescription("fully qualified AppManifest class")
+                                    .create(APP_MANIFEST_OPT);
+        options.addOption(option);
+    }
+
+    @Override
+    public boolean handle(final CommandLine commandLine, final BootPrinter bootPrinter, final
Options options) {
+        appManifestClassName = commandLine.getOptionValue(Constants.APP_MANIFEST_OPT);
+        return true;
+    }
+
+    @Override
+    public void primeConfigurationBuilder(final IsisConfigurationBuilder isisConfigurationBuilder)
{
+        if (appManifestClassName == null) {
+            return;
+        }
+        prime(isisConfigurationBuilder, SystemConstants.APP_MANIFEST_KEY, appManifestClassName);
+    }
+
+    static void prime(IsisConfigurationBuilder isisConfigurationBuilder, String key, String
value) {
+        LOG.info("priming: " + key + "=" + value);
+        isisConfigurationBuilder.add(key, value);
+    }
+
+
+}


Mime
View raw message