/** * Renders a GraphNode with a template located in the templates * folder of any active bundle * * @param node the GraphNode to be rendered * @param templatePath the freemarker path to the template * @param out where the result is written to */ public void render(GraphNode node, final String templatePath, Writer out) { //A GraphNode backend could be graph unspecific, so the same engine could be //reused, possibly being signifantly more performant (caching, etc.) RDFBackend<RDFTerm> backend = new ClerezzaBackend(node.getGraph()); RDFTerm context = node.getNode(); TemplateEngine<RDFTerm> engine = new TemplateEngine<RDFTerm>(backend); engine.setTemplateLoader(templateLoader); try { engine.processFileTemplate(context, templatePath, null, out); out.flush(); } catch (IOException e) { throw new RuntimeException(e); } catch (TemplateException e) { throw new RuntimeException(e); } }
/** * Renders a GraphNode with a template located in the templates * folder of any active bundle * * @param node the GraphNode to be rendered * @param templatePath the freemarker path to the template * @param out where the result is written to */ public void render(GraphNode node, final String templatePath, Writer out) { //A GraphNode backend could be graph unspecific, so the same engine could be //reused, possibly being signifantly more performant (caching, etc.) RDFBackend<RDFTerm> backend = new ClerezzaBackend(node.getGraph()); RDFTerm context = node.getNode(); TemplateEngine<RDFTerm> engine = new TemplateEngine<RDFTerm>(backend); engine.setTemplateLoader(templateLoader); try { engine.processFileTemplate(context, templatePath, null, out); out.flush(); } catch (IOException e) { throw new RuntimeException(e); } catch (TemplateException e) { throw new RuntimeException(e); } }