java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java
branchv_0
changeset 200 2e351d7c26c4
parent 197 7a2f535017e4
child 201 d3db5a72a089
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java	Sun May 24 18:45:46 2015 +0200
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java	Sun May 24 19:10:25 2015 +0200
     1.3 @@ -42,6 +42,7 @@
     1.4  import java.util.EnumSet;
     1.5  import java.util.HashSet;
     1.6  import java.util.List;
     1.7 +import java.util.Map.Entry;
     1.8  import java.util.ServiceLoader;
     1.9  import java.util.Set;
    1.10  import java.util.concurrent.ExecutorService;
    1.11 @@ -88,6 +89,8 @@
    1.12  				case DATABASES:
    1.13  				case FORMATTERS:
    1.14  				case TYPES:
    1.15 +				case JAVA_PROPERTIES:
    1.16 +				case ENVIRONMENT_VARIABLES:
    1.17  					formattinNeeded = true;
    1.18  					break;
    1.19  			}
    1.20 @@ -116,6 +119,24 @@
    1.21  		}
    1.22  	}
    1.23  
    1.24 +	private void listJavaProperties() throws FormatterException, ConfigurationException {
    1.25 +		ColumnsHeader header = constructHeader(new HeaderField("name", SQLType.VARCHAR), new HeaderField("value", SQLType.VARCHAR));
    1.26 +		List<Object[]> data = new ArrayList<>();
    1.27 +		for (Entry<Object, Object> e : System.getProperties().entrySet()) {
    1.28 +			data.add(new Object[]{e.getKey(), e.getValue()});
    1.29 +		}
    1.30 +		printTable(formatter, header, "-- Java system properties", null, data);
    1.31 +	}
    1.32 +
    1.33 +	private void listEnvironmentVariables() throws FormatterException, ConfigurationException {
    1.34 +		ColumnsHeader header = constructHeader(new HeaderField("name", SQLType.VARCHAR), new HeaderField("value", SQLType.VARCHAR));
    1.35 +		List<Object[]> data = new ArrayList<>();
    1.36 +		for (Entry<String, String> e : System.getenv().entrySet()) {
    1.37 +			data.add(new Object[]{e.getKey(), e.getValue()});
    1.38 +		}
    1.39 +		printTable(formatter, header, "-- environment variables", null, data);
    1.40 +	}
    1.41 +
    1.42  	private void listFormatters() throws ConfigurationException, FormatterException {
    1.43  		ColumnsHeader header = constructHeader(
    1.44  				new HeaderField("name", SQLType.VARCHAR),
    1.45 @@ -497,6 +518,18 @@
    1.46  						infoLister.printResource(Constants.LICENSE_FILE);
    1.47  					}
    1.48  				},
    1.49 +		JAVA_PROPERTIES {
    1.50 +					@Override
    1.51 +					public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
    1.52 +						infoLister.listJavaProperties();
    1.53 +					}
    1.54 +				},
    1.55 +		ENVIRONMENT_VARIABLES {
    1.56 +					@Override
    1.57 +					public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
    1.58 +						infoLister.listEnvironmentVariables();
    1.59 +					}
    1.60 +				},
    1.61  		FORMATTERS {
    1.62  					@Override
    1.63  					public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {