public static void outputACK(File filePath, String mode) { File outFileName = new File(filePath.getPath() + "/" + mode + "_ACK.TXT"); System.out.println("Sending output to: " + outFileName.getPath()); if (outFileName.exists()) { outFileName.delete(); } try { PrintWriter out = new PrintWriter(outFileName.getPath()); // out.print(recommendations); out.flush(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
private static void processFile( String pid, File child, File outFilePath, String guidelineId, String htmlFilePath) { // Write to output directory // outFilePath should be path+pid+extension String caseData = null; SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); java.util.Date startTime = new java.util.Date(); try { caseData = readFileAsString(child.getPath()); } catch (java.io.IOException e) { logger.error("Error reading data file ", e); System.exit(-1); } String recommendations = null; try { System.out.println("-----------------------------------------"); recommendations = pca.topLevelComputeAdvisory(pid, caseData, formatter.format(startTime), guidelineId, pid); System.out.println("-----------------------------------------"); // String fileName = outFilePath+pid+fileExtension // File outFilePath = new File(fileName);; logger.warn("Output recommenations to: " + outFilePath); if (outFilePath.exists()) { outFilePath.delete(); } try { PrintWriter out = new PrintWriter(outFilePath.getPath()); out.print(recommendations); out.flush(); // System.out.println("****READY FILE PROCESSING****"); // create Ready file // String readyFileName; // readyFileName = outFilePath.getPath(); // System.out.println("Ready File Name Is: " + readyFileName); //Remove // File readyFile = new File(readyFileName.replace(".xml","_READY.txt")); // try { // readyFile.createNewFile(); // System.out.println("****SUCCESS****"+readyFile.getPath()); // } catch (java.io.IOException e0) { // System.out.println("Error creating READY file"); // } } catch (FileNotFoundException e) { e.printStackTrace(); } } catch (PCA_Session_Exception e1) { e1.printStackTrace(); } }