/** Process an edit log using the chosen processor or visitor. * * @param inputFilename The file to process * @param outputFilename The output file name * @param processor If visitor is null, the processor to use * @param visitor If non-null, the visitor to use. * * @return 0 on success; error code otherwise */ public int go(String inputFileName, String outputFileName, String processor, Flags flags, OfflineEditsVisitor visitor) { if (flags.getPrintToScreen()) { System.out.println("input [" + inputFileName + "]"); System.out.println("output [" + outputFileName + "]"); } try { if (visitor == null) { visitor = OfflineEditsVisitorFactory.getEditsVisitor( outputFileName, processor, flags.getPrintToScreen()); } boolean xmlInput = inputFileName.endsWith(".xml"); OfflineEditsLoader loader = OfflineEditsLoaderFactory. createLoader(visitor, inputFileName, xmlInput, flags); loader.loadEdits(); } catch(Exception e) { System.err.println("Encountered exception. Exiting: " + e.getMessage()); e.printStackTrace(System.err); return -1; } return 0; }
/** Process an edit log using the chosen processor or visitor. * * @param inputFilename The file to process * @param outputFilename The output file name * @param processor If visitor is null, the processor to use * @param visitor If non-null, the visitor to use. * * @return 0 on success; error code otherwise */ public int go(String inputFileName, String outputFileName, String processor, Flags flags, OfflineEditsVisitor visitor) { if (flags.getPrintToScreen()) { System.out.println("input [" + inputFileName + "]"); System.out.println("output [" + outputFileName + "]"); } try { if (visitor == null) { visitor = OfflineEditsVisitorFactory.getEditsVisitor( outputFileName, processor, flags.getPrintToScreen()); } boolean xmlInput = inputFileName.toLowerCase().endsWith(".xml"); OfflineEditsLoader loader = OfflineEditsLoaderFactory. createLoader(visitor, inputFileName, xmlInput, flags); loader.loadEdits(); } catch(Exception e) { System.err.println("Encountered exception. Exiting: " + e.getMessage()); e.printStackTrace(System.err); return -1; } return 0; }