|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object toolbox.services.BaseService toolbox.services.util.FreeMarkerTemplateServiceImpl
public class FreeMarkerTemplateServiceImpl
FreeMarker based implementation of the TemplateService interface.
This service must be configured with an XML configuration document similar to the following:
<?xml version="1.0"?> <FreeMarkerTemplateServiceImpl> <config> <directories> <directory relative="true"> /ftl </directory> <directory relative="false"> /opt/foo/blah </directory> </directories> </config> </FreeMarkerTemplateServiceImpl>
Constructor Summary | |
---|---|
FreeMarkerTemplateServiceImpl()
Default constructor. |
Method Summary | |
---|---|
void |
create(java.lang.String name,
java.lang.String confHome,
ServiceEnvironment env,
XMLProperties xmlProps)
Initialise the FreeMarker configuration. |
java.lang.String |
process(java.lang.String tmpl,
java.util.Map data)
Process the named template and return a String. |
void |
process(java.lang.String tmpl,
java.util.Map data,
java.io.OutputStream out)
Process the named template and write the output to the given stream. |
Methods inherited from class toolbox.services.BaseService |
---|
destroy, getConfigHome, getName, getProperties, getProperty, getXMLProperties, logConfig, logFine, logFiner, logFinest, logInfo, logSevere, logWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FreeMarkerTemplateServiceImpl()
Method Detail |
---|
public void create(java.lang.String name, java.lang.String confHome, ServiceEnvironment env, XMLProperties xmlProps) throws ServiceException
create
in interface Service
create
in class BaseService
name
- The name of the service.confHome
- The path to the configuration home directory.env
- ServiceEnvironment of this service.xmlProps
- XML configuration properties.
ServiceException
- if the service cannot be created.public java.lang.String process(java.lang.String tmpl, java.util.Map data) throws ServiceException
process
in interface TemplateService
tmpl
- String containing the template path.data
- Map instance containing the data to merge with the template.
ServiceException
- if the template cannot be processed.public void process(java.lang.String tmpl, java.util.Map data, java.io.OutputStream out) throws ServiceException
process
in interface TemplateService
tmpl
- String containing the template path.data
- Map instance containing the data to merge with the template.out
- OutputStream instance to write the output to.
ServiceException
- if the template cannot be processed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |