How To Templatize A File

Synopsis

Harbormaster uses the Apache Velocity Engine to apply certain features, options, and functions during project generation. This is accomplished via template files and macros. A template file is any file that contains Velocity directives to transform the file during project generation.  A template file can be simple or complex and it’s eventually usage has no limits.

Project Generation Context

During project generation, useful and helpful variables are made available by Harbormaster within the Velocity context.  Use these variables to assist in generating the desired outcome. These context variables include:
Name Source Usage Description Example
aib Link $aib.getClassesToGenerate() $aib.getParam(“go.dbName”) Offered as the entry point into the Harbormaster Metamodel. Use it to access and navigate the model loaded as part of project generation. It also gives access to the options and option values provided as part of a project definition. Link
classObject Link $classObject.getAttributes() The current class object within the model hierarchy being processed during project generation. Link
Utils Link $Utils.lowercaseFirstLetter() Utility functions helpful during generation
esc Link $esc.quote The Velocity escape tool used to output escape characters. Link
math Link $math.mod(‘5.1’,3) Tool for performing math operations in Velocity.