| This and all subsequent pages relates to dynamic templates in future version 1.1. Subject to change until 1.1 GA is out. |
Dynamic template language can be used to define wallmount layout templates programmatically. Dynamic templates are based on Groovy, Groovy DSL, dynamic layout API and a collection of helper classes.
Let's assume user is managing multiple Hyperic environments and there is a need to have a same kind of layout in every system which shows availability's for all platforms. This could be done using wallmount designer and build separate layouts manually for each system. This kind of scenario can be accomplished through dynamic templates where the dynamic template itself queries the API to get all platforms and then build the actual layout JSON. JSON representing the layout will be different for each system but the dynamic template will be same and can be distributed throughout the systems.
Writing a Dynamic Templates
Writing a dynamic template is as simple as to write a code which outputs a valid layout JSON string. See from layout JSON reference document how it is structured. When a Player requests content from a dynamic template it doesn't see what's in it, it only sees what's coming out from the template execution. Actually it's possible to take existing normal template, put that to a dynamic template as a string and just return it. There's no "dynamic" in that kind of template but Player don't know it.
Dynamic Template Examples
Various examples can be found from here: Examples
Template API and Helper Classes
DynResourceApi
DynResourceApi contains methods to access and query Hyperic's resources and metrics.
JsonGroovyBuilder
Usage of JsonGroovyBuilder is totally optional but those who are familiar with Groovy DSL know how this type of programming model can ease the creation of a complex structures like xml and json.
DynObjectCreator
Methods to create wallmount widgets with a basic settings.
DynlayoutUtils
Utility methods to work with a JsonGroovyBuilder.
DynWinUtils
This utility class contains methods to work with a layout windows. It's kind of a janitor who can be asked to re-organize window positions.