at.newmedialab.ldpath.template.engine
Class TemplateEngine<Node>

java.lang.Object
  extended by at.newmedialab.ldpath.template.engine.TemplateEngine<Node>

public class TemplateEngine<Node>
extends Object

Add file description here!

Author: Sebastian Schaffert


Constructor Summary
TemplateEngine(RDFBackend<Node> backend)
           
 
Method Summary
 void processFileTemplate(Node context, String templateName, Map initialEnv, Writer out)
          Process the template with the given name forn the given context node and write the result to the given output writer.
 void processFileTemplate(Node context, String templateName, Writer out)
          Process the template with the given name forn the given context node and write the result to the given output writer.
 void setClassForTemplateLoading(Class clazz, String pathPrefix)
           
 void setDirectoryForTemplateLoading(File dir)
           
 void setServletContextForTemplateLoading(Object sctxt, String path)
           
 void setTemplateLoader(freemarker.cache.TemplateLoader loader)
          Allow setting a different template loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateEngine

public TemplateEngine(RDFBackend<Node> backend)
Method Detail

setTemplateLoader

public void setTemplateLoader(freemarker.cache.TemplateLoader loader)
Allow setting a different template loader. Custom template loaders can be implemented in addition to those provided by FreeMarker.

Parameters:
loader -

setDirectoryForTemplateLoading

public void setDirectoryForTemplateLoading(File dir)
                                    throws IOException
Throws:
IOException

setServletContextForTemplateLoading

public void setServletContextForTemplateLoading(Object sctxt,
                                                String path)

setClassForTemplateLoading

public void setClassForTemplateLoading(Class clazz,
                                       String pathPrefix)

processFileTemplate

public void processFileTemplate(Node context,
                                String templateName,
                                Writer out)
                         throws IOException,
                                freemarker.template.TemplateException
Process the template with the given name forn the given context node and write the result to the given output writer. The way the template is retrieved depends on the template loader, which can be set using the setTemplateLoader() method.

Parameters:
context - the initial context node to apply this template to
templateName - the name of the template
out - where to write the results
Throws:
IOException
freemarker.template.TemplateException

processFileTemplate

public void processFileTemplate(Node context,
                                String templateName,
                                Map initialEnv,
                                Writer out)
                         throws IOException,
                                freemarker.template.TemplateException
Process the template with the given name forn the given context node and write the result to the given output writer. The initial environment is passed over to the invocation of the template. The way the template is retrieved depends on the template loader, which can be set using the setTemplateLoader() method.

Parameters:
context - the initial context node to apply this template to
templateName - the name of the template
initialEnv - an initial root environment for processing the template
out - where to write the results
Throws:
IOException
freemarker.template.TemplateException


Copyright © 2012 Salzburg Research. All Rights Reserved.