java/sql-dk/src/info/globalcode/sql/dk/CLIStarter.java
author František Kučera <franta-hg@frantovo.cz>
Mon, 16 Dec 2013 15:29:02 +0100
branchv_0
changeset 15 bbd335b5410c
parent 14 189b1260b942
child 16 5b8fcd35d4d6
permissions -rw-r--r--
show info basics: list databases + test connection

package info.globalcode.sql.dk;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Ing. František Kučera (frantovo.cz)
 */
public class CLIStarter {

	private static final Logger log = Logger.getLogger(CLIStarter.class.getName());

	public static void main(String[] args) {
		try {
			/** Parse options */
			CLIParser parser = new CLIParser();
			CLIOptions options = parser.parseOptions(args);


			options.validate();

			/** Show info */
			if (!options.getShowInfo().isEmpty()) {
				InfoLister infoLister = new InfoLister();
				infoLister.showInfo(options, System.err);
			}

		} catch (CLIParserException e) {
			log.log(Level.SEVERE, "Unable to parse CLI options", e);
		} catch (InvalidOptionsException e) {
			log.log(Level.SEVERE, "Invalid CLI options", e);
		}
	}
}