/////// for testing public static void main(String[] args) { if (args.length != 4) { System.out.println("usage: java RTFGenerator dtabaseurl dbuser password xmlfile"); return; } RTFGenerator rt = new RTFGenerator(); try { DBInterface.initialize(args[0], args[1], args[2]); } catch (Exception exp) { String e = exp.toString(); e = exp.getMessage(); e = ""; } try { rt.initialize("BS_ORDER", "RTF_GENERATOR"); } catch (Exception exp) { exp.printStackTrace(); } try { String xmlmessage = FileUtils.readFile(args[3]); rt.execute(null, xmlmessage); } catch (Exception exp) { exp.printStackTrace(); } }
/** * This method reads RTF template file. * * @return String - string of rtf template. * @exception - ProcessingException - thrown if FrameworkException is reported from FileUtil class */ private String getRTFTemplate() throws ProcessingException { String template = ""; Debug.log(this, Debug.BENCHMARK, "RTFGenerator: Reading template file."); try { template = FileUtils.readFile(rtfTemplate); } catch (FrameworkException exp) { Debug.log(this, Debug.ALL_ERRORS, "ERROR: RTFGenerator: Template file cannot be located."); throw new ProcessingException(rtfTemplate + " file cannot be located"); } return template; }
public static void main(String[] args) { Debug.enableAll(); String HEADER = "<HEADER>" + "<REQUEST value=\"LSR_ORDER\"/>" + "<SUB_REQUEST value=\"loop\"/>" + "<SUPPLIER value=\"VZE\"/>" + "</HEADER>"; RequestHandlerClient sr = null; try { String xml = FileUtils.readFile(args[0]); MessageProcessorContext ctx = new MessageProcessorContext(); ctx.set("NF_HEADER_LOCATION_PROP", HEADER); sr = new RequestHandlerClient(); sr.serverName = "Nightfire.Router"; NVPair[] result = sr.process(ctx, new MessageObject((Object) xml)); } catch (Exception e) { e.printStackTrace(); } }