java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 24 May 2015 19:10:25 +0200
branchv_0
changeset 200 2e351d7c26c4
parent 197 7a2f535017e4
child 201 d3db5a72a089
permissions -rw-r--r--
InfoLister: new listings: --list-java-properties and --list-environment-variables
     1 /**
     2  * SQL-DK
     3  * Copyright © 2013 František Kučera (frantovo.cz)
     4  *
     5  * This program is free software: you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation, either version 3 of the License, or
     8  * (at your option) any later version.
     9  *
    10  * This program is distributed in the hope that it will be useful,
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    13  * GNU General Public License for more details.
    14  *
    15  * You should have received a copy of the GNU General Public License
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    18 package info.globalcode.sql.dk;
    19 
    20 import info.globalcode.sql.dk.configuration.Configuration;
    21 import info.globalcode.sql.dk.configuration.ConfigurationException;
    22 import info.globalcode.sql.dk.configuration.ConfigurationProvider;
    23 import info.globalcode.sql.dk.configuration.DatabaseDefinition;
    24 import info.globalcode.sql.dk.configuration.FormatterDefinition;
    25 import info.globalcode.sql.dk.configuration.Properties;
    26 import info.globalcode.sql.dk.configuration.Property;
    27 import info.globalcode.sql.dk.formatting.ColumnsHeader;
    28 import info.globalcode.sql.dk.formatting.FakeSqlArray;
    29 import info.globalcode.sql.dk.formatting.Formatter;
    30 import info.globalcode.sql.dk.formatting.FormatterContext;
    31 import info.globalcode.sql.dk.formatting.FormatterException;
    32 import java.io.BufferedReader;
    33 import java.io.ByteArrayOutputStream;
    34 import java.io.InputStreamReader;
    35 import java.io.PrintStream;
    36 import java.sql.Array;
    37 import java.sql.Driver;
    38 import java.sql.DriverManager;
    39 import java.sql.DriverPropertyInfo;
    40 import java.sql.SQLException;
    41 import java.util.ArrayList;
    42 import java.util.EnumSet;
    43 import java.util.HashSet;
    44 import java.util.List;
    45 import java.util.Map.Entry;
    46 import java.util.ServiceLoader;
    47 import java.util.Set;
    48 import java.util.concurrent.ExecutorService;
    49 import java.util.concurrent.Executors;
    50 import java.util.concurrent.TimeUnit;
    51 import java.util.logging.Level;
    52 import java.util.logging.LogRecord;
    53 import java.util.logging.Logger;
    54 import javax.sql.rowset.RowSetMetaDataImpl;
    55 
    56 /**
    57  * Displays info like help, version etc.
    58  *
    59  * @author Ing. František Kučera (frantovo.cz)
    60  */
    61 public class InfoLister {
    62 
    63 	private static final Logger log = Logger.getLogger(InfoLister.class.getName());
    64 	/**
    65 	 * Fake database name for output formatting
    66 	 */
    67 	public static final String CONFIG_DB_NAME = "sqldk_configuration";
    68 	private final PrintStream out;
    69 	private final ConfigurationProvider configurationProvider;
    70 	private final CLIOptions options;
    71 	private Formatter formatter;
    72 
    73 	public InfoLister(PrintStream out, ConfigurationProvider configurationProvider, CLIOptions options) {
    74 		this.out = out;
    75 		this.configurationProvider = configurationProvider;
    76 		this.options = options;
    77 	}
    78 
    79 	public void showInfo() throws ConfigurationException, FormatterException {
    80 		EnumSet<InfoType> commands = options.getShowInfo();
    81 
    82 		boolean formattinNeeded = false;
    83 
    84 		for (InfoType infoType : commands) {
    85 			switch (infoType) {
    86 				case CONNECTION:
    87 				case JDBC_DRIVERS:
    88 				case JDBC_PROPERTIES:
    89 				case DATABASES:
    90 				case FORMATTERS:
    91 				case TYPES:
    92 				case JAVA_PROPERTIES:
    93 				case ENVIRONMENT_VARIABLES:
    94 					formattinNeeded = true;
    95 					break;
    96 			}
    97 		}
    98 
    99 		if (formattinNeeded) {
   100 			try (Formatter f = getFormatter()) {
   101 				formatter = f;
   102 				formatter.writeStartBatch();
   103 				DatabaseDefinition dd = new DatabaseDefinition();
   104 				dd.setName(CONFIG_DB_NAME);
   105 				formatter.writeStartDatabase(dd);
   106 				showInfos(commands);
   107 				formatter.writeEndDatabase();
   108 				formatter.writeEndBatch();
   109 				formatter.close();
   110 			}
   111 		} else {
   112 			showInfos(commands);
   113 		}
   114 	}
   115 
   116 	private void showInfos(EnumSet<InfoType> commands) throws ConfigurationException, FormatterException {
   117 		for (InfoType infoType : commands) {
   118 			infoType.showInfo(this);
   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);
   138 	}
   139 
   140 	private void listFormatters() throws ConfigurationException, FormatterException {
   141 		ColumnsHeader header = constructHeader(
   142 				new HeaderField("name", SQLType.VARCHAR),
   143 				new HeaderField("built_in", SQLType.BOOLEAN),
   144 				new HeaderField("default", SQLType.BOOLEAN),
   145 				new HeaderField("class_name", SQLType.VARCHAR),
   146 				new HeaderField("valid", SQLType.BOOLEAN));
   147 		List<Object[]> data = new ArrayList<>();
   148 
   149 		String defaultFormatter = configurationProvider.getConfiguration().getDefaultFormatter();
   150 		defaultFormatter = defaultFormatter == null ? Configuration.DEFAULT_FORMATTER : defaultFormatter;
   151 
   152 		for (FormatterDefinition fd : configurationProvider.getConfiguration().getBuildInFormatters()) {
   153 			data.add(new Object[]{fd.getName(), true, defaultFormatter.equals(fd.getName()), fd.getClassName(), isInstantiable(fd)});
   154 		}
   155 
   156 		for (FormatterDefinition fd : configurationProvider.getConfiguration().getFormatters()) {
   157 			data.add(new Object[]{fd.getName(), false, defaultFormatter.equals(fd.getName()), fd.getClassName(), isInstantiable(fd)});
   158 		}
   159 
   160 		printTable(formatter, header, "-- configured and built-in output formatters", null, data);
   161 	}
   162 
   163 	private boolean isInstantiable(FormatterDefinition fd) {
   164 		try {
   165 			try (ByteArrayOutputStream testStream = new ByteArrayOutputStream()) {
   166 				fd.getInstance(new FormatterContext(testStream, new Properties(0)));
   167 				return true;
   168 			}
   169 		} catch (Exception e) {
   170 			log.log(Level.SEVERE, "Unable to create an instance of formatter: " + fd.getName(), e);
   171 			return false;
   172 		}
   173 	}
   174 
   175 	public void listTypes() throws FormatterException, ConfigurationException {
   176 		ColumnsHeader header = constructHeader(new HeaderField("name", SQLType.VARCHAR), new HeaderField("code", SQLType.INTEGER));
   177 		List<Object[]> data = new ArrayList<>();
   178 		for (SQLType sqlType : SQLType.values()) {
   179 			data.add(new Object[]{sqlType.name(), sqlType.getCode()});
   180 		}
   181 		printTable(formatter, header, "-- data types", null, data);
   182 		log.log(Level.INFO, "Type names in --types option are case insensitive");
   183 	}
   184 
   185 	public void listDatabases() throws ConfigurationException, FormatterException {
   186 		ColumnsHeader header = constructHeader(
   187 				new HeaderField("database_name", SQLType.VARCHAR),
   188 				new HeaderField("user_name", SQLType.VARCHAR),
   189 				new HeaderField("database_url", SQLType.VARCHAR));
   190 		List<Object[]> data = new ArrayList<>();
   191 
   192 		final List<DatabaseDefinition> configuredDatabases = configurationProvider.getConfiguration().getDatabases();
   193 		if (configuredDatabases.isEmpty()) {
   194 			log.log(Level.WARNING, "No databases are configured.");
   195 		} else {
   196 			for (DatabaseDefinition dd : configuredDatabases) {
   197 				data.add(new Object[]{dd.getName(), dd.getUserName(), dd.getUrl()});
   198 			}
   199 		}
   200 
   201 		printTable(formatter, header, "-- configured databases", null, data);
   202 	}
   203 
   204 	public void listJdbcDrivers() throws FormatterException, ConfigurationException {
   205 		ColumnsHeader header = constructHeader(
   206 				new HeaderField("class", SQLType.VARCHAR),
   207 				new HeaderField("version", SQLType.VARCHAR),
   208 				new HeaderField("major", SQLType.INTEGER),
   209 				new HeaderField("minor", SQLType.INTEGER),
   210 				new HeaderField("jdbc_compliant", SQLType.BOOLEAN));
   211 		List<Object[]> data = new ArrayList<>();
   212 
   213 		final ServiceLoader<Driver> drivers = ServiceLoader.load(Driver.class);
   214 		for (Driver d : drivers) {
   215 			data.add(new Object[]{
   216 				d.getClass().getName(),
   217 				d.getMajorVersion() + "." + d.getMinorVersion(),
   218 				d.getMajorVersion(),
   219 				d.getMinorVersion(),
   220 				d.jdbcCompliant()
   221 			});
   222 		}
   223 
   224 		printTable(formatter, header, "-- discovered JDBC drivers (available on the CLASSPATH)", null, data);
   225 	}
   226 
   227 	public void listJdbcProperties() throws FormatterException, ConfigurationException {
   228 		for (String dbName : options.getDatabaseNamesToListProperties()) {
   229 			ColumnsHeader header = constructHeader(
   230 					new HeaderField("property_name", SQLType.VARCHAR),
   231 					new HeaderField("required", SQLType.BOOLEAN),
   232 					new HeaderField("choices", SQLType.ARRAY),
   233 					new HeaderField("configured_value", SQLType.VARCHAR),
   234 					new HeaderField("description", SQLType.VARCHAR));
   235 			List<Object[]> data = new ArrayList<>();
   236 
   237 			DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName);
   238 
   239 			Driver driver = findDriver(dd);
   240 
   241 			if (driver == null) {
   242 				log.log(Level.WARNING, "No JDBC driver was found for DB: {0} with URL: {1}", new Object[]{dd.getName(), dd.getUrl()});
   243 			} else {
   244 				log.log(Level.INFO, "For DB: {0} was found JDBC driver: {1}", new Object[]{dd.getName(), driver.getClass().getName()});
   245 
   246 				try {
   247 					DriverPropertyInfo[] propertyInfos = driver.getPropertyInfo(dd.getUrl(), dd.getProperties().getJavaProperties());
   248 
   249 					Set<String> standardProperties = new HashSet<>();
   250 
   251 					for (DriverPropertyInfo pi : propertyInfos) {
   252 						Array choices = new FakeSqlArray(pi.choices, SQLType.VARCHAR);
   253 						data.add(new Object[]{
   254 							pi.name,
   255 							pi.required,
   256 							choices.getArray() == null ? "" : choices,
   257 							pi.value == null ? "" : pi.value,
   258 							pi.description
   259 						});
   260 						standardProperties.add(pi.name);
   261 					}
   262 
   263 					for (Property p : dd.getProperties()) {
   264 						if (!standardProperties.contains(p.getName())) {
   265 							data.add(new Object[]{
   266 								p.getName(),
   267 								"",
   268 								"",
   269 								p.getValue(),
   270 								""
   271 							});
   272 							log.log(Level.WARNING, "Your configuration contains property „{0}“ not declared by the JDBC driver.", p.getName());
   273 						}
   274 					}
   275 
   276 				} catch (SQLException e) {
   277 					log.log(Level.WARNING, "Error during getting property infos.", e);
   278 				}
   279 
   280 				List<Parameter> parameters = new ArrayList<>();
   281 				parameters.add(new NamedParameter("database", dbName, SQLType.VARCHAR));
   282 				parameters.add(new NamedParameter("driver_class", driver.getClass().getName(), SQLType.VARCHAR));
   283 				parameters.add(new NamedParameter("driver_major_version", driver.getMajorVersion(), SQLType.INTEGER));
   284 				parameters.add(new NamedParameter("driver_minor_version", driver.getMinorVersion(), SQLType.INTEGER));
   285 
   286 				printTable(formatter, header, "-- configured and configurable JDBC driver properties", parameters, data);
   287 			}
   288 		}
   289 
   290 	}
   291 
   292 	private Driver findDriver(DatabaseDefinition dd) {
   293 		final ServiceLoader<Driver> drivers = ServiceLoader.load(Driver.class);
   294 		for (Driver d : drivers) {
   295 			try {
   296 				if (d.acceptsURL(dd.getUrl())) {
   297 					return d;
   298 				}
   299 			} catch (SQLException e) {
   300 				log.log(Level.WARNING, "Error during finding JDBC driver for: " + dd.getName(), e);
   301 			}
   302 		}
   303 		return null;
   304 	}
   305 
   306 	/**
   307 	 * Parallelism for connection testing – maximum concurrent database connections.
   308 	 */
   309 	private static final int TESTING_THREAD_COUNT = 64;
   310 	/**
   311 	 * Time limit for all connection testing threads – particular timeouts per connection will be
   312 	 * much smaller.
   313 	 */
   314 	private static final long TESTING_AWAIT_LIMIT = 1;
   315 	private static final TimeUnit TESTING_AWAIT_UNIT = TimeUnit.DAYS;
   316 
   317 	public void testConnections() throws FormatterException, ConfigurationException {
   318 		ColumnsHeader header = constructHeader(
   319 				new HeaderField("database_name", SQLType.VARCHAR),
   320 				new HeaderField("configured", SQLType.BOOLEAN),
   321 				new HeaderField("connected", SQLType.BOOLEAN));
   322 
   323 		log.log(Level.FINE, "Testing DB connections in {0} threads", TESTING_THREAD_COUNT);
   324 
   325 		ExecutorService es = Executors.newFixedThreadPool(TESTING_THREAD_COUNT);
   326 
   327 		final Formatter currentFormatter = formatter;
   328 
   329 		printHeader(currentFormatter, header, "-- database configuration and connectivity test", null);
   330 
   331 		for (final String dbName : options.getDatabaseNamesToTest()) {
   332 			preloadDriver(dbName);
   333 		}
   334 
   335 		for (final String dbName : options.getDatabaseNamesToTest()) {
   336 			es.submit(new Runnable() {
   337 				// TODO: Java 8 – lambda
   338 				@Override
   339 				public void run() {
   340 					final Object[] row = testConnection(dbName);
   341 					synchronized (currentFormatter) {
   342 						printRow(currentFormatter, row);
   343 					}
   344 				}
   345 			});
   346 		}
   347 
   348 		es.shutdown();
   349 
   350 		try {
   351 			log.log(Level.FINEST, "Waiting for test results: {0} {1}", new Object[]{TESTING_AWAIT_LIMIT, TESTING_AWAIT_UNIT.name()});
   352 			boolean finished = es.awaitTermination(TESTING_AWAIT_LIMIT, TESTING_AWAIT_UNIT);
   353 			if (finished) {
   354 				log.log(Level.FINEST, "All testing threads finished in time limit.");
   355 			} else {
   356 				throw new FormatterException("Exceeded total time limit for test threads – this should never happen");
   357 			}
   358 		} catch (InterruptedException e) {
   359 			throw new FormatterException("Interrupted while waiting for test results", e);
   360 		}
   361 
   362 		printFooter(currentFormatter);
   363 	}
   364 
   365 	/**
   366 	 * JDBC driver classes should be preloaded in single thread to avoid deadlocks while doing
   367 	 * {@linkplain DriverManager#registerDriver(java.sql.Driver)} during parallel connections.
   368 	 *
   369 	 * @param dbName
   370 	 */
   371 	private void preloadDriver(String dbName) {
   372 		try {
   373 			DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName);
   374 			Driver driver = findDriver(dd);
   375 			if (driver == null) {
   376 				log.log(Level.WARNING, "No Driver found for DB: {0}", dbName);
   377 			} else {
   378 				log.log(Level.FINEST, "Driver preloading for DB: {0} was successfull", dbName);
   379 			}
   380 		} catch (Exception e) {
   381 			LogRecord r = new LogRecord(Level.WARNING, "Failed to preload the Driver for DB: {0}");
   382 			r.setParameters(new Object[]{dbName});
   383 			r.setThrown(e);
   384 			log.log(r);
   385 		}
   386 	}
   387 
   388 	public Object[] testConnection(String dbName) {
   389 		log.log(Level.FINE, "Testing connection to database: {0}", dbName);
   390 
   391 		boolean succesfullyConnected = false;
   392 		boolean succesfullyConfigured = false;
   393 
   394 		try {
   395 			DatabaseDefinition dd = configurationProvider.getConfiguration().getDatabase(dbName);
   396 			log.log(Level.FINE, "Database definition was loaded from configuration");
   397 			succesfullyConfigured = true;
   398 			try (DatabaseConnection dc = dd.connect(options.getDatabaseProperties())) {
   399 				succesfullyConnected = dc.test();
   400 			}
   401 			log.log(Level.FINE, "Database connection test was successful");
   402 		} catch (ConfigurationException | SQLException | RuntimeException e) {
   403 			log.log(Level.SEVERE, "Error during testing connection " + dbName, e);
   404 		}
   405 
   406 		return new Object[]{dbName, succesfullyConfigured, succesfullyConnected};
   407 	}
   408 
   409 	public void printResource(String fileName) {
   410 		try (BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(fileName)))) {
   411 			while (true) {
   412 				String line = reader.readLine();
   413 				if (line == null) {
   414 					break;
   415 				} else {
   416 					println(line);
   417 				}
   418 			}
   419 		} catch (Exception e) {
   420 			log.log(Level.SEVERE, "Unable to print this info. Please see our website for it: " + Constants.WEBSITE, e);
   421 		}
   422 	}
   423 
   424 	private void println(String line) {
   425 		out.println(line);
   426 	}
   427 
   428 	private void printTable(Formatter formatter, ColumnsHeader header, String sql, List<Parameter> parameters, List<Object[]> data) throws ConfigurationException, FormatterException {
   429 		printHeader(formatter, header, sql, parameters);
   430 
   431 		for (Object[] row : data) {
   432 			printRow(formatter, row);
   433 		}
   434 
   435 		printFooter(formatter);
   436 	}
   437 
   438 	private void printHeader(Formatter formatter, ColumnsHeader header, String sql, List<Parameter> parameters) {
   439 		formatter.writeStartStatement();
   440 		if (sql != null) {
   441 			formatter.writeQuery(sql);
   442 			if (parameters != null) {
   443 				formatter.writeParameters(parameters);
   444 			}
   445 		}
   446 		formatter.writeStartResultSet(header);
   447 	}
   448 
   449 	private void printRow(Formatter formatter, Object[] row) {
   450 		formatter.writeStartRow();
   451 		for (Object cell : row) {
   452 			formatter.writeColumnValue(cell);
   453 		}
   454 		formatter.writeEndRow();
   455 	}
   456 
   457 	private void printFooter(Formatter formatter) {
   458 		formatter.writeEndResultSet();
   459 		formatter.writeEndStatement();
   460 	}
   461 
   462 	private Formatter getFormatter() throws ConfigurationException, FormatterException {
   463 		String formatterName = options.getFormatterName();
   464 		formatterName = formatterName == null ? Configuration.DEFAULT_FORMATTER_PREFETCHING : formatterName;
   465 		FormatterDefinition fd = configurationProvider.getConfiguration().getFormatter(formatterName);
   466 		FormatterContext context = new FormatterContext(out, options.getFormatterProperties());
   467 		return fd.getInstance(context);
   468 	}
   469 
   470 	private ColumnsHeader constructHeader(HeaderField... fields) throws FormatterException {
   471 		try {
   472 			RowSetMetaDataImpl metaData = new RowSetMetaDataImpl();
   473 			metaData.setColumnCount(fields.length);
   474 
   475 			for (int i = 0; i < fields.length; i++) {
   476 				HeaderField hf = fields[i];
   477 				int sqlIndex = i + 1;
   478 				metaData.setColumnName(sqlIndex, hf.name);
   479 				metaData.setColumnLabel(sqlIndex, hf.name);
   480 				metaData.setColumnType(sqlIndex, hf.type.getCode());
   481 				metaData.setColumnTypeName(sqlIndex, hf.type.name());
   482 			}
   483 
   484 			return new ColumnsHeader(metaData);
   485 		} catch (SQLException e) {
   486 			throw new FormatterException("Error while constructing table headers", e);
   487 		}
   488 	}
   489 
   490 	private static class HeaderField {
   491 
   492 		String name;
   493 		SQLType type;
   494 
   495 		public HeaderField(String name, SQLType type) {
   496 			this.name = name;
   497 			this.type = type;
   498 		}
   499 	}
   500 
   501 	public enum InfoType {
   502 
   503 		HELP {
   504 					@Override
   505 					public void showInfo(InfoLister infoLister) {
   506 						infoLister.printResource(Constants.HELP_FILE);
   507 					}
   508 				},
   509 		VERSION {
   510 					@Override
   511 					public void showInfo(InfoLister infoLister) {
   512 						infoLister.printResource(Constants.VERSION_FILE);
   513 					}
   514 				},
   515 		LICENSE {
   516 					@Override
   517 					public void showInfo(InfoLister infoLister) {
   518 						infoLister.printResource(Constants.LICENSE_FILE);
   519 					}
   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 				},
   533 		FORMATTERS {
   534 					@Override
   535 					public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
   536 						infoLister.listFormatters();
   537 					}
   538 				},
   539 		TYPES {
   540 					@Override
   541 					public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
   542 						infoLister.listTypes();
   543 					}
   544 				},
   545 		JDBC_DRIVERS {
   546 					@Override
   547 					public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
   548 						infoLister.listJdbcDrivers();
   549 					}
   550 				},
   551 		JDBC_PROPERTIES {
   552 					@Override
   553 					public void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException {
   554 						infoLister.listJdbcProperties();
   555 					}
   556 				},
   557 		DATABASES {
   558 					@Override
   559 					public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
   560 						infoLister.listDatabases();
   561 					}
   562 				},
   563 		CONNECTION {
   564 					@Override
   565 					public void showInfo(InfoLister infoLister) throws FormatterException, ConfigurationException {
   566 						infoLister.testConnections();
   567 					}
   568 				};
   569 
   570 		public abstract void showInfo(InfoLister infoLister) throws ConfigurationException, FormatterException;
   571 	}
   572 }