Repository: karaf
Updated Branches:
  refs/heads/karaf-2.x d3c770469 -> c1f563b5e


[KARAF-3367]add additional configuration options when use wrapper:install


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

Branch: refs/heads/karaf-2.x
Commit: c1f563b5e697da81c2686677e2d49ac75e52f507
Parents: d3c7704
Author: Freeman Fang <[email protected]>
Authored: Tue Nov 18 11:39:26 2014 +0800
Committer: Freeman Fang <[email protected]>
Committed: Tue Nov 18 11:39:26 2014 +0800

----------------------------------------------------------------------
 .../karaf/shell/wrapper/InstallCommand.java      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/c1f563b5/shell/wrapper/src/main/java/org/apache/karaf/shell/wrapper/InstallCommand.java
----------------------------------------------------------------------
diff --git 
a/shell/wrapper/src/main/java/org/apache/karaf/shell/wrapper/InstallCommand.java
 
b/shell/wrapper/src/main/java/org/apache/karaf/shell/wrapper/InstallCommand.java
index 4551f21..99af6c9 100644
--- 
a/shell/wrapper/src/main/java/org/apache/karaf/shell/wrapper/InstallCommand.java
+++ 
b/shell/wrapper/src/main/java/org/apache/karaf/shell/wrapper/InstallCommand.java
@@ -29,6 +29,7 @@ import java.util.jar.JarOutputStream;
 import java.util.zip.ZipEntry;
 
 import org.apache.karaf.shell.console.AbstractAction;
+import org.apache.felix.gogo.commands.Argument;
 import org.apache.felix.gogo.commands.Option;
 import org.apache.felix.gogo.commands.Command;
 import org.fusesource.jansi.Ansi;
@@ -50,6 +51,12 @@ public class InstallCommand extends AbstractAction {
 
     @Option(name = "-s", aliases = {"--start-type"}, description = "Mode in 
which the service is installed. AUTO_START or DEMAND_START (Default: 
AUTO_START)", required = false, multiValued = false)
     private String startType = "AUTO_START";
+    
+    @Option(name = "-e", aliases = {"--env"}, description = "Specify 
environment variable and values. To specify multiple environment variable and 
values, specify this flag multiple times.", required = false, multiValued = 
true)
+    private String[] envs;
+    
+    @Option(name = "-i", aliases = {"--include"}, description = "Specify 
include statement for JSW wrapper conf. To specify multiple include statement, 
specify this flag multiple times.", required = false, multiValued = true)
+    private String[] includes;
 
     protected Object doExecute() throws Exception {
 
@@ -479,6 +486,18 @@ public class InstallCommand extends AbstractAction {
                         line = filter(line, props);
                         out.println(line);
                     }
+                    if (outFile.getName().endsWith(".conf")) {
+                        if (envs != null && envs.length > 0) {
+                            for (String env : envs) {
+                                out.println(env);
+                            }
+                        }
+                        if (includes != null && includes.length > 0) {
+                            for (String include : includes) {
+                                out.println("#include " + include);
+                            }
+                        }
+                    }
                 } finally {
                     safeClose(out);
                 }

Reply via email to