List of usage examples for java.lang System getProperty
public static String getProperty(String key)
From source file:com.griddynamics.jagger.JaggerLauncher.java
public static void main(String[] args) throws Exception { Thread memoryMonitorThread = new Thread("memory-monitor") { @Override/*from ww w .ja v a 2s .c om*/ public void run() { for (;;) { try { log.info("Memory info: totalMemory={}, freeMemory={}", Runtime.getRuntime().totalMemory(), Runtime.getRuntime().freeMemory()); Thread.sleep(60000); } catch (InterruptedException e) { throw new RuntimeException(e); } } } }; memoryMonitorThread.setDaemon(true); memoryMonitorThread.start(); String pid = ManagementFactory.getRuntimeMXBean().getName(); System.out.println(String.format("PID:%s", pid)); Properties props = System.getProperties(); for (Map.Entry<Object, Object> prop : props.entrySet()) { log.info("{}: '{}'", prop.getKey(), prop.getValue()); } log.info(""); URL directory = new URL("file:" + System.getProperty("user.dir") + "/"); loadBootProperties(directory, args[0], environmentProperties); log.debug("Bootstrap properties:"); for (String propName : environmentProperties.stringPropertyNames()) { log.debug(" {}={}", propName, environmentProperties.getProperty(propName)); } String[] roles = environmentProperties.getProperty(ROLES).split(","); Set<String> rolesSet = Sets.newHashSet(roles); if (rolesSet.contains(Role.COORDINATION_SERVER.toString())) { launchCoordinationServer(directory); } if (rolesSet.contains(Role.HTTP_COORDINATION_SERVER.toString())) { launchCometdCoordinationServer(directory); } if (rolesSet.contains(Role.RDB_SERVER.toString())) { launchRdbServer(directory); } if (rolesSet.contains(Role.MASTER.toString())) { launchMaster(directory); } if (rolesSet.contains(Role.KERNEL.toString())) { launchKernel(directory); } if (rolesSet.contains(Role.REPORTER.toString())) { launchReporter(directory); } LaunchManager launchManager = builder.build(); int result = launchManager.launch(); System.exit(result); }
From source file:edu.harvard.hul.ois.fits.clients.FormFileUploaderClientApplication.java
/** * Run the program.//from ww w. j a v a2 s . co m * * @param args First argument is path to the file to analyze; second (optional) is path to server for overriding default value. */ public static void main(String[] args) { // takes file path from first program's argument if (args.length < 1) { logger.error("****** Path to input file must be first argument to program! *******"); logger.error("===== Exiting Program ====="); System.exit(1); } String filePath = args[0]; File uploadFile = new File(filePath); if (!uploadFile.exists()) { logger.error("****** File does not exist at expected locations! *******"); logger.error("===== Exiting Program ====="); System.exit(1); } if (args.length > 1) { serverUrl = args[1]; } logger.info("File to upload: " + filePath); CloseableHttpClient httpclient = HttpClients.createDefault(); try { HttpPost httppost = new HttpPost(serverUrl + "false"); FileBody bin = new FileBody(uploadFile); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.addPart(FITS_FORM_FIELD_DATAFILE, bin); HttpEntity reqEntity = builder.build(); httppost.setEntity(reqEntity); logger.info("executing request " + httppost.getRequestLine()); CloseableHttpResponse response = httpclient.execute(httppost); try { logger.info("HTTP Response Status Line: " + response.getStatusLine()); // Expecting a 200 Status Code if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { String reason = response.getStatusLine().getReasonPhrase(); logger.warn("Unexpected HTTP response status code:[" + response.getStatusLine().getStatusCode() + "] -- Reason (if available): " + reason); } else { HttpEntity resEntity = response.getEntity(); InputStream is = resEntity.getContent(); BufferedReader in = new BufferedReader(new InputStreamReader(is)); String output; StringBuilder sb = new StringBuilder(); while ((output = in.readLine()) != null) { sb.append(output); sb.append(System.getProperty("line.separator")); } logger.info(sb.toString()); in.close(); EntityUtils.consume(resEntity); } } finally { response.close(); } } catch (Exception e) { logger.error("Caught exception: " + e.getMessage(), e); } finally { try { httpclient.close(); } catch (IOException e) { logger.warn("Exception closing HTTP client: " + e.getMessage(), e); } logger.info("DONE"); } }
From source file:com.opengamma.batch.BatchJobRunner.java
/** * Creates an runs a batch job based on a properties file and configuration. *///from www .ja v a 2 s. co 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:com.ms.commons.test.tool.GenerateTestCase.java
public static void main(String[] args) { if (args.length < 2) { System.err.println("Usage:\r\n.frameworktest_maketests antx|maven fileter"); System.exit(-1);/*from w w w . j a v a 2 s. c o m*/ } final com.ms.commons.test.runner.filter.expression.internal.Expression filterExpression; try { System.out.println("Filter: " + args[1]); filterExpression = ExpressionParseUtil.parse(args[1], new SimpleExpressionBuiler() { public AbstractSimpleExpression build(String value) { return new StringExpressionImpl(value); } }); } catch (ParseException e) { throw ExceptionUtil.wrapToRuntimeException(e); } final FullClassNameFilter fullClassNameFilter = new FullClassNameFilter() { public boolean accept(String fullClassName) { return ((Boolean) filterExpression.evaluate(fullClassName)).booleanValue(); } }; String userDir = System.getProperty("user.dir"); ProjectPath pp = getProjectPath(args[0]); final String mainSource = userDir + File.separator + pp.getMainSource(); final String testSource = userDir + File.separator + pp.getTestSource(); FileUtil.listFiles(null, new File(mainSource), new FileFilter() { public boolean accept(File pathname) { if (pathname.isDirectory()) { return !pathname.toString().contains(".svn"); } if (pathname.toString().contains(".svn")) { return false; } if (!pathname.toString().toLowerCase().endsWith(".java")) { return false; } try { processJavaFile(pathname, testSource, fullClassNameFilter); } catch (Exception e) { System.err.println("Parse java file failed:" + pathname); e.printStackTrace(); } return false; } }); }
From source file:org.openspaces.focalserver.FocalServer.java
public static void main(String[] args) throws IOException { if (args.length < 1) { printUsage();/*w w w . j a v a2s . co m*/ System.exit(1); } LOGGER.info("\n==================================================\n" + "GigaSpaces Focal Server starting using " + Arrays.asList(args) + " \n" + "Log created by <" + System.getProperty("user.name") + "> on " + new Date().toString() + "\n" + "=================================================="); ApplicationContext applicationContext; try { applicationContext = new FileSystemXmlApplicationContext(args); } catch (Exception e) { LOGGER.fine("Failed starting GigaSpaces Focal Server using " + Arrays.asList(args) + ", will try to load from classpath. " + e.getMessage()); applicationContext = new ClassPathXmlApplicationContext(args); } }
From source file:com.hortonworks.streamline.storage.tool.SQLScriptRunner.java
public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption(option(1, "c", OPTION_CONFIG_FILE_PATH, "Config file path")); options.addOption(option(Option.UNLIMITED_VALUES, "f", OPTION_SCRIPT_PATH, "Script path to execute")); options.addOption(option(Option.UNLIMITED_VALUES, "m", OPTION_MYSQL_JAR_URL_PATH, "Mysql client jar url to download")); CommandLineParser parser = new BasicParser(); CommandLine commandLine = parser.parse(options, args); if (!commandLine.hasOption(OPTION_CONFIG_FILE_PATH) || !commandLine.hasOption(OPTION_SCRIPT_PATH) || commandLine.getOptionValues(OPTION_SCRIPT_PATH).length <= 0) { usage(options);/*from w w w. j a v a 2 s . co m*/ System.exit(1); } String confFilePath = commandLine.getOptionValue(OPTION_CONFIG_FILE_PATH); String[] scripts = commandLine.getOptionValues(OPTION_SCRIPT_PATH); String mysqlJarUrl = commandLine.getOptionValue(OPTION_MYSQL_JAR_URL_PATH); try { Map<String, Object> conf = Utils.readStreamlineConfig(confFilePath); StorageProviderConfigurationReader confReader = new StorageProviderConfigurationReader(); StorageProviderConfiguration storageProperties = confReader.readStorageConfig(conf); String bootstrapDirPath = System.getProperty("bootstrap.dir"); MySqlDriverHelper.downloadMySQLJarIfNeeded(storageProperties, bootstrapDirPath, mysqlJarUrl); SQLScriptRunner sqlScriptRunner = new SQLScriptRunner(storageProperties); try { sqlScriptRunner.initializeDriver(); } catch (ClassNotFoundException e) { System.err.println( "Driver class is not found in classpath. Please ensure that driver is in classpath."); System.exit(1); } for (String script : scripts) { sqlScriptRunner.runScriptWithReplaceDBType(script); } } catch (IOException e) { System.err.println("Error occurred while reading config file: " + confFilePath); System.exit(1); } }
From source file:com.hortonworks.registries.storage.tool.TablesInitializer.java
public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption(Option.builder("s").numberOfArgs(1).longOpt(OPTION_SCRIPT_ROOT_PATH) .desc("Root directory of script path").build()); options.addOption(Option.builder("c").numberOfArgs(1).longOpt(OPTION_CONFIG_FILE_PATH) .desc("Config file path").build()); options.addOption(Option.builder("m").numberOfArgs(1).longOpt(OPTION_MYSQL_JAR_URL_PATH) .desc("Mysql client jar url to download").build()); options.addOption(Option.builder().hasArg(false).longOpt(OPTION_EXECUTE_CREATE_TABLE) .desc("Execute 'create table' script").build()); options.addOption(Option.builder().hasArg(false).longOpt(OPTION_EXECUTE_DROP_TABLE) .desc("Execute 'drop table' script").build()); options.addOption(Option.builder().hasArg(false).longOpt(OPTION_EXECUTE_CHECK_CONNECTION) .desc("Check the connection for configured data source").build()); CommandLineParser parser = new BasicParser(); CommandLine commandLine = parser.parse(options, args); if (!commandLine.hasOption(OPTION_CONFIG_FILE_PATH) || !commandLine.hasOption(OPTION_SCRIPT_ROOT_PATH)) { usage(options);//from www . jav a 2s . c o m System.exit(1); } // either create or drop should be specified, not both boolean executeCreate = commandLine.hasOption(OPTION_EXECUTE_CREATE_TABLE); boolean executeDrop = commandLine.hasOption(OPTION_EXECUTE_DROP_TABLE); boolean checkConnection = commandLine.hasOption(OPTION_EXECUTE_CHECK_CONNECTION); boolean moreThanOneOperationIsSpecified = executeCreate == executeDrop ? executeCreate : checkConnection; boolean noOperationSpecified = !(executeCreate || executeDrop || checkConnection); if (moreThanOneOperationIsSpecified) { System.out.println( "Only one operation can be execute at once, please select 'create' or 'drop', or 'check-connection'."); System.exit(1); } else if (noOperationSpecified) { System.out.println( "One of 'create', 'drop', 'check-connection' operation should be specified to execute."); System.exit(1); } String confFilePath = commandLine.getOptionValue(OPTION_CONFIG_FILE_PATH); String scriptRootPath = commandLine.getOptionValue(OPTION_SCRIPT_ROOT_PATH); String mysqlJarUrl = commandLine.getOptionValue(OPTION_MYSQL_JAR_URL_PATH); StorageProviderConfiguration storageProperties; try { Map<String, Object> conf = Utils.readConfig(confFilePath); StorageProviderConfigurationReader confReader = new StorageProviderConfigurationReader(); storageProperties = confReader.readStorageConfig(conf); } catch (IOException e) { System.err.println("Error occurred while reading config file: " + confFilePath); System.exit(1); throw new IllegalStateException("Shouldn't reach here"); } String bootstrapDirPath = null; try { bootstrapDirPath = System.getProperty("bootstrap.dir"); MySqlDriverHelper.downloadMySQLJarIfNeeded(storageProperties, bootstrapDirPath, mysqlJarUrl); } catch (Exception e) { System.err.println("Error occurred while downloading MySQL jar. bootstrap dir: " + bootstrapDirPath); System.exit(1); throw new IllegalStateException("Shouldn't reach here"); } try { SQLScriptRunner sqlScriptRunner = new SQLScriptRunner(storageProperties); try { sqlScriptRunner.initializeDriver(); } catch (ClassNotFoundException e) { System.err.println( "Driver class is not found in classpath. Please ensure that driver is in classpath."); System.exit(1); } if (checkConnection) { if (!sqlScriptRunner.checkConnection()) { System.exit(1); } } else if (executeDrop) { doExecuteDrop(sqlScriptRunner, storageProperties, scriptRootPath); } else { // executeCreate doExecuteCreate(sqlScriptRunner, storageProperties, scriptRootPath); } } catch (IOException e) { System.err.println("Error occurred while reading script file. Script root path: " + scriptRootPath); System.exit(1); } }
From source file:edu.duke.igsp.gkde.Main.java
public static void main(String[] argv) throws Exception { Options opts = new Options(); opts.addOption("s", true, "wiggle track step (default=1)"); opts.addOption("l", true, "feature length (default=600)"); opts.addOption("f", true, "fragment size (default=estimated from data)"); // opts.addOption("b", true, "bandwidth (default=200)"); // opts.addOption("w", true, "window (default=3800"); opts.addOption("wg", true, "wg threshold set (defualt = calculated)"); opts.addOption("c", true, "genomic total read weight (defualt = calculated)"); opts.addOption("h", false, "print usage"); opts.addOption(OptionBuilder.withArgName("input dir").hasArg() .withDescription("input directory (default=current directory)").isRequired(false).create("d")); opts.addOption(OptionBuilder.withArgName("output dir").hasArg() .withDescription("output directory (default=current directory)").isRequired(false).create("o")); opts.addOption(OptionBuilder.withArgName("background dir").hasArg() .withDescription("background directory (default=none)").isRequired(false).create("b")); opts.addOption(OptionBuilder.withArgName("ploidy dir").hasArg() .withDescription("ploidy/input directory (default=none)").isRequired(false).create("p")); opts.addOption(OptionBuilder.withArgName("wig | bed | npf").hasArg() .withDescription("output format (default wig)").isRequired(false).create("of")); opts.addOption(OptionBuilder.withArgName("dnase | chip | faire | atac").hasArg() .withDescription("input data").isRequired(true).create("in")); opts.addOption(OptionBuilder.withArgName("weight clip").hasArg() .withDescription("weight clip value (default none)").isRequired(false).create("wc")); opts.addOption("t", true, "threshold (standard deviations) (default=4.0)"); // opts.addOption("r", true, "background ratio (default=2.0)"); opts.addOption("v", false, "verbose output"); CommandLineParser parser = new GnuParser(); int fragment_size = -1; int fragment_offset = 0; long featureLength = 600l; // float thresh = 2; float threshold = KDEChromosome.Settings.DEFAULT_THRESHOLD; int step = 1; boolean showHelp = false; boolean verbose = false; String inputDirectory = null; String backgroundDirectory = null; String ploidyDirectory = null; String[] files = null;/* w w w . ja v a2 s . co m*/ String[] bgfiles = {}; String[] ipfiles = {}; String outputFormat = "wig"; String inputDataType = "dnase"; File outputDirectory = new File(System.getProperty("user.dir")); long bandwidth = 0l; long window = 0l; double ncuts = 0.0d; float temp_threshold = 0f; int weight_clip = 0; System.out.println("F-Seq Version 1.85"); try { CommandLine cmd = parser.parse(opts, argv); showHelp = (cmd.hasOption("h")); verbose = (cmd.hasOption("v")); if (cmd.hasOption("s")) step = Integer.parseInt(cmd.getOptionValue("s")); if (cmd.hasOption("f")) fragment_size = Integer.parseInt(cmd.getOptionValue("f")); if (cmd.hasOption("d")) //input directory inputDirectory = cmd.getOptionValue("d"); if (cmd.hasOption("b")) //background directory backgroundDirectory = cmd.getOptionValue("b"); if (cmd.hasOption("p")) //ploidy|input directory ploidyDirectory = cmd.getOptionValue("p"); if (cmd.hasOption("l")) // bandwidth featureLength = Long.parseLong(cmd.getOptionValue("l")); if (cmd.hasOption("of")) { // output format outputFormat = cmd.getOptionValue("of"); if (!outputFormat.equals("wig") && !outputFormat.equals("bed") && !outputFormat.equals("npf")) { System.out.println("Parameter error: output format must be 'wig' or 'bed'."); showHelp = true; } } if (cmd.hasOption("in")) { // input data type inputDataType = cmd.getOptionValue("in"); if (!inputDataType.equals("dnase") && !inputDataType.equals("chip") && !inputDataType.equals("faire") && !inputDataType.equals("atac")) { System.out.println( "Parameter error: input data type must be 'dnase', 'chip', 'faire', or 'atac'."); showHelp = true; } } if (cmd.hasOption("wc")) { // weight clip weight_clip = Integer.parseInt(cmd.getOptionValue("wc")); } if (cmd.hasOption("t")) { // threshold (standard deviations) threshold = Float.parseFloat(cmd.getOptionValue("t")); } if (cmd.hasOption("o")) { // output directory String out = cmd.getOptionValue("o"); outputDirectory = new File(out); if (!outputDirectory.exists() && !outputDirectory.isDirectory()) { System.out.println("Output directory '" + out + "' is not a valid directory."); showHelp = true; } } if (cmd.hasOption("wg")) temp_threshold = Float.parseFloat(cmd.getOptionValue("wg")); if (cmd.hasOption("c")) ncuts = Double.parseDouble(cmd.getOptionValue("c")); // TESTING ONLY // if(cmd.hasOption("w")) // window // window = Long.parseLong(cmd.getOptionValue("w")); //if(cmd.hasOption("b")) // window // bandwidth = Long.parseLong(cmd.getOptionValue("b")); files = cmd.getArgs(); // input files //bgfiles = cmd.getArgs(); // background files } catch (Exception e) { System.out.println("Error parsing arguments: " + e.getMessage()); e.printStackTrace(); showHelp = true; } if (showHelp || (inputDirectory == null && files.length == 0)) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("fseq [options]... [file(s)]...", opts); System.exit(1); } File[] pfiles = getFiles(inputDirectory, files); File[] background_files = getFiles(backgroundDirectory, bgfiles); File[] ploidy_files = getFiles(ploidyDirectory, ipfiles); KDEChromosome[] chrs = null; // assume all files are of the same type, if not we'll get parsing errors String path = pfiles[0].getPath(); String extension = path.substring(path.lastIndexOf('.')).toLowerCase(); System.out.println("Path: " + path + ", extension: " + extension); if (extension.equals(".bed")) { System.out.println("Parsing BED file."); chrs = BedReader.read(pfiles); } else if (extension.equals(".sam") || extension.equals(".bam")) { System.out.println("Parsing SAM/BAM file."); chrs = SamReader.read(pfiles, weight_clip); } //KDEChromosome[] input = BedReader.read(ifiles); //compute fragment offset if (fragment_size == -1) { fragment_size = wgShiftCalc(chrs); } fragment_offset = (int) (fragment_size / 2); if (ncuts == 0.0d) { for (int i = 0; i < chrs.length; ++i) { // computes the total read weight of all cuts on a chromosome ncuts += chrs[i].getTotalWeight(); } } KDEChromosome.Settings settings = null; if (bandwidth > 0 || window > 0) { settings = new KDEChromosome.Settings(bandwidth, window, threshold, fragment_offset, ncuts, inputDataType); } else { settings = new KDEChromosome.Settings(featureLength, threshold, fragment_offset, ncuts, inputDataType); } float wg_threshold = wgThreshold(settings, chrs); if (temp_threshold != 0f) { wg_threshold = temp_threshold; } //KDEChromosome.Settings bg_settings = null; //bg_settings = new KDEChromosome.Settings(featureLength*2, threshold, fragment_offset); //int background_size = 0; //int input_size = 0; //float bg_ratio = 0; //float sd = 0; if (verbose) { System.out.println("Settings: "); System.out.println("\twindow=" + (settings.window * 2)); System.out.println("\tbandwidth=" + (settings.bandwidth)); //System.out.println("\tfragment offset=" + (settings.offset)); System.out.println("\tthreshold = " + wg_threshold); System.out.println("\test. fragment size = " + fragment_size); System.out.println("\tsequence length = " + chrs[0].getSequenceLength()); } // if(backgroundDirectory != null) { // for(int i = 0; i < input.length; ++i) { // background_size += input[i].getLength(); // } // for(int i = 0; i < chrs.length; ++i) { // input_size += chrs[i].getLength(); // } // bg_ratio = (float)input_size/(float)background_size; // sd = computeSD(bg_settings, input); // //System.out.println("Sample Ratio: " + bg_ratio); // //System.out.println("Input Size: " + input_size); // //System.out.println("Background Size: " + background_size); // //System.out.println("Input standard deviation: " + (settings.threshold * (float)Math.sqrt((double)bg_ratio * (double)sd * (double)sd))); // //System.out.println("Data standard deviation: " + settings.threshold * computeSD(settings, chrs)); // } for (int i = 0; i < chrs.length; ++i) { if (chrs[i].getFirstPos() == chrs[i].getLastPos()) { System.out.println("Warning: " + chrs[i].getChromosome() + " has size zero. Skipping."); continue; } File ofile = Util.makeUniqueFileWithExtension(outputDirectory, chrs[i].getChromosome(), outputFormat); DensityWriter dw = null; if (outputFormat.equals("wig")) { dw = new WiggleDensityWriter(ofile, chrs[i].getChromosome(), chrs[i].getFirstPos(), step); } else { if (outputFormat.equals("npf")) { dw = new NpfDensityWriter(ofile, chrs[i].getChromosome(), chrs[i].getFirstPos(), step); } else { dw = new BedDensityWriter(ofile, chrs[i].getChromosome(), chrs[i].getFirstPos(), step); } } //Function takes all? or new function for each? // if(backgroundDirectory != null) { // boolean hit = false; // for(int j = 0; j < background_files.length; ++j) { // if(background_files[j].getName().equals(chrs[i].getChromosome() + ".bff")) { // System.out.println("Running background on Chromosome " + chrs[i].getChromosome()); // chrs[i].runBG(settings, dw, verbose, wg_threshold, background_files[j]); // hit = true; // } // } // if(!hit) // System.out.println("No background for Chromosome " + chrs[i].getChromosome()); // } else { // if(ploidyDirectory !=) // chrs[i].run(settings, dw, verbose, wg_threshold); // } chrs[i].run(settings, dw, verbose, wg_threshold, background_files, ploidy_files); dw.close(); } //kde.showGraph(); }
From source file:com.sshtools.j2ssh.agent.SshAgentSocketListener.java
/** * The main entry point for the application. This method currently accepts * the -start parameter which will look for the sshtools.agent system * property. To configure the agent and to get a valid location call with * -configure, set the system sshtools.home system property and start. * * @param args the programs arguments/*from w w w . j a v a 2s. c o m*/ */ public static void main(String[] args) { if (args.length > 0) { if (args[0].equals("-start")) { Thread thread = new Thread(new Runnable() { public void run() { try { SshAgentSocketListener agent = new SshAgentSocketListener( System.getProperty("sshtools.agent"), new KeyStore()); agent.start(); } catch (Exception ex) { ex.printStackTrace(); } } }); thread.start(); } if (args[0].equals("-configure")) { System.out.println("SET SSHTOOLS_AGENT=localhost:" + String.valueOf(configureNewLocation())); } } }
From source file:com.jsystem.j2autoit.AutoItAgent.java
/** * Launch the server side//from ww w . ja v a 2s. c om * * @param args */ public static void main(String[] args) { try { Log.initLog(); isDebug = AutoItProperties.DEBUG_MODE_KEY.getValue(isDebug); isAutoDeleteFiles = AutoItProperties.AUTO_DELETE_TEMPORARY_SCRIPT_FILE_KEY.getValue(isAutoDeleteFiles); if (isAutoDeleteFiles) { Integer tempHistory = AutoItProperties.AUTO_IT_SCRIPT_HISTORY_SIZE_KEY .getValue(DEFAULT_HistorySize); HistoryFile.init(); HistoryFile.setHistory_Size(tempHistory); } isForceAutoItShutDown = AutoItProperties.FORCE_AUTO_IT_PROCESS_SHUTDOWN_KEY .getValue(isForceAutoItShutDown); webServicePort = AutoItProperties.AGENT_PORT_KEY.getValue(webServicePort); serverState = AutoItProperties.SERVER_UP_ON_INIT_KEY.getValue(serverState); Log.setLogMode(false, isDebug); Runtime.getRuntime().addShutdownHook(new ExitThread()); Log.info(System.getProperty("user.dir") + NEW_LINE); Log.info("AutoIt Location: " + getAutoExecuterItLocation("Unable to find") + NEW_LINE); startAutoItWebServer(webServicePort); if (serverState) { serverState = false; runWebServer(); } UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception exception) { Log.throwable(exception.getMessage() + NEW_LINE, exception); } /* Turn off metal's use of bold fonts */ UIManager.put("swing.boldMetal", Boolean.FALSE); //Schedule a job for the event-dispatching thread: //adding TrayIcon. SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); }