List of usage examples for java.util Properties load
public synchronized void load(InputStream inStream) throws IOException
From source file:net.schweerelos.parrot.CombinedParrotApp.java
/** * @param args// w w w . ja va 2s. com */ @SuppressWarnings("static-access") public static void main(String[] args) { CommandLineParser parser = new PosixParser(); // create the Options Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("help") .withDescription("Shows usage information and quits the program").create("h")); options.addOption( OptionBuilder.withLongOpt("datafile").withDescription("The file with instances to use (required)") .hasArg().withArgName("file").isRequired().create("f")); options.addOption(OptionBuilder.withLongOpt("properties") .withDescription("Properties file to use. Default: " + System.getProperty("user.home") + File.separator + ".digital-parrot" + File.separator + "parrot.properties") .hasArg().withArgName("prop").create("p")); try { // parse the command line arguments CommandLine line = parser.parse(options, args); if (line.hasOption("h")) { // this is only executed when all required options are present _and_ the help option is specified! printHelp(options); return; } String datafile = line.getOptionValue("f"); if (!datafile.startsWith("file:") || !datafile.startsWith("http:")) { datafile = "file:" + datafile; } String propertiesPath = System.getProperty("user.home") + File.separator + ".digital-parrot" + File.separator + "parrot.properties"; if (line.hasOption("p")) { propertiesPath = line.getOptionValue("p"); } final Properties properties = new Properties(); File propertiesFile = new File(propertiesPath); if (propertiesFile.exists() && propertiesFile.canRead()) { try { properties.load(new FileReader(propertiesFile)); } catch (FileNotFoundException e) { e.printStackTrace(System.err); System.exit(1); } catch (IOException e) { e.printStackTrace(System.err); System.exit(1); } } final String url = datafile; // we need a "final" var for the anonymous class SwingUtilities.invokeLater(new Runnable() { public void run() { CombinedParrotApp inst = null; try { inst = new CombinedParrotApp(properties); inst.loadModel(url); } catch (Exception e) { JOptionPane.showMessageDialog(null, "There has been an error while starting the program.\nThe program will exit now.", APP_TITLE + " Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(System.err); System.exit(1); } if (inst != null) { inst.setLocationRelativeTo(null); inst.setVisible(true); } } }); } catch (ParseException exp) { printHelp(options); } }
From source file:de.cwclan.cwsa.serverendpoint.main.ServerEndpoint.java
/** * @param args the command line arguments *//* w ww . ja v a 2 s .co m*/ public static void main(String[] args) { Options options = new Options(); options.addOption(OptionBuilder.withArgName("file").hasArg().withDescription( "Used to enter path of configfile. Default file is endpoint.properties. NOTE: If the file is empty or does not exsist, a default config is created.") .create("config")); options.addOption("h", "help", false, "displays this page"); CommandLineParser parser = new PosixParser(); Properties properties = new Properties(); try { /* * parse default config shipped with jar */ CommandLine cmd = parser.parse(options, args); /* * load default configuration */ InputStream in = ServerEndpoint.class.getResourceAsStream("/endpoint.properties"); if (in == null) { throw new IOException("Unable to load default config from JAR. This should not happen."); } properties.load(in); in.close(); log.debug("Loaded default config base: {}", properties.toString()); if (cmd.hasOption("help")) { printHelp(options); System.exit(0); } /* * parse cutom config if exists, otherwise create default cfg */ if (cmd.hasOption("config")) { File file = new File(cmd.getOptionValue("config", "endpoint.properties")); if (file.exists() && file.canRead() && file.isFile()) { in = new FileInputStream(file); properties.load(in); log.debug("Loaded custom config from {}: {}", file.getAbsoluteFile(), properties); } else { log.warn("Config file does not exsist. A default file will be created."); } FileWriter out = new FileWriter(file); properties.store(out, "Warning, this file is recreated on every startup to merge missing parameters."); } /* * create and start endpoint */ log.info("Config read successfull. Values are: {}", properties); ServerEndpoint endpoint = new ServerEndpoint(properties); Runtime.getRuntime().addShutdownHook(endpoint.getShutdownHook()); endpoint.start(); } catch (IOException ex) { log.error("Error while reading config.", ex); } catch (ParseException ex) { log.error("Error while parsing commandline options: {}", ex.getMessage()); printHelp(options); System.exit(1); } }
From source file:org.elasticsearch.repositories.s3.AmazonS3Fixture.java
public static void main(final String[] args) throws Exception { if (args == null || args.length != 2) { throw new IllegalArgumentException("AmazonS3Fixture <working directory> <property file>"); }//from w w w .j ava 2s. c om final Properties properties = new Properties(); try (InputStream is = Files.newInputStream(PathUtils.get(args[1]))) { properties.load(is); } final AmazonS3Fixture fixture = new AmazonS3Fixture(args[0], properties); fixture.listen(); }
From source file:com.cloud.consoleproxy.ConsoleProxy.java
public static void main(String[] argv) { standaloneStart = true;//from ww w . j a va 2s. co m configLog4j(); Logger.setFactory(new ConsoleProxyLoggerFactory()); InputStream confs = ConsoleProxy.class.getResourceAsStream("/conf/consoleproxy.properties"); Properties conf = new Properties(); if (confs == null) { s_logger.info("Can't load consoleproxy.properties from classpath, will use default configuration"); } else { try { conf.load(confs); } catch (Exception e) { s_logger.error(e.toString(), e); } } start(conf); }
From source file:com.github.pitzcarraldo.dissimilar.Dissimilar.java
/** * Main method/*from w w w . j a va 2 s. c om*/ * @param args command line arguments */ public static void main(String[] args) { Properties mavenProps = new Properties(); try { mavenProps.load(Dissimilar.class.getClassLoader() .getResourceAsStream("META-INF/maven/uk.bl.dpt.dissimilar/dissimilar/pom.properties")); version = mavenProps.getProperty("version"); } catch (Exception e) { } boolean calcPSNR = true; boolean calcSSIM = true; String heatMapImage = null; CommandLineParser parser = new PosixParser(); Options options = new Options(); options.addOption("m", "heatmap", true, "file to save the ssim heatmap to (png)"); options.addOption("p", "psnr", false, "calculate just psnr"); options.addOption("s", "ssim", false, "calculate just ssim"); options.addOption("h", "help", false, "help text"); CommandLine com = null; try { com = parser.parse(options, args); } catch (ParseException e) { HelpFormatter help = new HelpFormatter(); help.printHelp("Dissimilar v" + version, options); return; } if (com.hasOption("help")) { HelpFormatter help = new HelpFormatter(); help.printHelp("Dissimilar v" + version, options); return; } if (com.hasOption("psnr") & com.hasOption("ssim")) { //do nothing - both on by default } else { if (com.hasOption("psnr")) { calcPSNR = true; calcSSIM = false; } if (com.hasOption("ssim")) { calcPSNR = false; calcSSIM = true; } } if (com.hasOption("heatmap")) { heatMapImage = com.getOptionValue("heatmap"); } File one = new File(com.getArgs()[0]); File two = new File(com.getArgs()[1]); if (one.exists() && two.exists()) { compare(one, two, heatMapImage, calcSSIM, calcPSNR); } }
From source file:com.opengamma.batch.BatchJobRunner.java
/** * Creates an runs a batch job based on a properties file and configuration. *//*w w w . ja v a 2 s . c o m*/ public static void main(String[] args) throws Exception { // CSIGNORE if (args.length == 0) { usage(); System.exit(-1); } CommandLine line = null; Properties configProperties = null; final String propertyFile = "batchJob.properties"; String configPropertyFile = null; if (System.getProperty(propertyFile) != null) { configPropertyFile = System.getProperty(propertyFile); try { FileInputStream fis = new FileInputStream(configPropertyFile); configProperties = new Properties(); configProperties.load(fis); fis.close(); } catch (FileNotFoundException e) { s_logger.error("The system cannot find " + configPropertyFile); System.exit(-1); } } else { try { FileInputStream fis = new FileInputStream(propertyFile); configProperties = new Properties(); configProperties.load(fis); fis.close(); configPropertyFile = propertyFile; } catch (FileNotFoundException e) { // there is no config file so we expect command line arguments try { CommandLineParser parser = new PosixParser(); line = parser.parse(getOptions(), args); } catch (ParseException e2) { usage(); System.exit(-1); } } } RunCreationMode runCreationMode = getRunCreationMode(line, configProperties, configPropertyFile); if (runCreationMode == null) { // default runCreationMode = RunCreationMode.AUTO; } String engineURI = getProperty("engineURI", line, configProperties, configPropertyFile); String brokerURL = getProperty("brokerURL", line, configProperties, configPropertyFile); Instant valuationTime = getValuationTime(line, configProperties, configPropertyFile); LocalDate observationDate = getObservationDate(line, configProperties, configPropertyFile); UniqueId viewDefinitionUniqueId = getViewDefinitionUniqueId(line, configProperties); URI vpBase; try { vpBase = new URI(engineURI); } catch (URISyntaxException ex) { throw new OpenGammaRuntimeException("Invalid URI", ex); } ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(brokerURL); activeMQConnectionFactory.setWatchTopicAdvisories(false); JmsConnectorFactoryBean jmsConnectorFactoryBean = new JmsConnectorFactoryBean(); jmsConnectorFactoryBean.setConnectionFactory(activeMQConnectionFactory); jmsConnectorFactoryBean.setName("Masters"); JmsConnector jmsConnector = jmsConnectorFactoryBean.getObjectCreating(); ScheduledExecutorService heartbeatScheduler = Executors.newSingleThreadScheduledExecutor(); try { ViewProcessor vp = new RemoteViewProcessor(vpBase, jmsConnector, heartbeatScheduler); ViewClient vc = vp.createViewClient(UserPrincipal.getLocalUser()); HistoricalMarketDataSpecification marketDataSpecification = MarketData.historical(observationDate, null); ViewExecutionOptions executionOptions = ExecutionOptions.batch(valuationTime, marketDataSpecification, null); vc.attachToViewProcess(viewDefinitionUniqueId, executionOptions); vc.waitForCompletion(); } finally { heartbeatScheduler.shutdown(); } }
From source file:au.org.ala.names.search.DwcaNameIndexer.java
/** * Example run//from w w w . j ava 2 s .c o m * * java cp .:names.jar au.org.ala.checklist.lucene.DwcaNameIndexer * -all * -dwca /data/bie-staging/names-lists/dwca-col * -target /data/lucene/testdwc-namematching * -irmng /data/bie-staging/irmng/IRMNG_DWC_HOMONYMS * -common /data/bie-staging/ala-names/col_vernacular.txt * * @param args */ public static void main(String[] args) { final String DEFAULT_DWCA = "/data/lucene/sources/dwca-col"; final String DEFAULT_IRMNG = "/data/lucene/sources/IRMNG_DWC_HOMONYMS"; final String DEFAULT_COMMON_NAME = "/data/lucene/sources/col_vernacular.txt"; final String DEFAULT_TARGET_DIR = "/data/lucene/namematching"; final String DEFAULT_TMP_DIR = "/data/lucene/nmload-tmp"; Options options = new Options(); options.addOption("v", "version", false, "Retrieve version information"); options.addOption("h", "help", false, "Retrieve options"); options.addOption("all", false, "Generates the load index and search index"); options.addOption("load", false, "Generate the load index only. " + "The load index is a temporary index generated from the raw data files" + " used to load the main search index"); options.addOption("search", false, "Generates the search index. A load index must already be created for this to run."); options.addOption("irmng", true, "The absolute path to the unzipped irmng DwCA. IRMNG is used to detect homonyms. Defaults to " + DEFAULT_IRMNG); options.addOption("dwca", true, "The absolute path to the unzipped DwCA for the scientific names. Defaults to " + DEFAULT_DWCA); options.addOption("target", true, "The target directory to write the new name index to. Defaults to " + DEFAULT_TARGET_DIR); options.addOption("tmp", true, "The tmp directory for the load index. Defaults to " + DEFAULT_TMP_DIR); options.addOption("common", true, "The common (vernacular) name file. Defaults to " + DEFAULT_COMMON_NAME); options.addOption("testSearch", true, "Debug a name search. This uses the target directory to search against."); CommandLineParser parser = new BasicParser(); try { // parse the command line arguments CommandLine line = parser.parse(options, args); if (line.hasOption("v")) { //only load the properties file if it exists otherwise default to the biocache-test-config.properties on the classpath InputStream stream = DwcaNameIndexer.class.getResourceAsStream("/git.properties"); Properties properties = new Properties(); if (stream != null) { properties.load(stream); properties.list(System.out); } else { System.err.println("Unable to retrieve versioning information"); } System.exit(-1); } if (line.hasOption("help")) { //only load the properties file if it exists otherwise default to the biocache-test-config.properties on the classpath new HelpFormatter().printHelp("nameindexer", options); System.exit(-1); } if (line.hasOption("testSearch")) { boolean indexExists = (new File(DEFAULT_TARGET_DIR).exists()); if (indexExists) { //do a name search - with option flag pointing to index location System.out.println("Search for name"); ALANameSearcher searcher = new ALANameSearcher( line.getOptionValue("target", DEFAULT_TARGET_DIR)); NameSearchResult nsr = searcher.searchForRecord(line.getOptionValue("testSearch")); if (nsr != null) { Map<String, String> props = nsr.toMap(); for (Map.Entry<String, String> entry : props.entrySet()) { System.out.println(entry.getKey() + ": " + entry.getValue()); } } else { System.err.println("No match for " + line.getOptionValue("testSearch")); } } else { System.err.println("Index unreadable. Check " + DEFAULT_TARGET_DIR); } System.exit(-1); } boolean load = line.hasOption("load") || line.hasOption("all"); boolean search = line.hasOption("search") || line.hasOption("all"); if (!line.hasOption("load") && !line.hasOption("search") && !line.hasOption("all")) { load = true; search = true; } log.info("Generating loading index: " + load); log.info("Generating searching index: " + search); boolean defaultIrmngReadable = (new File(DEFAULT_IRMNG).exists()); boolean defaultCommonReadable = (new File(DEFAULT_COMMON_NAME).exists()); boolean defaultDwcaReadable = (new File(DEFAULT_DWCA).exists()); if (line.getOptionValue("dwca") != null) { log.info("Using the DwCA name file: " + line.getOptionValue("dwca")); } else if (defaultDwcaReadable) { log.info("Using the default DwCA name file: " + DEFAULT_DWCA); } else { log.error( "No DwC Archive specified and the default file path does not exist or is inaccessible. Default path: " + DEFAULT_DWCA); System.exit(-1); } if (line.getOptionValue("irmng") == null && !defaultIrmngReadable) { log.warn( "No IRMNG export specified and the default file path does not exist or is inaccessible. Default path: " + DEFAULT_IRMNG); } else { log.info("Using the default IRMNG name file: " + DEFAULT_IRMNG); } if (line.getOptionValue("common") == null && !defaultCommonReadable) { log.warn( "No common name export specified and the default file path does not exist or is inaccessible. Default path: " + DEFAULT_COMMON_NAME); } else { log.info("Using the default common name file: " + DEFAULT_COMMON_NAME); } File targetDirectory = new File(line.getOptionValue("target", DEFAULT_TARGET_DIR)); if (targetDirectory.exists()) { String newPath = targetDirectory.getAbsolutePath() + "_" + DateFormatUtils.format(new Date(), "yyyy-MM-dd_hh-mm-ss"); log.info("Target directory already exists. Backing up to : " + newPath); File newTargetDirectory = new File(newPath); FileUtils.moveDirectory(targetDirectory, newTargetDirectory); FileUtils.forceMkdir(targetDirectory); } DwcaNameIndexer indexer = new DwcaNameIndexer(); indexer.create(load, search, line.getOptionValue("target", DEFAULT_TARGET_DIR), line.getOptionValue("tmp", DEFAULT_TMP_DIR), line.getOptionValue("dwca", DEFAULT_DWCA), line.getOptionValue("irmng", DEFAULT_IRMNG), line.getOptionValue("common", DEFAULT_COMMON_NAME)); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.sludev.mssqlapplylog.MSSQLApplyLogMain.java
public static void main(String[] args) { CommandLineParser parser = new DefaultParser(); Options options = new Options(); // Most of the following defaults should be changed in // the --conf or "conf.properties" file String sqlURL = null;/* ww w.ja v a 2 s . c o m*/ String sqlUser = null; String sqlPass = null; String sqlDb = null; String sqlHost = "127.0.0.1"; String backupDirStr = null; String laterThanStr = ""; String fullBackupPathStr = null; String fullBackupPatternStr = "(?:[\\w_-]+?)(\\d+)\\.bak"; String fullBackupDatePatternStr = "yyyyMMddHHmm"; String sqlProcessUser = null; String logBackupPatternStr = "(.*)\\.trn"; String logBackupDatePatternStr = "yyyyMMddHHmmss"; boolean doFullRestore = false; Boolean useLogFileLastMode = null; Boolean monitorLogBackupDir = null; options.addOption(Option.builder().longOpt("conf").desc("Configuration file.").hasArg().build()); options.addOption(Option.builder().longOpt("laterthan").desc("'Later Than' file filter.").hasArg().build()); options.addOption(Option.builder().longOpt("restore-full") .desc("Restore the full backup before continuing.").build()); options.addOption(Option.builder().longOpt("use-lastmod") .desc("Sort/filter the log backups using their File-System 'Last Modified' date.").build()); options.addOption(Option.builder().longOpt("monitor-backup-dir") .desc("Monitor the backup directory for new log backups, and apply them.").build()); CommandLine line = null; try { try { line = parser.parse(options, args); } catch (ParseException ex) { throw new MSSQLApplyLogException(String.format("Error parsing command line.'%s'", ex.getMessage()), ex); } String confFile = null; // Process the command line arguments Iterator cmdI = line.iterator(); while (cmdI.hasNext()) { Option currOpt = (Option) cmdI.next(); String currOptName = currOpt.getLongOpt(); switch (currOptName) { case "conf": // Parse the configuration file confFile = currOpt.getValue(); break; case "laterthan": // "Later Than" file date filter laterThanStr = currOpt.getValue(); break; case "restore-full": // Do a full backup restore before restoring logs doFullRestore = true; break; case "monitor-backup-dir": // Monitor the backup directory for new logs monitorLogBackupDir = true; break; case "use-lastmod": // Use the last-modified date on Log Backup files for sorting/filtering useLogFileLastMode = true; break; } } Properties confProperties = null; if (StringUtils.isBlank(confFile) || Files.isReadable(Paths.get(confFile)) == false) { throw new MSSQLApplyLogException( "Missing or unreadable configuration file. Please specify --conf"); } else { // Process the conf.properties file confProperties = new Properties(); try { confProperties.load(Files.newBufferedReader(Paths.get(confFile))); } catch (IOException ex) { throw new MSSQLApplyLogException("Error loading properties file", ex); } sqlURL = confProperties.getProperty("sqlURL", ""); sqlUser = confProperties.getProperty("sqlUser", ""); sqlPass = confProperties.getProperty("sqlPass", ""); sqlDb = confProperties.getProperty("sqlDb", ""); sqlHost = confProperties.getProperty("sqlHost", ""); backupDirStr = confProperties.getProperty("backupDir", ""); if (StringUtils.isBlank(laterThanStr)) { laterThanStr = confProperties.getProperty("laterThan", ""); } fullBackupPathStr = confProperties.getProperty("fullBackupPath", fullBackupPathStr); fullBackupPatternStr = confProperties.getProperty("fullBackupPattern", fullBackupPatternStr); fullBackupDatePatternStr = confProperties.getProperty("fullBackupDatePattern", fullBackupDatePatternStr); sqlProcessUser = confProperties.getProperty("sqlProcessUser", ""); logBackupPatternStr = confProperties.getProperty("logBackupPattern", logBackupPatternStr); logBackupDatePatternStr = confProperties.getProperty("logBackupDatePattern", logBackupDatePatternStr); if (useLogFileLastMode == null) { String useLogFileLastModeStr = confProperties.getProperty("useLogFileLastMode", "false"); useLogFileLastMode = Boolean .valueOf(StringUtils.lowerCase(StringUtils.trim(useLogFileLastModeStr))); } if (monitorLogBackupDir == null) { String monitorBackupDirStr = confProperties.getProperty("monitorBackupDir", "false"); monitorLogBackupDir = Boolean .valueOf(StringUtils.lowerCase(StringUtils.trim(monitorBackupDirStr))); } } } catch (MSSQLApplyLogException ex) { try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { pw.append(String.format("Error : '%s'\n\n", ex.getMessage())); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(pw, 80, "\njava -jar mssqlapplylog.jar ", "\nThe MSSQLApplyLog application can be used in a variety of options and modes.\n", options, 0, 2, " All Rights Reserved.", true); System.out.println(sw.toString()); } catch (IOException iex) { LOGGER.debug("Error processing usage", iex); } System.exit(1); } MSSQLApplyLogConfig config = MSSQLApplyLogConfig.from(backupDirStr, fullBackupPathStr, fullBackupDatePatternStr, laterThanStr, fullBackupPatternStr, logBackupPatternStr, logBackupDatePatternStr, sqlHost, sqlDb, sqlUser, sqlPass, sqlURL, sqlProcessUser, useLogFileLastMode, doFullRestore, monitorLogBackupDir); MSSQLApplyLog logProc = MSSQLApplyLog.from(config); BasicThreadFactory thFactory = new BasicThreadFactory.Builder().namingPattern("restoreThread-%d").build(); ExecutorService mainThreadExe = Executors.newSingleThreadExecutor(thFactory); Future<Integer> currRunTask = mainThreadExe.submit(logProc); mainThreadExe.shutdown(); Integer resp = 0; try { resp = currRunTask.get(); } catch (InterruptedException ex) { LOGGER.error("Application 'main' thread was interrupted", ex); } catch (ExecutionException ex) { LOGGER.error("Application 'main' thread execution error", ex); } finally { // If main leaves for any reason, shutdown all threads mainThreadExe.shutdownNow(); } System.exit(resp); }
From source file:hu.bme.mit.sette.run.Run.java
public static void main(String[] args) { LOG.debug("main() called"); // parse properties Properties prop = new Properties(); InputStream is = null;/*from ww w . jav a 2 s .c o m*/ try { is = new FileInputStream(SETTE_PROPERTIES); prop.load(is); } catch (IOException e) { System.err.println("Parsing " + SETTE_PROPERTIES + " has failed"); e.printStackTrace(); System.exit(1); } finally { IOUtils.closeQuietly(is); } String[] basedirs = StringUtils.split(prop.getProperty("basedir"), '|'); String snippetDir = prop.getProperty("snippet-dir"); String snippetProject = prop.getProperty("snippet-project"); String catgPath = prop.getProperty("catg"); String catgVersionFile = prop.getProperty("catg-version-file"); String jPETPath = prop.getProperty("jpet"); String jPETDefaultBuildXml = prop.getProperty("jpet-default-build.xml"); String jPETVersionFile = prop.getProperty("jpet-version-file"); String spfPath = prop.getProperty("spf"); String spfDefaultBuildXml = prop.getProperty("spf-default-build.xml"); String spfVersionFile = prop.getProperty("spf-version-file"); String outputDir = prop.getProperty("output-dir"); Validate.notEmpty(basedirs, "At least one basedir must be specified in " + SETTE_PROPERTIES); Validate.notBlank(snippetDir, "The property snippet-dir must be set in " + SETTE_PROPERTIES); Validate.notBlank(snippetProject, "The property snippet-project must be set in " + SETTE_PROPERTIES); Validate.notBlank(catgPath, "The property catg must be set in " + SETTE_PROPERTIES); Validate.notBlank(jPETPath, "The property jpet must be set in " + SETTE_PROPERTIES); Validate.notBlank(spfPath, "The property spf must be set in " + SETTE_PROPERTIES); Validate.notBlank(outputDir, "The property output-dir must be set in " + SETTE_PROPERTIES); String basedir = null; for (String bd : basedirs) { bd = StringUtils.trimToEmpty(bd); if (bd.startsWith("~")) { // Linux home bd = System.getProperty("user.home") + bd.substring(1); } FileValidator v = new FileValidator(new File(bd)); v.type(FileType.DIRECTORY); if (v.isValid()) { basedir = bd; break; } } if (basedir == null) { System.err.println("basedir = " + Arrays.toString(basedirs)); System.err.println("ERROR: No valid basedir was found, please check " + SETTE_PROPERTIES); System.exit(2); } BASEDIR = new File(basedir); SNIPPET_DIR = new File(basedir, snippetDir); SNIPPET_PROJECT = snippetProject; OUTPUT_DIR = new File(basedir, outputDir); try { String catgVersion = readToolVersion(new File(BASEDIR, catgVersionFile)); if (catgVersion != null) { new CatgTool(new File(BASEDIR, catgPath), catgVersion); } String jPetVersion = readToolVersion(new File(BASEDIR, jPETVersionFile)); if (jPetVersion != null) { new JPetTool(new File(BASEDIR, jPETPath), new File(BASEDIR, jPETDefaultBuildXml), jPetVersion); } String spfVersion = readToolVersion(new File(BASEDIR, spfVersionFile)); if (spfVersion != null) { new SpfTool(new File(BASEDIR, spfPath), new File(BASEDIR, spfDefaultBuildXml), spfVersion); } // TODO stuff stuff(args); } catch (Exception e) { System.err.println(ExceptionUtils.getStackTrace(e)); ValidatorException vex = (ValidatorException) e; for (ValidationException v : vex.getValidator().getAllExceptions()) { v.printStackTrace(); } // System.exit(0); e.printStackTrace(); System.err.println("=========="); e.printStackTrace(); if (e instanceof ValidatorException) { System.err.println("Details:"); System.err.println(((ValidatorException) e).getFullMessage()); } else if (e.getCause() instanceof ValidatorException) { System.err.println("Details:"); System.err.println(((ValidatorException) e.getCause()).getFullMessage()); } } }
From source file:com.enjoyxstudy.selenium.htmlsuite.MultiHTMLSuiteRunner.java
/** * @param args//from w w w . ja v a 2 s . c o m * @throws Exception */ public static void main(String[] args) throws Exception { String propertyFile = "htmlSuite.properties"; // default if (args.length != 0) { propertyFile = args[0]; } Properties properties = new Properties(); FileInputStream inputStream = new FileInputStream(propertyFile); try { properties.load(inputStream); } finally { inputStream.close(); } MultiHTMLSuiteRunner runner = execute(properties); System.exit(runner.getResult() ? 0 : 1); }