Author: rmannibucau
Date: Wed Oct 19 06:42:55 2016
New Revision: 1765535

URL: http://svn.apache.org/viewvc?rev=1765535&view=rev
Log:
adding depoyment option to Cli and apache pom parent

Modified:
    
openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
    
openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java
    openwebbeans/microwave/trunk/pom.xml

Modified: 
openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java?rev=1765535&r1=1765534&r2=1765535&view=diff
==============================================================================
--- 
openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
 (original)
+++ 
openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/Microwave.java
 Wed Oct 19 06:42:55 2016
@@ -165,8 +165,12 @@ public class Microwave implements AutoCl
     }
 
     public Microwave bake() {
+        return bake("");
+    }
+
+    public Microwave bake(final String ctx) {
         start();
-        return deployClasspath();
+        return deployClasspath(ctx);
     }
 
     public Microwave start() {

Modified: 
openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java
URL: 
http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java?rev=1765535&r1=1765534&r2=1765535&view=diff
==============================================================================
--- 
openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java
 (original)
+++ 
openwebbeans/microwave/trunk/microwave-core/src/main/java/org/apache/microwave/runner/Cli.java
 Wed Oct 19 06:42:55 2016
@@ -50,6 +50,8 @@ public class Cli {
     public static void main(final String[] args) {
         final Options options = new Options();
         options.addOption("help", false, "Show help");
+        options.addOption("context", true, "The context to use to deploy the 
webapp");
+        options.addOption("webapp", true, "Location of the webapp, if not set 
the classpath will be deployed");
         final List<Field> fields = 
Stream.of(Microwave.Builder.class.getDeclaredFields())
                 .filter(f -> f.isAnnotationPresent(CliOption.class))
                 .collect(toList());
@@ -80,7 +82,14 @@ public class Cli {
             }
         };
         Runtime.getRuntime().addShutdownHook(hook);
-        try (final Microwave microwave = new Microwave(buildConfig(line, 
fields)).bake()) {
+        try (final Microwave microwave = new Microwave(buildConfig(line, 
fields))) {
+            final String ctx = line.getOptionValue("context", "");
+            final String war = line.getOptionValue("webapp");
+            if (war == null) {
+                microwave.bake(ctx);
+            } else {
+                microwave.deployWebapp(ctx, new File(war));
+            }
             try {
                 latch.await();
             } catch (final InterruptedException e) {
@@ -116,12 +125,6 @@ public class Cli {
         return config;
     }
 
-    /*
-    Collection<SecurityConstaintBuilder>
-    Collection<Connector>
-    LoginConfigBuilder
-    Realm
-     */
     private static Object toValue(final String name, final String[] 
optionValues, final Class<?> type) {
         if (optionValues == null || optionValues.length == 0) {
             return null;

Modified: openwebbeans/microwave/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/openwebbeans/microwave/trunk/pom.xml?rev=1765535&r1=1765534&r2=1765535&view=diff
==============================================================================
--- openwebbeans/microwave/trunk/pom.xml (original)
+++ openwebbeans/microwave/trunk/pom.xml Wed Oct 19 06:42:55 2016
@@ -24,6 +24,12 @@
             http://maven.apache.org/xsd/maven-4.0.0.xsd";>
   <modelVersion>4.0.0</modelVersion>
 
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>18</version>
+  </parent>
+
   <groupId>org.apache.microwave</groupId>
   <artifactId>microwave</artifactId>
   <packaging>pom</packaging>


Reply via email to