/**
* GeoDress - A program for reverse geocoding
* Copyright (C) 2010 Stefan T.
*
* See COPYING for Details.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package geodress.main;
import geodress.ui.command_line.GeoDressCli;
import geodress.ui.graphical.GeoDressGui;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
/**
* Starts the program and contains the
* {@link GeoDressStarter#main(String[])} method.
*
* @author Stefan T.
*/
public class GeoDressStarter {
/** Logger object */
private static Logger logger;
/**
* Starts the program.
*
* @param args
* the command line options
*/
public static void main(String[] args) {
logger = Logging.getLogger(GeoDressStarter.class.getName());
/* CLI options */
CommandLineParser parser = new PosixParser();
try {
/* parse */
CommandLine line = parser.parse(GeoDressCli.cliOptions, args);
if (line.getOptions().length == 0) {
/* start GUI */
logger.log(Level.INFO, "start GUI");
new GeoDressGui(InfoConstants.PROGRAM_TITLE);
} else {
/* start CLI */
logger.log(Level.INFO, "start CLI");
new GeoDressCli(args);
}
} catch (ParseException pe) {
GeoDressCli.showParseError(pe);
}
}
}