Using regular expressions to modify the mapping file

You can optionally request that the mapping file produced by the export process is automatically modified by the import process, according to rules defined using regular expressions.

The mapping file produced by the export process of a workload application contains a list of elements, some of which are dependent on the topology of the environment in which it is used. These elements need to be customized to match the target environment. When the import process is performed from the wappman command line, you can optionally request that the mapping file is automatically modified according to rules defined using regular expressions and specified in one of the following ad-hoc files:
workload applicationname_BasicRegExpMapping.UTF8.rules
This file contains rules defined using basic regular expressions that include only '*' and '?' wildcard characters.
workload applicationname_AdvancedRegExpMapping.UTF8.rules
This file contains rules defined using advanced regular expressions according to Java standards. For additional details about advanced regular expressions, see the related documentation.
These files are produced by the export process and, if used, must be properly customized.

Select the file that better fits your needs and customize the regular expressions according to the names that the objects will have in the target environment. The import process, performed from the wappman command line, then applies the defined rules to modify the value of the elements included in the mapping file.

Each file is organized in sections, one for each type of object that can be contained in a workload application. For each section, you can find comments including examples of rules, defined using regular expressions, that apply to the specific object. For example:

[JOBSTREAM]
#*_DEV=*_PRD
#A24Y?=B42X?
Uncomment the provided examples or add your own rules. For example:

[JOBSTREAM]
*_DEV=*_PRD
A24Y?=B42X?
J*=A*
Each rule is composed of two regular expressions. The regular expression on the left defines the search pattern, the regular expression on the right defines the replacing value of each matching element. During the import process, both the search and the replace actions are performed on the value of the elements included in the mapping file.
If an object of your workload application matches more than one entry in the file, only the rule included in the last matching entry is applied. For example:

According to the above rules: 
- the job stream JS1_DEV is renamed as AS1_DEV
- the job stream CCB_DEV is renamed as CCB_PRD
- the job stream A24YK is renamed as B42XK 

Each line in the mapping file specifies the names to be assigned to objects when importing the workload application template. You can use the -translationRules parameter to specify a file to override these names using regular expressions. The compressed file representing the workload application template contains two files, named wat_name_BasicRegExpMapping.UTF8.rules and wat_name_AdvancedRegExpMapping.UTF8.rules with examples about how to build the translationRules file.

Consider the following example, which imports a workload application into a new environment, using the regular expressions specified in the translation_rules_file to assign names to the new objects:
wappman -import definition_xml_file mapping_properties_file -translationRules translation_rules_file
If the mapping_properties_file contains the JOB_TEST_DECOMPRESSION=TEST_DECOMPRESSION string, and the translation_rules_file contains a rule such as [JOB]^(TEST_)(.+)=$2, the resulting job in the target environment is named DECOMPRESSION.