414635 Modular start.d and jetty.base property

+ Making --list-config more user friendly when certain sections are empty
This commit is contained in:
Joakim Erdfelt 2013-08-23 15:22:28 -07:00
parent c70a6fdfe2
commit 135a4b4c45
3 changed files with 69 additions and 39 deletions

View File

@ -36,10 +36,8 @@ import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
import java.util.Properties;
/**
* Main start class.
@ -265,48 +263,17 @@ public class Main
// Dump Jetty Home / Base
args.dumpEnvironment();
// Dump JVM Properties
System.out.println();
System.out.println("JVM Arguments:");
System.out.println("--------------");
for (String jvmArgKey : args.getJvmArgs())
{
String value = System.getProperty(jvmArgKey);
if (value != null)
{
System.out.printf(" %s = %s%n",jvmArgKey,value);
}
else
{
System.out.printf(" %s%n",jvmArgKey);
}
}
// Dump JVM Args
args.dumpJvmArgs();
// Dump Properties
System.out.println();
System.out.println("Properties:");
System.out.println("-----------");
Properties props = args.getProperties();
@SuppressWarnings("unchecked")
Enumeration<String> keyEnum = (Enumeration<String>)props.propertyNames();
while (keyEnum.hasMoreElements())
{
String name = keyEnum.nextElement();
String value = props.getProperty(name);
System.out.printf(" %s = %s%n",name,value);
}
args.dumpProperties();
// Dump Classpath
dumpClasspathWithVersions(args.getClasspath());
// Dump Resolved XMLs
System.out.println();
System.out.println("Jetty Active XMLs:");
System.out.println("------------------");
for (File xml : args.getXmlFiles())
{
System.out.printf(" %s%n",baseHome.toShortForm(xml.getAbsolutePath()));
}
args.dumpActiveXmls(baseHome);
}
private void listModules(StartArgs args)

View File

@ -26,6 +26,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
@ -110,6 +111,23 @@ public class StartArgs
}
}
public void dumpActiveXmls(BaseHome baseHome)
{
System.out.println();
System.out.println("Jetty Active XMLs:");
System.out.println("------------------");
if (xmls.isEmpty())
{
System.out.println(" (no xml files specified)");
return;
}
for (File xml : xmls)
{
System.out.printf(" %s%n",baseHome.toShortForm(xml.getAbsolutePath()));
}
}
public void dumpEnvironment()
{
// Java Details
@ -136,6 +154,53 @@ public class StartArgs
}
public void dumpJvmArgs()
{
System.out.println();
System.out.println("JVM Arguments:");
System.out.println("--------------");
if (jvmArgs.isEmpty())
{
System.out.println(" (no jvm args specified)");
return;
}
for (String jvmArgKey : jvmArgs)
{
String value = System.getProperty(jvmArgKey);
if (value != null)
{
System.out.printf(" %s = %s%n",jvmArgKey,value);
}
else
{
System.out.printf(" %s%n",jvmArgKey);
}
}
}
public void dumpProperties()
{
System.out.println();
System.out.println("Properties:");
System.out.println("-----------");
if (properties.isEmpty())
{
System.out.println(" (no properties specified)");
return;
}
@SuppressWarnings("unchecked")
Enumeration<String> keyEnum = (Enumeration<String>)properties.propertyNames();
while (keyEnum.hasMoreElements())
{
String name = keyEnum.nextElement();
String value = properties.getProperty(name);
System.out.printf(" %s = %s%n",name,value);
}
}
private void dumpSystemProperty(String key)
{
System.out.printf(" %s=%s%n",key,System.getProperty(key));

View File

@ -56,8 +56,6 @@ public class MainTest
List<String> cmdLineArgs = new ArrayList<>();
addUseCasesHome(cmdLineArgs);
cmdLineArgs.add("jetty.port=9090");
cmdLineArgs.add("-Xms1024m");
cmdLineArgs.add("-Xmx1024m");
cmdLineArgs.add("--list-config");
Main main = new Main();