Using the Mask Merger

You may customize mask files, in creating new mask files based on original ones.

Analyzing and manually reporting such changes in all customized mask files is a heavy task.

The Mask Merger merges mask files (sources), and not SecurityMask files (result).

A batch tool – the Mask Merger – automates the mask upgrade process and saves you time.

It processes all customized mask files of one or several given mask names, based on:


  • the previous mask file version (n) of the DEFAULT mask
  • the current mask file version (n+1) of the DEFAULT mask
  • the previous mask file version (n) of the given mask name (e.g. MYMASK, etc.)

Important: of course, this supposes the previous version of mask files were kept. The resulting mask files are generated in an output sub-directory related to the given mask name.

Merger Principles

When upgrading your EV6 installation with a new version, the changes that may have been done to original mask files have to be transferred to the customized ones, according to the following process:



The merger algorithm is based on comparison between 3 sorted tree structures, loaded from previous DEFAULT, current DEFAULT and previous customization mask files.

Thus, file content is automatically sorted when loaded; but node’s weight (it’s line offset v/s its parent node) is kept to sort back the resulting tree according to the weight of added nodes in the sub trees, when it is important:


  • list of authorized values (VALUE)
  • ordered list of attributes use (FATTR)

Important: merging nodes coming from different trees (NEW or CUSTO) and recombining them according to their weight in these different trees may lead to “bizarre” orders, semantically speaking, although this is a normal behaviour. See example in Limitation 1.

Comparisons are made between nodes of each tree, and an action is deduced according to the result of these comparisons. This is summarized and detailed in the following table.

Actions:

Action Description
Add node the node and its sub tree are cloned and added in the result tree
Keep node the node is kept and comparisons and actions are launched in the node sub tree, that's why deep-first = yes for keep action
Ignore node the node and its sub tree are ignored (they do not appear in the result tree)

Node origin:

Action Description
Ref Previous DEFAULT version (n)
New Current DEFAULT version (n+1)
Cus Previous Customized version (n)

Table:

External Pattern Results Next Iteration
Situation

description

Recommendation Alternate deep first next sibling
Action Node Action Node Ref New Cus
No change Keep Cus     Yes X X X
Node value changed in Cus Keep Cus     Yes X X X
Node value changed in New Keep New Keep Cus Yes X X X
Node added in Cus Add Cus     No     X
Node added in New Add New Ignore New No   X  
Node removed from Cus Ignore New     No X X  
Node removed from New Ignore Cus Keep Cus No (yes) X   X
Same node added in Cus & New Keep Cus     Yes   X X
Same node removed from Cus & New Ignore Ref     No X    
Same node removed from Cus + node value changed in New Ignore New     No X X  
Same node removed from New + node value changed in Cus Ignore Cus Keep Cus No (yes) X   X
Node value changed in Cus & New (same value) Keep Cus     Yes X X X
Node value changed in Cus & New (different values) Keep Cus Keep New Yes X X X
Same node added in Cus & New + but node values differ Keep Cus Keep New Yes   X X

In some cases, a doubt may exist; an alternate action may be performed. This may be defined through a rule file describing the actions to be taken in such cases (X+4 limitation: only the recommended action is performed, no rule file is considered).

The Next iteration columns define complementary actions that have to be performed:

deep first

If set to yes, the merging process has to be performed on current node’s sub-levels BEFORE the resulting recommended (or alternate) action.

next sibling

It defines in which tree(s) the current node’s cursor has to be moved to the next sibling AFTER the resulting action.

Iteration Example

If we consider 3 mask files whose file structure is as follows, and the current iteration is as indicated by the red cursor box:



Then, based on the table above, the current iteration situation is "Node added in Cus":

External Pattern Results Next Iteration
Situation

description

Recommendation Alternate deep first next sibling
Action Node Action Node Ref New Cus
Node added in Cus Add Cus     No     X

The action to be taken is "Add Cus". In such case, it is not necessary to continue merging on sub-levels before performing the "Add Cus" action (this explains why deep first = no).

So, the E2 node (and its sub-tree) is added to the current result:

Then, the current node's cursor in the CUS tree is moved to the next sibling, which results in the following case at the beginning of the next iteration:

Note: The recommended action is performed, no rule file is taken into consideration.

Sample

Suppose we have the following initial file content:

REF

DEFAULT version (n)

NEW

DEFAULT version (n+1)

CUS

customized version (n)

MASK DEFAULT

ENTITY E1

ENTITY E2

ENTITY E4

ATTR A1;N;N;Ref

MASK DEFAULT

ENTITY E1

ENTITY E2

ENTITY E4

ATTR A1;Y;N;Ref

MASK MYCUSTO

ENTITY E1

ENTITY E3

ENTITY E4

ATTR A1;N;N;Cus

