List of usage examples for java.nio.file Paths get
public static Path get(String first, String... more)
From source file:Main.java
public static void main(String[] args) throws Exception { long time = System.currentTimeMillis(); FileTime fileTime = FileTime.fromMillis(time); Path path = Paths.get("C:/tutorial/Java/JavaFX", "Topic.txt"); try {//from w w w .j a va 2 s .c o m Files.setLastModifiedTime(path, fileTime); } catch (IOException e) { System.err.println(e); } }
From source file:Main.java
public static void main(String[] args) { Path copy_from_1 = Paths.get("C:/tutorial/Java/JavaFX", "tutor.txt"); Path copy_to_1 = Paths.get("C:/tutorial/Java/USOpen", copy_from_1.getFileName().toString()); try {//from w ww .ja v a 2 s . co m Files.copy(copy_from_1, copy_to_1, REPLACE_EXISTING, COPY_ATTRIBUTES, NOFOLLOW_LINKS); } catch (IOException e) { System.err.println(e); } }
From source file:io.anserini.util.SearchTimeUtil.java
public static void main(String[] args) throws IOException, ParseException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException { if (args.length != 1) { System.err.println("Usage: SearchTimeUtil <indexDir>"); System.err.println("indexDir: index directory"); System.exit(1);/*from w ww. j av a 2 s . c o m*/ } String[] topics = { "topics.web.1-50.txt", "topics.web.51-100.txt", "topics.web.101-150.txt", "topics.web.151-200.txt", "topics.web.201-250.txt", "topics.web.251-300.txt" }; SearchWebCollection searcher = new SearchWebCollection(args[0]); for (String topicFile : topics) { Path topicsFile = Paths.get("src/resources/topics-and-qrels/", topicFile); TopicReader tr = (TopicReader) Class.forName("io.anserini.search.query." + "Webxml" + "TopicReader") .getConstructor(Path.class).newInstance(topicsFile); SortedMap<Integer, String> queries = tr.read(); for (int i = 1; i <= 3; i++) { final long start = System.nanoTime(); String submissionFile = File.createTempFile(topicFile + "_" + i, ".tmp").getAbsolutePath(); RerankerCascade cascade = new RerankerCascade(); cascade.add(new IdentityReranker()); searcher.search(queries, submissionFile, new BM25Similarity(0.9f, 0.4f), 1000, cascade); final long durationMillis = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS); System.out.println(topicFile + "_" + i + " search completed in " + DurationFormatUtils.formatDuration(durationMillis, "mm:ss:SSS")); } } searcher.close(); }
From source file:es.uam.eps.ir.ranksys.examples.RerankerExample.java
public static void main(String[] args) throws Exception { String trainDataPath = args[0]; String featurePath = args[1]; String recIn = args[2];/* w w w .j a va 2s .c o m*/ int cutoff = 100; PreferenceData<Long, Long> trainData = SimplePreferenceData .load(SimpleRatingPreferencesReader.get().read(trainDataPath, lp, lp)); FeatureData<Long, String, Double> featureData = SimpleFeatureData .load(SimpleFeaturesReader.get().read(featurePath, lp, sp)); Map<String, Supplier<Reranker<Long, Long>>> rerankersMap = new HashMap<>(); rerankersMap.put("MMR", () -> { double lambda = 0.5; ItemDistanceModel<Long> dist = new JaccardFeatureItemDistanceModel<>(featureData); return new MMR<>(lambda, cutoff, dist); }); rerankersMap.put("xQuAD", () -> { double lambda = 0.5; IntentModel<Long, Long, String> intentModel = new FeatureIntentModel<>(trainData, featureData); AspectModel<Long, Long, String> aspectModel = new ScoresAspectModel<>(intentModel); return new XQuAD<>(aspectModel, lambda, cutoff, true); }); rerankersMap.put("RxQuAD", () -> { double alpha = 0.5; double lambda = 0.5; IntentModel<Long, Long, String> intentModel = new FeatureIntentModel<>(trainData, featureData); AspectModel<Long, Long, String> aspectModel = new ScoresRelevanceAspectModel<>(intentModel); return new AlphaXQuAD<>(aspectModel, alpha, lambda, cutoff, true); }); rerankersMap.put("PM", () -> { double alpha = 0.5; double lambda = 0.9; BinomialModel<Long, Long, String> binomialModel = new BinomialModel<>(false, Stream.empty(), trainData, featureData, alpha); return new PM<>(featureData, binomialModel, lambda, cutoff); }); RecommendationFormat<Long, Long> format = new SimpleRecommendationFormat<>(lp, lp); rerankersMap.forEach(Unchecked.biConsumer((name, rerankerSupplier) -> { String recOut = Paths.get(Paths.get(recIn).getParent().toString(), String.format("%s-%s", name, FilenameUtils.getName(recIn))).toString(); System.out.printf("running %s, output to %s\n", name, recOut); Reranker<Long, Long> reranker = rerankerSupplier.get(); try (RecommendationFormat.Writer<Long, Long> writer = format.getWriter(recOut)) { format.getReader(recIn).readAll().map(rec -> reranker.rerankRecommendation(rec, cutoff)) .forEach(Unchecked.consumer(writer::write)); } })); }
From source file:model.experiments.stickyprices.StickyPricesCSVPrinter.java
public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { //set defaults //create directory Files.createDirectories(Paths.get("runs", "rawdata")); System.out.println("SELLERS"); System.out.println("figure 1 to 5"); simpleSellerRuns();/*from www.j a va2 s .c o m*/ System.out.println("figure 6-7"); simpleDelaySweep(50, 50, 50, 5); System.out.println("ONE SECTOR"); System.out.println("figure 8"); sampleMonopolistRunLearned(0, 101, 1, 1, 14, .1f, .1f, "sampleMonopolist.csv"); System.out.println("figure 9"); sampleCompetitiveRunLearned(0, 101, 1, 1, 14, .1f, .1f, "sampleCompetitive.csv"); System.out.println("figure 10"); woodMonopolistSweep(new BigDecimal("0.00"), new BigDecimal("3"), new BigDecimal("0.00"), new BigDecimal("3"), new BigDecimal(".01"), 1); System.out.println("SUPPLY CHAIN"); System.out.println("figure 11"); badlyOptimizedNoInventorySupplyChain(0, 0f, 2f, 0, Paths.get("runs", "rawdata", "badlyOptimized.csv").toFile(), false); System.out.println("figure 12"); badlyOptimizedNoInventorySupplyChain(0, 0f, .2f, 0, Paths.get("runs", "rawdata", "timidBadlyOptimized.csv").toFile(), false); System.out.println("figure 13"); badlyOptimizedNoInventorySupplyChain(0, 0f, .2f, 100, Paths.get("runs", "rawdata", "stickyBadlyOptimized.csv").toFile(), false); System.out.println("figure 14"); woodMonopolistSupplyChainSweep(); System.out.println("Market Structure"); System.out.println("figure 15-16-17"); oneHundredAllLearnedRuns(Paths.get("runs", "rawdata", "learnedInventoryChain100.csv").toFile(), null, null); oneHundredAllLearnedCompetitiveRuns( Paths.get("runs", "rawdata", "learnedCompetitiveInventoryChain100.csv").toFile()); oneHundredAllLearnedFoodRuns(Paths.get("runs", "rawdata", "learnedInventoryFoodChain100.csv").toFile()); System.out.println("figure 18-19"); oneHundredLearningMonopolist(Paths.get("runs", "rawdata", "100Monopolists.csv").toFile()); oneHundredLearningCompetitive(Paths.get("runs", "rawdata", "100Competitive.csv").toFile()); System.out.println("figure 20-21-22"); oneHundredAllLearningRuns(Paths.get("runs", "rawdata", "learningInventoryChain100.csv").toFile(), null, null); oneHundredAllLearningCompetitiveRuns( Paths.get("runs", "rawdata", "learningCompetitiveInventoryChain100.csv").toFile()); oneHundredAllLearningFoodRuns(Paths.get("runs", "rawdata", "learningInventoryFoodChain100.csv").toFile()); System.out.println("figure 23"); badlyOptimizedNoInventorySupplyChain(1, 0f, 0.2f, 0, Paths.get("runs", "rawdata", "tuningTrial.csv").toFile(), true); }
From source file:diffhunter.DiffHunter.java
/** * @param args the command line arguments * @throws org.apache.commons.cli.ParseException * @throws java.io.IOException//from w w w. j a v a 2s . co m */ public static void main(String[] args) throws ParseException, IOException { //String test_ = Paths.get("J:\\VishalData\\additional\\", "Sasan" + "_BDB").toAbsolutePath().toString(); // TODO code application logic here /*args = new String[] { "-i", "-b", "J:\\VishalData\\additional\\Ptbp2_E18_5_cortex_CLIP_mm9_plus_strand_sorted.bed", "-r", "J:\\VishalData\\additional\\mouse_mm9.txt", "-o", "J:\\VishalData" };*/ /*args = new String[] { "-c", "-r", "J:\\VishalData\\additional\\mouse_mm9.txt", "-1", "J:\\VishalData\\Ptbp2_Adult_testis_CLIP_mm9_plus_strand_sorted_BDB", "-2", "J:\\VishalData\\Ptbp2_E18_5_cortex_CLIP_mm9_plus_strand_sorted_BDB", "-w", "200", "-s", "50", "-o", "J:\\VishalData" };*/ Options options = new Options(); // add t option options.addOption("i", "index", false, "Indexing BED files."); options.addOption("b", "bed", true, "bed file to be indexed"); options.addOption("o", "output", true, "Folder that the index/comparison file will be created."); options.addOption("r", "reference", true, "Reference annotation file to be used for indexing"); options.addOption("c", "compare", false, "Finding differences between two conditions"); options.addOption("1", "first", true, "First sample index location"); options.addOption("2", "second", true, "Second sample index location"); options.addOption("w", "window", true, "Length of window for identifying differences"); options.addOption("s", "sliding", true, "Length of sliding"); CommandLineParser parser = new BasicParser(); CommandLine cmd = parser.parse(options, args); boolean indexing = false; boolean comparing = false; //Indexing! if (cmd.hasOption("i")) { //if(cmd.hasOption("1")) //System.err.println("sasan"); //System.out.println("sasa"); indexing = true; } else if (cmd.hasOption("c")) { //System.err.println(""); comparing = true; } else { //System.err.println("Option is not deteced."); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("diffhunter", options); return; } //Indexing is selected // if (indexing == true) { //Since indexing is true. //User have to provide file for indexing. if (!(cmd.hasOption("o") || cmd.hasOption("r") || cmd.hasOption("b"))) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("diffhunter", options); return; } String bedfile_ = cmd.getOptionValue("b"); String reference_file = cmd.getOptionValue("r"); String folder_loc = cmd.getOptionValue("o"); String sample_name = FilenameUtils.getBaseName(bedfile_); try (Database B2 = BerkeleyDB_Box.Get_BerkeleyDB( Paths.get(folder_loc, sample_name + "_BDB").toAbsolutePath().toString(), true, sample_name)) { Indexer indexing_ = new Indexer(reference_file); indexing_.Make_Index(B2, bedfile_, Paths.get(folder_loc, sample_name + "_BDB").toAbsolutePath().toString()); B2.close(); } } else if (comparing == true) { if (!(cmd.hasOption("o") || cmd.hasOption("w") || cmd.hasOption("s") || cmd.hasOption("1") || cmd.hasOption("2"))) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("diffhunter", options); return; } String folder_loc = cmd.getOptionValue("o"); int window_ = Integer.parseInt(cmd.getOptionValue("w")); //int window_=600; int slide_ = Integer.parseInt(cmd.getOptionValue("s")); String first = cmd.getOptionValue("1").replace("_BDB", ""); String second = cmd.getOptionValue("2").replace("_BDB", ""); String reference_file = cmd.getOptionValue("r"); //String folder_loc=cmd.getOptionValue("o"); String sample_name_first = FilenameUtils.getBaseName(first); String sample_name_second = FilenameUtils.getBaseName(second); Database B1 = BerkeleyDB_Box.Get_BerkeleyDB(first + "_BDB", false, sample_name_first); Database B2 = BerkeleyDB_Box.Get_BerkeleyDB(second + "_BDB", false, sample_name_second); List<String> first_condition_genes = Files .lines(Paths.get(first + "_BDB", sample_name_first + ".txt").toAbsolutePath()) .collect(Collectors.toList()); List<String> second_condition_genes = Files .lines(Paths.get(second + "_BDB", sample_name_second + ".txt").toAbsolutePath()) .collect(Collectors.toList()); System.out.println("First and second condition are loaded!!! "); List<String> intersection_ = new ArrayList<>(first_condition_genes); intersection_.retainAll(second_condition_genes); BufferedWriter output = new BufferedWriter( new FileWriter(Paths.get(folder_loc, "differences_" + window_ + "_s" + slide_ + "_c" + ".txt") .toAbsolutePath().toString(), false)); List<Result_Window> final_results = Collections.synchronizedList(new ArrayList<>()); Worker_New worker_class = new Worker_New(); worker_class.Read_Reference(reference_file); while (!intersection_.isEmpty()) { List<String> selected_genes = new ArrayList<>(); //if (intersection_.size()<=10000){selected_genes.addAll(intersection_.subList(0, intersection_.size()));} //else selected_genes.addAll(intersection_.subList(0, 10000)); if (intersection_.size() <= intersection_.size()) { selected_genes.addAll(intersection_.subList(0, intersection_.size())); } else { selected_genes.addAll(intersection_.subList(0, intersection_.size())); } intersection_.removeAll(selected_genes); //System.out.println("Intersection count is:"+intersection_.size()); //final List<Result_Window> resultssss_=new ArrayList<>(); IntStream.range(0, selected_genes.size()).parallel().forEach(i -> { System.out.println(selected_genes.get(i) + "\tprocessing......"); String gene_of_interest = selected_genes.get(i);//"ENSG00000142657|PGD";//intersection_.get(6);////"ENSG00000163395|IGFN1";//"ENSG00000270066|SCARNA2"; int start = worker_class.dic_genes.get(gene_of_interest).start_loc; int end = worker_class.dic_genes.get(gene_of_interest).end_loc; Map<Integer, Integer> first_ = Collections.EMPTY_MAP; try { first_ = BerkeleyDB_Box.Get_Coord_Read(B1, gene_of_interest); } catch (IOException | ClassNotFoundException ex) { Logger.getLogger(DiffHunter.class.getName()).log(Level.SEVERE, null, ex); } Map<Integer, Integer> second_ = Collections.EMPTY_MAP; try { second_ = BerkeleyDB_Box.Get_Coord_Read(B2, gene_of_interest); } catch (IOException | ClassNotFoundException ex) { Logger.getLogger(DiffHunter.class.getName()).log(Level.SEVERE, null, ex); } List<Window> top_windows_first = worker_class.Get_Top_Windows(window_, first_, slide_); List<Window> top_windows_second = worker_class.Get_Top_Windows(window_, second_, slide_); //System.out.println("passed for window peak call for gene \t"+selected_genes.get(i)); // System.out.println("top_window_first_Count\t"+top_windows_first.size()); // System.out.println("top_window_second_Count\t"+top_windows_second.size()); if (top_windows_first.isEmpty() && top_windows_second.isEmpty()) { return; } List<Result_Window> res_temp = new Worker_New().Get_Significant_Windows(gene_of_interest, start, end, top_windows_first, top_windows_second, second_, first_, sample_name_first, sample_name_second, 0.01); if (!res_temp.isEmpty()) { final_results.addAll(res_temp);//final_results.addAll(worker_class.Get_Significant_Windows(gene_of_interest, start, end, top_windows_first, top_windows_second, second_, first_, first_condition, second_condition, 0.01)); } //System.out.println(selected_genes.get(i)+"\tprocessed."); }); /*selected_genes.parallelStream().forEach(i -> { });*/ List<Double> pvals = new ArrayList<>(); for (int i = 0; i < final_results.size(); i++) { pvals.add(final_results.get(i).p_value); } List<Double> qvals = MultipleTestCorrection.benjaminiHochberg(pvals); System.out.println("Writing to file..."); output.append("Gene_Symbol\tContributing_Sample\tStart\tEnd\tOddsRatio\tp_Value\tFDR"); output.newLine(); for (int i = 0; i < final_results.size(); i++) { Result_Window item = final_results.get(i); output.append(item.associated_gene_symbol + "\t" + item.contributing_windows + "\t" + item.start_loc + "\t" + item.end_loc + "\t" + item.oddsratio_ + "\t" + item.p_value + "\t" + qvals.get(i)); //+ "\t" + item.average_other_readcount_cotributing + "\t" + item.average_other_readcount_cotributing + "\t" + item.average_window_readcount_non + "\t" + item.average_other_readcount_non); output.newLine(); } /* for (Result_Window item : final_results) { output.append(item.associated_gene_symbol + "\t" + item.contributing_windows + "\t" + item.start_loc + "\t" + item.end_loc + "\t" + item.oddsratio_ + "\t" + item.p_value); //+ "\t" + item.average_other_readcount_cotributing + "\t" + item.average_other_readcount_cotributing + "\t" + item.average_window_readcount_non + "\t" + item.average_other_readcount_non); output.newLine(); } */ final_results.clear(); } output.close(); } System.out.println("Done."); }
From source file:org.mitre.mpf.rest.client.Main.java
public static void main(String[] args) throws RestClientException, IOException, InterruptedException { System.out.println("Starting rest-client!"); //not necessary for localhost, but left if a proxy configuration is needed //System.setProperty("http.proxyHost",""); //System.setProperty("http.proxyPort",""); String currentDirectory;/*from ww w . j av a 2 s.c o m*/ currentDirectory = System.getProperty("user.dir"); System.out.println("Current working directory : " + currentDirectory); String username = "mpf"; String password = "mpf123"; byte[] encodedBytes = Base64.encodeBase64((username + ":" + password).getBytes()); String base64 = new String(encodedBytes); System.out.println("encodedBytes " + base64); final String mpfAuth = "Basic " + base64; RequestInterceptor authorize = new RequestInterceptor() { @Override public void intercept(HttpRequestBase request) { request.addHeader("Authorization", mpfAuth /*credentials*/); } }; //RestClient client = RestClient.builder().requestInterceptor(authorize).build(); CustomRestClient client = (CustomRestClient) CustomRestClient.builder() .restClientClass(CustomRestClient.class).requestInterceptor(authorize).build(); //getAvailableWorkPipelineNames String url = "http://localhost:8080/workflow-manager/rest/pipelines"; Map<String, String> params = new HashMap<String, String>(); List<String> availableWorkPipelines = client.get(url, params, new TypeReference<List<String>>() { }); System.out.println("availableWorkPipelines size: " + availableWorkPipelines.size()); System.out.println(Arrays.toString(availableWorkPipelines.toArray())); //processMedia JobCreationRequest jobCreationRequest = new JobCreationRequest(); URI uri = Paths.get(currentDirectory, "/trunk/workflow-manager/src/test/resources/samples/meds/aa/S001-01-t10_01.jpg").toUri(); jobCreationRequest.getMedia().add(new JobCreationMediaData(uri.toString())); uri = Paths.get(currentDirectory, "/trunk/workflow-manager/src/test/resources/samples/meds/aa/S008-01-t10_01.jpg").toUri(); jobCreationRequest.getMedia().add(new JobCreationMediaData(uri.toString())); jobCreationRequest.setExternalId("external id"); //get first DLIB pipeline String firstDlibPipeline = availableWorkPipelines.stream() //.peek(pipepline -> System.out.println("will filter - " + pipepline)) .filter(pipepline -> pipepline.startsWith("DLIB")).findFirst().get(); System.out.println("found firstDlibPipeline: " + firstDlibPipeline); jobCreationRequest.setPipelineName(firstDlibPipeline); //grabbed from 'rest/pipelines' - see #1 //two optional params jobCreationRequest.setBuildOutput(true); //jobCreationRequest.setPriority(priority); //will be set to 4 (default) if not set JobCreationResponse jobCreationResponse = client.customPostObject( "http://localhost:8080/workflow-manager/rest/jobs", jobCreationRequest, JobCreationResponse.class); System.out.println("jobCreationResponse job id: " + jobCreationResponse.getJobId()); System.out.println("\n---Sleeping for 10 seconds to let the job process---\n"); Thread.sleep(10000); //getJobStatus url = "http://localhost:8080/workflow-manager/rest/jobs"; // /status"; params = new HashMap<String, String>(); //OPTIONAL //params.put("v", "") - no versioning currently implemented //id is now a path var - if not set, all job info will returned url = url + "/" + Long.toString(jobCreationResponse.getJobId()); SingleJobInfo jobInfo = client.get(url, params, SingleJobInfo.class); System.out.println("jobInfo id: " + jobInfo.getJobId()); //getSerializedOutput String jobIdToGetOutputStr = Long.toString(jobCreationResponse.getJobId()); url = "http://localhost:8080/workflow-manager/rest/jobs/" + jobIdToGetOutputStr + "/output/detection"; params = new HashMap<String, String>(); //REQUIRED - job id is now a path var and required for this endpoint String serializedOutput = client.getAsString(url, params); System.out.println("serializedOutput: " + serializedOutput); }
From source file:edu.cmu.tetrad.cli.search.FgsCli.java
/** * @param args the command line arguments */// www . j a va2 s.c o m public static void main(String[] args) { if (args == null || args.length == 0 || Args.hasLongOption(args, "help")) { Args.showHelp("fgs", MAIN_OPTIONS); return; } parseArgs(args); System.out.println("================================================================================"); System.out.printf("FGS Discrete (%s)%n", DateTime.printNow()); System.out.println("================================================================================"); String argInfo = createArgsInfo(); System.out.println(argInfo); LOGGER.info("=== Starting FGS Discrete: " + Args.toString(args, ' ')); LOGGER.info(argInfo.trim().replaceAll("\n", ",").replaceAll(" = ", "=")); Set<String> excludedVariables = (excludedVariableFile == null) ? Collections.EMPTY_SET : getExcludedVariables(); runPreDataValidations(excludedVariables, System.err); DataSet dataSet = readInDataSet(excludedVariables); runOptionalDataValidations(dataSet, System.err); Path outputFile = Paths.get(dirOut.toString(), outputPrefix + ".txt"); try (PrintStream writer = new PrintStream( new BufferedOutputStream(Files.newOutputStream(outputFile, StandardOpenOption.CREATE)))) { String runInfo = createOutputRunInfo(excludedVariables, dataSet); writer.println(runInfo); String[] infos = runInfo.trim().replaceAll("\n\n", ";").split(";"); for (String s : infos) { LOGGER.info(s.trim().replaceAll("\n", ",").replaceAll(":,", ":").replaceAll(" = ", "=")); } Graph graph = runFgs(dataSet, writer); writer.println(); writer.println(graph.toString()); } catch (IOException exception) { LOGGER.error("FGS failed.", exception); System.err.printf("%s: FGS failed.%n", DateTime.printNow()); System.out.println("Please see log file for more information."); System.exit(-128); } System.out.printf("%s: FGS finished! Please see %s for details.%n", DateTime.printNow(), outputFile.getFileName().toString()); LOGGER.info( String.format("FGS finished! Please see %s for details.", outputFile.getFileName().toString())); }
From source file:edu.cmu.tetrad.cli.search.FgsDiscrete.java
/** * @param args the command line arguments */// ww w .j a va 2s . c o m public static void main(String[] args) { if (args == null || args.length == 0 || Args.hasLongOption(args, "help")) { Args.showHelp("fgs-discrete", MAIN_OPTIONS); return; } parseArgs(args); System.out.println("================================================================================"); System.out.printf("FGS Discrete (%s)%n", DateTime.printNow()); System.out.println("================================================================================"); String argInfo = createArgsInfo(); System.out.println(argInfo); LOGGER.info("=== Starting FGS Discrete: " + Args.toString(args, ' ')); LOGGER.info(argInfo.trim().replaceAll("\n", ",").replaceAll(" = ", "=")); Set<String> excludedVariables = (excludedVariableFile == null) ? Collections.EMPTY_SET : getExcludedVariables(); runPreDataValidations(excludedVariables, System.err); DataSet dataSet = readInDataSet(excludedVariables); runOptionalDataValidations(dataSet, System.err); Path outputFile = Paths.get(dirOut.toString(), outputPrefix + ".txt"); try (PrintStream writer = new PrintStream( new BufferedOutputStream(Files.newOutputStream(outputFile, StandardOpenOption.CREATE)))) { String runInfo = createOutputRunInfo(excludedVariables, dataSet); writer.println(runInfo); String[] infos = runInfo.trim().replaceAll("\n\n", ";").split(";"); for (String s : infos) { LOGGER.info(s.trim().replaceAll("\n", ",").replaceAll(":,", ":").replaceAll(" = ", "=")); } Graph graph = runFgsDiscrete(dataSet, writer); writer.println(); writer.println(graph.toString()); if (graphML) { writeOutGraphML(graph, Paths.get(dirOut.toString(), outputPrefix + "_graph.txt")); } } catch (IOException exception) { LOGGER.error("FGS Discrete failed.", exception); System.err.printf("%s: FGS Discrete failed.%n", DateTime.printNow()); System.out.println("Please see log file for more information."); System.exit(-128); } System.out.printf("%s: FGS Discrete finished! Please see %s for details.%n", DateTime.printNow(), outputFile.getFileName().toString()); LOGGER.info(String.format("FGS Discrete finished! Please see %s for details.", outputFile.getFileName().toString())); }
From source file:com.justgiving.raven.kissmetrics.utils.KissmetricsLocalSchemaExtractor.java
public static void main(String[] args) throws FileNotFoundException, IOException { for (String s : args) { System.out.println(s);/*from ww w. j a v a 2s. com*/ } //String inputFolder ="D:\\datasets\\kissmetrics\\input\\2250.json"; //String outputFile ="D:\\datasets\\kissmetrics\\output\\2250.json"; //String inputFolder ="D:\\datasets\\kissmetrics\\input\\"; //String inputFolder ="D:\\ouptuts\\km\\input\\"; //String inputFolder ="D:\\datasets\\kissmetrics\\input4\\revisions\\"; //String inputFolder ="D:\\datasets\\kissmetrics\\input5\\"; //String outputFile ="D:\\datasets\\kissmetrics\\output\\"; //String inputFolder ="D:\\datasets\\kinesis\\input2\\"; //String outputFile ="D:\\datasets\\kissmetrics\\output\\schema2.txt"; //String inputFolder ="D:\\datasets\\kissmetrics\\stg\\input\\"; //String outputFile ="D:\\datasets\\kissmetrics\\stg\\ouput\\schema1.txt"; String inputFolder = "D:\\datasets\\kinesis\\stg\\input2\\"; String outputFile = "D:\\datasets\\kinesis\\stg\\output2\\schema-kinesis.txt"; //String inputFolder ="D:\\datasets\\kissmetrics\\prd\\input1\\"; //String outputFile ="D:\\datasets\\kissmetrics\\prd\\output1\\schema-kissmetrics.txt"; if (args.length != 2) { System.out.println("No arguments provided, using default values"); System.out.println("InputFolder/File: " + inputFolder); System.out.println("OutputFile: " + outputFile); } else { inputFolder = args[0]; outputFile = args[1]; } if ((new File(outputFile)).isDirectory()) { System.err.println("Error output file cannot be a directory"); return; } String logConfigPath = Paths.get(System.getProperty("user.dir"), "log4j.properties").toString(); System.out.println("log config file used: " + logConfigPath); PropertyConfigurator.configure(logConfigPath); logger.info("log config file used: " + logConfigPath); if (inputFolder.endsWith("\\")) { logger.info("Detected source folder"); countKeysInJsonRecordsFolder(inputFolder, outputFile); } else { logger.info("Detected source file"); countKeysInJsonRecordsFile(inputFolder); } }