Introduction

The Amdatu Template project is a service abstraction for template processing engines. The service interface abstracts away from the specific implementations of such processors.

How to use

TemplateProcessor processor = m_templateEngine.createProcessor(
        "<html><body><h1>${title}</h1>" +
        "<p>${text}</p>" +
        "</body></html>"
);
TemplateContext context = m_templateEngine.createContext();
context.put("title", "My First Document");
context.put("text", "This is a short story about a story that was generated with a template engine.");

System.out.println(processor.generateString(context));

Here, the processor is created with a simple HTML template containing two placeholders. The current implementation is based on Apache Velocity, so you can do pretty advanced things with it. Next, a context is created and properties are put in that context. Finally, the processor is invoked with the context and, in this case, a String is output.

Components

Amdatu Template provides the following components:

Bundle

Required

Description

org.amdatu.template.processor

yes

API and implementation of Amdatu Template

Dependencies

The following table provides an overview of the required and optional dependencies for Amdatu Template:

Bundle

Required

Description

org.apache.felix.dependencymanager

yes

Apache Felix Dependency Manager is used internally by all Amdatu components

Resources