Contents

Icon

In case new variables are not required in the predefined template, skip this section and start from the Defining Microservices section.

Creating a Setting

A setting contains the defined variables that can be used in templates of source files and values that replace these variables during the source generation.

  • Each folder in %TEMPLATE_ENGINE%/etc is a setting. The Fiorano setting can be seen in Figure 1 under the Component Launch Semantics section.

A setting typically consists of the following files:

  • templates.properties: This is a file containing the variables that can be used in the templates of source files.
  • copyright.txt: This is a text file containing the copyright notice that should be included in the generated source files.

To create a new setting,

  1. Create a directory in %TEMPLATE_ENGINE%\etc with the setting name required.
  2. Create the files templates.properties and copyright.txt.
  3. Define appropriate variables in templates.properties.

Variables

The template engine uses variables to substitute values during the code generation.

In-built variables

The following table illustrates in-built variables:

Variable Name

Description

guid

exact GUID of the service

serviceGUID

GUID of service with first letter as lowercase

ServiceGUID

GUID of service with first letter as uppercase

serviceguid

GUID of service in lowercase

version

version of the service

inputPorts

java.util.ArrayList containing input port names

outputPorts

java.util.ArrayList containing output port names

inMemoryLaunchable

java.lang.Boolean specifying whether service can be launched in-memory

isSyncRequestType

java.lang.Boolean specifying whether SyncRequestType is enabled or not for input port

isBCConnEnabled

java.lang.Boolean specifying whether connection semantics is enabled for a JCA-complaint component

fioranoHome

Fiorano Platform installation directory

copyright

copyright notice for source file (as javadoc comment) [ content of copyright.txt from setting directory ]

Date

current date

rootDir

root directory to resemble root package

BCRootDir

root directory to resemble root package for JCA-complaint components

The values for the above variables either picked up from pre-defined locations or computed based on other variables and hence the user does not have complete control of these variables.

Icon

These variables are available independent of the setting being used

Variables Defined in the Fiorano Setting

The following table explains the variables present in the Fiorano Settings:

Variable Name

Description

rootPackage

Name of the root package in which sources are generated

JCARootPackage

Root package for JCA-complaint Code generation

author

Developer name that appears in the source file

dateFormat

Date format used for date variable

Defining New Variables

New variables can be defined by adding an entry in the templates.properties file.

This is a java properties file containing:

  • The variables defined that can be used in the templates of the source files (present in %TEMPLATE_ENGINE%\<lang>\src).
  • The values for the defined variables which is substituted during the source code generation.

A typical file is shown in the figure below.


Figure 1: templates.properties file containing defined variables and their values

To create a new variable with name e-mail and value user@domain.com, edit the templates.properties file as shown in the figure below.


Figure 2: Modified templates.properties file

For more Information regarding editing properties file, see http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream)

Modifying the Templates

As shown in Figure 1 under the Creating Custom Microservices section, source file templates for different languages are present at %TEMPLATE_ENGINE%\<lang>\src . These can be edited to use the variables defined in the previous section.

Using the Variables in Template

The variables defined can be referred in the template files by specifying as ${variable_name}. Shown in image:

Figure 3: Source template file showing use of variables

Adaptavist ThemeBuilder EngineAtlassian Confluence