public HtmlReportGenerator(String outputFile) throws IOException { super(new ReportConfiguration(createOutputWriter(outputFile))); File file = new File(outputFile); if(file.getParentFile() != null) { getReportConfiguration().setTempOutDir(file.getParentFile()); } }
private void setupSmooksReporting(final ExecutionContext executionContext) { if (reportPath != null) { try { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } catch (final IOException e) { log.info("Could not generate Smooks Report. The reportPath specified was [" + reportPath + "].", e); } } }
public void applyTemplate(Report report) throws IOException { FreeMarkerTemplate template; System.out.println(); System.out.println("****************************************************************************************"); System.out.println(" HTML REPORT GENERATOR IN USE!!!"); System.out.println(" Please disable in Production mode. This feature is a major performance drain!!"); System.out.println("****************************************************************************************"); System.out.println(); if(report instanceof DOMReport) { template = new FreeMarkerTemplate("html/template-dom.html", HtmlReportGenerator.class); } else { template = new FreeMarkerTemplate("html/template-sax.html", HtmlReportGenerator.class); } Writer writer = getReportConfiguration().getOutputWriter(); Map templateModel = new HashMap(); templateModel.put("report", report); templateModel.put("htmlEscape", new HtmlEscape()); writer.write(template.apply(templateModel)); }
@SuppressWarnings("unchecked") public void applyTemplate(Report report) throws IOException { FreeMarkerTemplate template; System.out.println(); System.out.println("****************************************************************************************"); System.out.println(" HTML REPORT GENERATOR IN USE!!!"); System.out.println(" Please disable in Production mode. This feature is a major performance drain!!"); System.out.println("****************************************************************************************"); System.out.println(); if(report instanceof DOMReport) { template = new FreeMarkerTemplate("html/template-dom.html", HtmlReportGenerator.class); } else { template = new FreeMarkerTemplate("html/template-sax.html", HtmlReportGenerator.class); } Writer writer = getReportConfiguration().getOutputWriter(); Map templateModel = new HashMap(); templateModel.put("report", report); templateModel.put("htmlEscape", new HtmlEscape()); writer.write(template.apply(templateModel)); }
public HtmlReportGenerator(String outputFile) throws IOException { super(new ReportConfiguration(createOutputWriter(outputFile))); File file = new File(outputFile); if(file.getParentFile() != null) { getReportConfiguration().setTempOutDir(file.getParentFile()); } }
@SuppressWarnings("unchecked") public void applyTemplate(Report report) throws IOException { FreeMarkerTemplate template; System.out.println(); System.out.println("****************************************************************************************"); System.out.println(" HTML REPORT GENERATOR IN USE!!!"); System.out.println(" Please disable in Production mode. This feature is a major performance drain!!"); System.out.println("****************************************************************************************"); System.out.println(); if(report instanceof DOMReport) { template = new FreeMarkerTemplate("html/template-dom.html", HtmlReportGenerator.class); } else { template = new FreeMarkerTemplate("html/template-sax.html", HtmlReportGenerator.class); } Writer writer = getReportConfiguration().getOutputWriter(); Map templateModel = new HashMap(); templateModel.put("report", report); templateModel.put("htmlEscape", new HtmlEscape()); writer.write(template.apply(templateModel)); }
public <T> Model<T> readModel(Reader message, Class<T> modelRoot) throws SAXException, IOException { AssertArgument.isNotNull(message, "message"); AssertArgument.isNotNull(modelRoot, "modelRoot"); JavaResult result = new JavaResult(); ExecutionContext executionContext = descriptor.getSmooks().createExecutionContext(); Map<Class<?>, Map<String, BeanWriter>> beanWriters = descriptor.getBeanWriters(); BeanTracker beanTracker = new BeanTracker(beanWriters); if(reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } executionContext.getBeanContext().addObserver(beanTracker); if(validate && descriptor.getSchema() != null) { // Validate the message against the schemas... Document messageDoc = toDocument(message); // Validate the document and then filter it through smooks... descriptor.getSchema().newValidator().validate(new DOMSource(messageDoc)); descriptor.getSmooks().filterSource(executionContext, new DOMSource(messageDoc), result); } else { descriptor.getSmooks().filterSource(executionContext, new StreamSource(message), result); } Model<T> model; if(modelRoot == JavaResult.class) { model = new Model<T>(modelRoot.cast(result), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } else { model = new Model<T>(modelRoot.cast(result.getBean(modelRoot)), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } return model; }
public HtmlReportGenerator(String outputFile) throws IOException { super(new ReportConfiguration(createOutputWriter(outputFile))); File file = new File(outputFile); if(file.getParentFile() != null) { getReportConfiguration().setTempOutDir(file.getParentFile()); } }
@SuppressWarnings("unchecked") public void applyTemplate(Report report) throws IOException { FreeMarkerTemplate template; System.out.println(); System.out.println("****************************************************************************************"); System.out.println(" HTML REPORT GENERATOR IN USE!!!"); System.out.println(" Please disable in Production mode. This feature is a major performance drain!!"); System.out.println("****************************************************************************************"); System.out.println(); if(report instanceof DOMReport) { template = new FreeMarkerTemplate("html/template-dom.html", HtmlReportGenerator.class); } else { template = new FreeMarkerTemplate("html/template-sax.html", HtmlReportGenerator.class); } Writer writer = getReportConfiguration().getOutputWriter(); Map templateModel = new HashMap(); templateModel.put("report", report); templateModel.put("htmlEscape", new HtmlEscape()); writer.write(template.apply(templateModel)); }
public <T> Model<T> readModel(Reader message, Class<T> modelRoot) throws SAXException, IOException { AssertArgument.isNotNull(message, "message"); AssertArgument.isNotNull(modelRoot, "modelRoot"); JavaResult result = new JavaResult(); ExecutionContext executionContext = descriptor.getSmooks().createExecutionContext(); Map<Class<?>, Map<String, BeanWriter>> beanWriters = descriptor.getBeanWriters(); BeanTracker beanTracker = new BeanTracker(beanWriters); if(reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } executionContext.getBeanContext().addObserver(beanTracker); if(validate && descriptor.getSchema() != null) { // Validate the message against the schemas... Document messageDoc = toDocument(message); // Validate the document and then filter it through smooks... descriptor.getSchema().newValidator().validate(new DOMSource(messageDoc)); descriptor.getSmooks().filterSource(executionContext, new DOMSource(messageDoc), result); } else { descriptor.getSmooks().filterSource(executionContext, new StreamSource(message), result); } Model<T> model; if(modelRoot == JavaResult.class) { model = new Model<T>(modelRoot.cast(result), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } else { model = new Model<T>(modelRoot.cast(result.getBean(modelRoot)), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } return model; }
public HtmlReportGenerator(String outputFile) throws IOException { super(new ReportConfiguration(createOutputWriter(outputFile))); File file = new File(outputFile); if(file.getParentFile() != null) { getReportConfiguration().setTempOutDir(file.getParentFile()); } }
public <T> Model<T> readModel(Reader message, Class<T> modelRoot) throws SAXException, IOException { AssertArgument.isNotNull(message, "message"); AssertArgument.isNotNull(modelRoot, "modelRoot"); JavaResult result = new JavaResult(); ExecutionContext executionContext = descriptor.getSmooks().createExecutionContext(); Map<Class<?>, Map<String, BeanWriter>> beanWriters = descriptor.getBeanWriters(); BeanTracker beanTracker = new BeanTracker(beanWriters); if(reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } executionContext.getBeanContext().addObserver(beanTracker); if(validate && descriptor.getSchema() != null) { // Validate the message against the schemas... Document messageDoc = toDocument(message); // Validate the document and then filter it through smooks... descriptor.getSchema().newValidator().validate(new DOMSource(messageDoc)); descriptor.getSmooks().filterSource(executionContext, new DOMSource(messageDoc), result); } else { descriptor.getSmooks().filterSource(executionContext, new StreamSource(message), result); } Model<T> model; if(modelRoot == JavaResult.class) { model = new Model<T>(modelRoot.cast(result), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } else { model = new Model<T>(modelRoot.cast(result.getBean(modelRoot)), beanTracker.beans, beanWriters, NamespaceReaper.getNamespacePrefixMappings(executionContext)); } return model; }
/** * Bind the input source to the specified type. * <p/> * In order to make a cleaner API, implementing classes should create a more * appropriately named method based on the target binding format, that just * delegates to this method e.g. {@link org.milyn.javabean.binding.xml.XMLBinding#fromXML(javax.xml.transform.Source, Class)} * and {@link org.milyn.javabean.binding.xml.XMLBinding#toXML(Object, java.io.Writer)}. * * @param inputSource The input source. * @param toType The target type. * @return The target binding type instance. * @throws IOException Error binding source to target type. */ protected <T> T bind(Source inputSource, Class<T> toType) throws IOException { AssertArgument.isNotNull(inputSource, "inputSource"); AssertArgument.isNotNull(toType, "toType"); assertInitialized(); JavaResult javaResult = new JavaResult(); ExecutionContext executionContext = smooks.createExecutionContext(); if (reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } smooks.filterSource(executionContext, inputSource, javaResult); return javaResult.getBean(toType); }
/** * Bind the input source to the specified type. * <p/> * In order to make a cleaner API, implementing classes should create a more * appropriately named method based on the target binding format, that just * delegates to this method e.g. {@link org.milyn.javabean.binding.xml.XMLBinding#fromXML(javax.xml.transform.Source, Class)} * and {@link org.milyn.javabean.binding.xml.XMLBinding#toXML(Object, java.io.Writer)}. * * @param inputSource The input source. * @param toType The target type. * @return The target binding type instance. * @throws IOException Error binding source to target type. */ protected <T> T bind(Source inputSource, Class<T> toType) throws IOException { AssertArgument.isNotNull(inputSource, "inputSource"); AssertArgument.isNotNull(toType, "toType"); assertInitialized(); JavaResult javaResult = new JavaResult(); ExecutionContext executionContext = smooks.createExecutionContext(); if (reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } smooks.filterSource(executionContext, inputSource, javaResult); return javaResult.getBean(toType); }
/** * Bind the input source to the specified type. * <p/> * In order to make a cleaner API, implementing classes should create a more * appropriately named method based on the target binding format, that just * delegates to this method e.g. {@link org.milyn.javabean.binding.xml.XMLBinding#fromXML(javax.xml.transform.Source, Class)} * and {@link org.milyn.javabean.binding.xml.XMLBinding#toXML(Object, java.io.Writer)}. * * @param inputSource The input source. * @param toType The target type. * @return The target binding type instance. * @throws IOException Error binding source to target type. */ protected <T> T bind(Source inputSource, Class<T> toType) throws IOException { AssertArgument.isNotNull(inputSource, "inputSource"); AssertArgument.isNotNull(toType, "toType"); assertInitialized(); JavaResult javaResult = new JavaResult(); ExecutionContext executionContext = smooks.createExecutionContext(); if (reportPath != null) { executionContext.setEventListener(new HtmlReportGenerator(reportPath)); } smooks.filterSource(executionContext, inputSource, javaResult); return javaResult.getBean(toType); }