40 import java.sql.SQLException; |
40 import java.sql.SQLException; |
41 import java.util.ArrayList; |
41 import java.util.ArrayList; |
42 import java.util.EnumSet; |
42 import java.util.EnumSet; |
43 import java.util.HashSet; |
43 import java.util.HashSet; |
44 import java.util.List; |
44 import java.util.List; |
|
45 import java.util.Map.Entry; |
45 import java.util.ServiceLoader; |
46 import java.util.ServiceLoader; |
46 import java.util.Set; |
47 import java.util.Set; |
47 import java.util.concurrent.ExecutorService; |
48 import java.util.concurrent.ExecutorService; |
48 import java.util.concurrent.Executors; |
49 import java.util.concurrent.Executors; |
49 import java.util.concurrent.TimeUnit; |
50 import java.util.concurrent.TimeUnit; |
112 |
115 |
113 private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException { |
116 private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException { |
114 for (InfoType infoType : commands) { |
117 for (InfoType infoType : commands) { |
115 infoType.showInfo(this); |
118 infoType.showInfo(this); |
116 } |
119 } |
|
120 } |
|
121 |
|
122 private void listJavaProperties() throws FormatterException, ConfigurationException { |
|
123 ColumnsHeader header = constructHeader(new HeaderField("name", SQLType.VARCHAR), new HeaderField("value", SQLType.VARCHAR)); |
|
124 List<Object[]> data = new ArrayList<>(); |
|
125 for (Entry<Object, Object> e : System.getProperties().entrySet()) { |
|
126 data.add(new Object[]{e.getKey(), e.getValue()}); |
|
127 } |
|
128 printTable(formatter, header, "-- Java system properties", null, data); |
|
129 } |
|
130 |
|
131 private void listEnvironmentVariables() throws FormatterException, ConfigurationException { |
|
132 ColumnsHeader header = constructHeader(new HeaderField("name", SQLType.VARCHAR), new HeaderField("value", SQLType.VARCHAR)); |
|
133 List<Object[]> data = new ArrayList<>(); |
|
134 for (Entry<String, String> e : System.getenv().entrySet()) { |
|
135 data.add(new Object[]{e.getKey(), e.getValue()}); |
|
136 } |
|
137 printTable(formatter, header, "-- environment variables", null, data); |
117 } |
138 } |
118 |
139 |
119 private void listFormatters() throws ConfigurationException, FormatterException { |
140 private void listFormatters() throws ConfigurationException, FormatterException { |
120 ColumnsHeader header = constructHeader( |
141 ColumnsHeader header = constructHeader( |
121 new HeaderField("name", SQLType.VARCHAR), |
142 new HeaderField("name", SQLType.VARCHAR), |
495 @Override |
516 @Override |
496 public void showInfo(InfoLister infoLister) { |
517 public void showInfo(InfoLister infoLister) { |
497 infoLister.printResource(Constants.LICENSE_FILE); |
518 infoLister.printResource(Constants.LICENSE_FILE); |
498 } |
519 } |
499 }, |
520 }, |
|
521 JAVA_PROPERTIES { |
|
522 @Override |
|
523 public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException { |
|
524 infoLister.listJavaProperties(); |
|
525 } |
|
526 }, |
|
527 ENVIRONMENT_VARIABLES { |
|
528 @Override |
|
529 public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException { |
|
530 infoLister.listEnvironmentVariables(); |
|
531 } |
|
532 }, |
500 FORMATTERS { |
533 FORMATTERS { |
501 @Override |
534 @Override |
502 public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException { |
535 public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException { |
503 infoLister.listFormatters(); |
536 infoLister.listFormatters(); |
504 } |
537 } |