Once loaded, the initial data are as follows (N.B: the authorized value flag property was not listed, to reduce the number of iterations:



Merging iterations start on the 1st child node of each root mask node. Here, it is Entity E1:

Iteration Result


Situation: No change

Action: KEEP CUS

Deep first, but no child node -> continue with next sibling of REF, NEW and CUS trees.





Situation: Removed from CUS

Action: IGNORE NEW

Next sibling: REF, NEW





Situation: Added in CUS

Action: ADD CUS

Next sibling: CUS





Situation: No change

Action: KEEP CUS

Deep first ‡ start a new iteration process on ENTITY E4’s sub-level tree.





Situation: No change

Action: KEEP CUS

Deep first -> start a new iteration process on ATTR A1’s sub-level tree





Situation: Node value changed in NEW

Action: KEEP NEW

Deep first, but no child nodes on properties level (“_”) -> continue with next sibling of REF, NEW and CUS trees.





Situation: Node value changed in CUS

Action: KEEP CUS

Deep first, but no child nodes on properties level (“_”) -> continue with next sibling of REF, NEW and CUS trees.





There is no more sibling in any of the REF, NEW & CUS trees of the current iteration level (ATTR A1’s trees).

The current sub-level iteration process stops, and goes back to ENTITY E1’s trees iteration level.



There is no more sibling in any of the REF, NEW & CUS trees of the current iteration level (ENTITY E1’s trees).

The current sub-level iteration process stops, and goes back to root (mask) trees iteration level.



There is no more sibling in any of the REF, NEW & CUS trees of the root iteration level.

The merger process ends, and the resulting tree is:



The resulting mask file is (N.B: in red is the difference v/s customized mask in version (n):

MASK MYCUSTO

ENTITY E1

ENTITY E3

ENTITY E4

ATTR A1; Y;N;Cus

Mask Merger Syntax

VPLMPosMaskMerger is a server-side batch program (a shell on UNIX), located in:


  • INSTALL_PATH\server\win_b64\code\command (on Windows)
  • INSTALL_PATH/server/scripts (on UNIX).

The mask merger merges all mask files listed in the previous customization directory of each specified mask name (<previous_custo_dir>/vplm/mask/<mask_name>).

The merge is based on previous and current DEFAULT version, and of course the previous customization version of each mask file.

Each merged file is generated in a sub-directory of the output directory, depending on the specified mask name (<output_dir>/vplm/mask/<mask_name>). Note that not existing output sub-directories are automatically created, if possible (an error is raised otherwise).

Note: the merger does not use the PLM Dictionary to make additional checks, as the mask compiler does (for instance, checking an entity really exists). It only requires mask files to have a correct mask file syntax.

IMPORTANT: as only mask files (mask sources) are merged – and not SecurityMask files (result) – the administrator has to compile them using the VPLMPosMaskCompiler tool after merge, and redeploy the compiled SecurityMask file in the Web Application Server.

VPLMPosMaskMerger		[-h]
         -m	<mask_name> [<mask_name> ...]
         -p	<previous_DEFAULT_dir> <current_DEFAULT_dir> [<previous_custo_dir>]
         [-d <output_dir>]

The syntax is as follows:

Keyword Description
-h Dump help
-m <mask_name> The list of customized mask names whose mask files have to be merged.
-p <previous_DEFAULT_dir> <current_DEFAULT_dir> [<previous_custo_dir>] Specifies the base directories of mask files:
  • customized mask files must be located in a vplm/mask/<mask_name> subdirectory of <previous_custo_dir>
  • DEFAULT mask files have to be located in a vplm/mask/DEFAULT subdirectory of <previous_DEFAULT_dir> and <current_DEFAULT_dir>.

    By default, <previous_custo_dir> is set to <previous_DEFAULT_dir>.

[-d <output_dir>] Specifies the output location of generated files:
  • merger.log file
  • the generated mask file(s).

    Any mask file found in the <previous_custo_dir>/vplm/mask/<mask_name> subdirectory of each <mask_name> parameter is merged, and generated in a corresponding output filetree structure : <output_dir>/vplm/mask/<mask_name> (sub-directories are created if necessary).

    If this option is not specified, the current path is used as output.

    Rule: the output directory must be different from the <previous_custo_dir>.

Example

Let’s consider the following filetrees:

         /previousInstallation
         /vplm
		          /mask
               /DEFAULT
				               PLMProductDS.mask
                   …
			            /MYMASK
                   PLMProductDS.mask
         /currentInstallation
         /vplm
		          /mask
			            /DEFAULT
		               	PLMProductDS.mask
                  ...

Executing:

VPLMPosMaskMerger -m MYMASK -p /previousInstallation /currentInstallation

merges all MYMASK customized mask files located in:

/previousInstallation/vplm/mask/MYMASK directory

according to their DEFAULT versions located in:

/previousInstallation/vplm/mask/DEFAULT

and:

/currentInstallation/vplm/mask/DEFAULT

directories (previous and current version, respectively), and generates merged version of mask files in:

./vplm/mask/MYMASK

If we consider there is only one file named PLMProductDS.mask in the /previousInstallation/vplm/mask/MYMASK directory, only one merged file will be generated:

./vplm/mask/MYMASK/PLMProductDS.mask

Limitations

Limitation 1

This limitation concerns node reordering after merging.

Some nodes have to be resorted according to their original appearance order, because this order is important. This is the case for authorized values (VALUE) and attributes use in function (FATTR).

As resulting nodes may from different trees (NEW or CUSTO), their weight in their original tree from may not well coincide in the resulting tree. Recombining them according to this weight (plus the alphabetical order if weights are the same) may lead to "bizarre" orders, semantically speaking, although this is a normal behaviour.

Here is a small example:

Here, the order (One, Many, Two) may seem inappropriate (a logical order would have been : One - Two - Many), but:


  • One and Many come from the CUS tree; they kept their respective original order such that Many (weight=1) appears after One (weight=0).
  • Two comes from the NEW tree, with the same weight as Many (=1). As Many"" is alphabetically lower than "Two", it appears finally before "Two".

This is because the sort is NOT - of course - a semantic sort.

Limitation 2
Management of alternate actions with an external rules file in ambiguous cases is currently not supported.