grass
Environment

The target environment for an application is defined in the grass-app-cfg.gac file. This is a grass XML config file for the application. One or more target environment may be defined inside the targets element. 

Given below is a sample definition of target environments.

<targets>
<target id="cat" id-prefs="global, dev"/>
<target id="dog" id-prefs="global, dev, dit"/>
<target id="leopard" id-prefs="global, qa, sit"/>
<target id="cheetah" id-prefs="global, qa, pit"/>
<target id="tiger" id-prefs="global, qa, uat"/>
<target id="lion" id-prefs="global, prod"/>
</targets>

Details of environments definition in grass config

Attribute Description
id The unique name of target environment
id-prefs The preferred hierarchy of environment groups

<target id="lion" id-prefs="global, prod"/>

Target environment definition consists of defining a logical name for the target and defining a set of preferred hierarchy of target groups. The id attribute of target defines the logical name for the target and the id-prefs attribute defines comma separated list of logical groups hierarchy for the target.

A default global group is the root and must for every defined target. A target can have zero or more additional groups. Default global group is used to define token values/ config files common for all targets. Other additional groups are used to define token values / config files common for more than one target environments. 

                                  target

Fig 1- Environment Hierarchy

In the sample above a target environment dog is defined with group preferences global, dev and dit. Group preferences is the comma separated list specified in the id-prefs attribute of target element. Groups are used to define config files and token values common for more than one environment. The default global group is used to define config file or token value for all environments. Target id is unique value across all defined target environments. The group id preferences starts with mandatory global. A group may be mapped for more than one target environment. In the definition above cat and dog targets have dev group in their preferences.

During the generation of config files for a target environment, the hierarchy tree shown above is used in composing the list of config files and the config token values. The list of files and token values defined specific for target has highest precedence and global group has the least precedence. The increasing order of precedence is from global to target as specified by the id-prefs attribute of target element.

Copyright © 2007,  grass - Saravana Aravind R