|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.util.VelocityService
public final class VelocityService
A static class that provides a convenience interface to a Velocity singletons. No instances of this class can be created, only the static members should be used.
Field Summary | |
---|---|
static String |
ANAKIA_TEMPLATE
Name of the main template used for Anakia XML format. |
static String |
CONFIG_TEMPLATE
Name of the default template used to print configuration parameters. |
static String |
GOAL_TEMPLATE
Name of the default template used to print goals. |
static String |
TEMPLATE_DIR
The template directory. |
static String |
TEMPLATE_EXT
The extension of template files. |
Method Summary | |
---|---|
static String |
completeTemplateName(String shortName)
Completes the short form of a template name, by prepending the TEMPLATE_DIR and appending the TEMPLATE_EXT . |
static Properties |
getDefaultProperties()
Returns properties listing the changes to the Velocity configuration made by default. |
static void |
main(String[] args)
Main methods: prints the list of config parameters and goals from the standard configuration to specified
files (or standard out). |
static void |
printConfigProperties(TiesConfiguration config,
String templateName,
String charset,
Map<String,Object> contextObjects,
Writer writer)
Prints all properties contained in a configuration, using the specified template for rendering. |
static void |
printConfigProperties(TiesConfiguration config,
Writer writer)
Prints all properties contained in a configuration, using the default template for printing them. |
static void |
printGoals(TiesConfiguration config,
String templateName,
String charset,
Map<String,Object> contextObjects,
Writer writer)
Prints the goals contained in a configuration, using the default template for printing them. |
static void |
printGoals(TiesConfiguration config,
Writer writer)
Prints the goals contained in a configuration, using the default template for printing them. |
static void |
renderTemplate(String templateName,
Map contextObjects,
Writer writer)
Renders a template using the given context objects. |
static void |
renderTemplate(String templateName,
String charset,
Map contextObjects,
Writer writer)
Renders a template using the given context objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TEMPLATE_DIR
public static final String TEMPLATE_EXT
public static final String CONFIG_TEMPLATE
public static final String GOAL_TEMPLATE
public static final String ANAKIA_TEMPLATE
Method Detail |
---|
public static String completeTemplateName(String shortName)
TEMPLATE_DIR
and appending the TEMPLATE_EXT
.
shortName
- the short form of the template name (without directory
and extension)
public static Properties getDefaultProperties()
Properties
object containing the changed
parameterspublic static void main(String[] args)
standard configuration
to specified
files (or standard out). The generated files are in Anakia XML format
and uses the platform's default character set.
args
- the command-line arguments: should contain the filename
for writing the config parameters as first element and the filename
for writing the goals as second element; if no filenames are given, the
corresponding output is written to standard outpublic static void printConfigProperties(TiesConfiguration config, String templateName, String charset, Map<String,Object> contextObjects, Writer writer) throws IOException, org.apache.velocity.exception.VelocityException
$allParameters
of all config parameters.
config
- the configuration to printtemplateName
- name of template to be used in merge, either in
short form (without directory and extension, when default directory and
extension are used) or in complete formcharset
- the character set used in the templatecontextObjects
- a map of objects that are made available in the
context of the template; might be null
writer
- the writer to write the output to; the writer is flushed
but not closed by this method
IOException
- if an I/O error occurred
org.apache.velocity.exception.VelocityException
- if rendering failedpublic static void printConfigProperties(TiesConfiguration config, Writer writer) throws IOException, org.apache.velocity.exception.VelocityException
config
- the configuration to printwriter
- the writer to write the output to; the writer is flushed
but not closed by this method
IOException
- if an I/O error occurred
org.apache.velocity.exception.VelocityException
- if rendering failedpublic static void printGoals(TiesConfiguration config, String templateName, String charset, Map<String,Object> contextObjects, Writer writer) throws IOException, org.apache.velocity.exception.VelocityException
$allParameters
of all goals.
config
- the configuration to printtemplateName
- name of template to be used in merge, either in
short form (without directory and extension, when default directory and
extension are used) or in complete formcharset
- the character set used in the templatecontextObjects
- a map of objects that are made available in the
context of the template; might be null
writer
- the writer to write the output to; the writer is flushed
but not closed by this method
IOException
- if an I/O error occurred
org.apache.velocity.exception.VelocityException
- if rendering failedpublic static void printGoals(TiesConfiguration config, Writer writer) throws IOException, org.apache.velocity.exception.VelocityException
config
- the configuration to printwriter
- the writer to write the output to; the writer is flushed
but not closed by this method
IOException
- if an I/O error occurred
org.apache.velocity.exception.VelocityException
- if rendering failedpublic static void renderTemplate(String templateName, Map contextObjects, Writer writer) throws IOException, org.apache.velocity.exception.VelocityException
templateName
- name of template to be used in merge, either in
short form (without directory and extension, when default directory and
extension are used) or in complete formcontextObjects
- a map of objects that are made available in the
context of the template; mappings from "escapeTool" to a
StringEscapeUtils
and from "util" to a Util
are added to
allow XML entity escaping, String conversion etc.writer
- writer to write template into; the writer is flushed
but not closed by this method
IOException
- if an I/O error occurred
org.apache.velocity.exception.VelocityException
- if rendering failedpublic static void renderTemplate(String templateName, String charset, Map contextObjects, Writer writer) throws IOException, org.apache.velocity.exception.VelocityException
templateName
- name of template to be used in merge, either in
short form (without directory and extension, when default directory and
extension are used) or in complete formcharset
- the character set used in templatecontextObjects
- a map of objects that are made available in the
context of the template; mappings from "escapeTool" to a
StringEscapeUtils
and from "util" to a Util
are added to
allow XML entity escaping, String conversion etc.writer
- writer to write template into; the writer is flushed
but not closed by this method
IOException
- if an I/O error occurred
org.apache.velocity.exception.VelocityException
- if rendering failed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |