Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-10-14 07:24:35 +0000
committerGreg Wilkins2015-10-14 07:26:14 +0000
commit14b638f8f7bc2e20bc2e15efb3be131c9b9880d1 (patch)
tree0618166763b49d7e733eb8655c3a3a1231db4840 /jetty-start/src
parentb0eb18b451af19532d9e308ac7dbba87da52a226 (diff)
downloadorg.eclipse.jetty.project-14b638f8f7bc2e20bc2e15efb3be131c9b9880d1.tar.gz
org.eclipse.jetty.project-14b638f8f7bc2e20bc2e15efb3be131c9b9880d1.tar.xz
org.eclipse.jetty.project-14b638f8f7bc2e20bc2e15efb3be131c9b9880d1.zip
479712 Added --yes to start.jar
Diffstat (limited to 'jetty-start/src')
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java2
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/Licensing.java8
-rw-r--r--jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java33
-rw-r--r--jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt4
4 files changed, 38 insertions, 9 deletions
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java b/jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java
index 46b312223a..3e5314e32c 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/BaseBuilder.java
@@ -116,7 +116,7 @@ public class BaseBuilder
if (licensing.hasLicenses())
{
StartLog.debug("Requesting License Acknowledgement");
- if (!licensing.acknowledgeLicenses())
+ if (!licensing.acknowledgeLicenses(startArgs))
{
StartLog.warn(EXITING_LICENSE_NOT_ACKNOWLEDGED);
System.exit(1);
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/Licensing.java b/jetty-start/src/main/java/org/eclipse/jetty/start/Licensing.java
index eb5149bc81..681407e612 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/Licensing.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/Licensing.java
@@ -55,7 +55,7 @@ public class Licensing
return !licenseMap.isEmpty();
}
- public boolean acknowledgeLicenses() throws IOException
+ public boolean acknowledgeLicenses(StartArgs startArgs) throws IOException
{
if (!hasLicenses())
{
@@ -92,11 +92,7 @@ public class Licensing
throw new RuntimeException("Test Configuration Missing - Pre-specify answer to (" + PROP_ACK_LICENSES + ") in test case");
}
- BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
- System.err.printf("%nProceed (y/N)? ");
- String response = input.readLine();
-
- licenseAck = (Utils.isNotBlank(response) && response.toLowerCase().startsWith("y"));
+ licenseAck = startArgs.isYes("%nProceed (y/N)? ");
}
return licenseAck;
diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
index 145fb30b47..0e77f4e787 100644
--- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
+++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java
@@ -18,14 +18,15 @@
package org.eclipse.jetty.start;
+import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -170,6 +171,7 @@ public class StartArgs
private boolean licenseCheckRequired = false;
private boolean testingMode = false;
+ private boolean yes = false;
private boolean help = false;
private boolean stopCommand = false;
private boolean listModules = false;
@@ -181,7 +183,8 @@ public class StartArgs
private boolean exec = false;
private String exec_properties;
private boolean approveAllLicenses = false;
-
+ private BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
+
public StartArgs()
{
classpath = new Classpath();
@@ -835,6 +838,11 @@ public class StartArgs
run = false;
return;
}
+
+ if ("--yes".equals(arg))
+ {
+ yes = true;
+ }
if ("--debug".equals(arg) || arg.startsWith("--start-log-file"))
{
@@ -1181,6 +1189,26 @@ public class StartArgs
this.run = run;
}
+ public boolean isYes(String promptFormat,Object... args)
+ {
+ System.err.printf(promptFormat,args);
+ if (yes)
+ {
+ System.err.printf("--yes%n");
+ return true;
+ }
+ try
+ {
+ String response = input.readLine();
+ return (Utils.isNotBlank(response) && response.toLowerCase().startsWith("y"));
+ }
+ catch(IOException e)
+ {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
@Override
public String toString()
{
@@ -1196,4 +1224,5 @@ public class StartArgs
builder.append("]");
return builder.toString();
}
+
}
diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
index 8a6d10ad2b..9aa6b039ad 100644
--- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
+++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
@@ -115,6 +115,10 @@ Module Management:
${jetty.base} and are willing to forego some of the
safety checks built into the jetty-start mechanism.
+ --yes Automatically reply Yes to any questions asked by the
+ module installation mechanism. Useful for running module
+ commands from scripts.
+
Startup / Shutdown Command Line:
--------------------------------

Back to the top