Dynamic Link Manager filter rules


CAST provides the Dynamic Link Manager to process unverified links (links that have been identified between objects but their authenticity cannot be absolutely determined by CAST) that have been identified during an analysis and then saved to the Analysis Service.

However, in some circumstances, a large amount of unverified links can be generated during an analysis and often these unverified links systematically occur or have no meaning for the specific technology you are working with. In this case, it can be very time consuming to process the links manually in the Dynamic Link Manager.

In previous releases, CAST introduced External Link engine parametrization which enabled the user to create rules to either validate or ignore certain links every time an analysis was run. However, this method is not flexible and cannot be tested accurately before being put into practice. To counter this, CAST has introduced filter rules that can be written, tested and applied in the CAST Management Studio GUI at Application and Analysis Unit/Technology level: each time an analysis is run, the filter rules will be applied, either validating or ignoring links as required. In addition, rules can be processed via a command line utility for one-shot processing - this negates the need to re-run the analysis just to get the rules processed.

Rule files and filters

Filter rules use XML formatting and must, therefore be created in a file with an .DLM.XML extension (for example rules.DLM.XML):

Example rule file and explanation

Take the following example rule file and the filters defined in it (adjust the URL in the tag<dynamicLinksRules> to your own DlmRulesModel.xsd file):

<?xml version="1.0" encoding="utf-8"?>
<dynamicLinksRules xmlns="<URL to DlmRulesModel.xsd>" >
	<rule name="Rule1" action="validate" >
		<scope>
			<application name="app1"/>
			<application name="app2">
				<analysisUnit name="au21"/>
			</application>
			<application name="app2">
				<technology name="J2EE"/>
			</application>
		</scope>
		<calleeName regexp="a2"/>
		<calleeType names="A_Metamodel_Type"/>
		<callerFullName regexp="a4"/>
	</rule>
	<rule name="Rule2" action="ignore">
		<calleeFullName regexp="a4"/>
	</rule>
</dynamicLinksRules>

When this rule file is used:

Filters in detail

As described previously, a filter is an operator that selects links that match criteria:

Filters are piped together in order to compose the body of a rule. The final result will be tagged as validated or ignored.

Scope

You can define the following scope entries in your filter:

Application
<scope> <application name="app1"/></scope>
Technology
<scope> <application name="application">  <technology name="technology"/> </application></scope>
Analysis Unit
<scope> <application name="application">  <analysisUnitname="analysisUnit"/> </application></scope>

Note:

- By default when you assign a rule file in the CAST Management Studio GUI, the Scope option will be set to "Force use of CMS scope" - this will mean that any scope defined in the DLM.xml file (using the <scope>...</scope> element as explained above) will be ignored and a scope matching the CMS tab in which the rule file is defined will always be used during an analysis.

- You can manually change the Scope option to "Preserve scope from file" by clicking the option (see image below). This will force the CAST Management Studio to take into account the scope defined in the DLM.xml file (using the <scope>...</scope> element as explained above):

Filter list

You can define the following link definition filters:

<callerName regexp="string"/>Filters the stream according to the caller nameSee Filter rules - Regular Expression based
<callerFullName regexp="string"/>Filters the stream according to the caller full nameSee Filter rules - Regular Expression based
<callerType names="string"/>Filters the stream according to the caller typeSee Filter rules - Metamodel based
<calleeName regexp="string"/>Filters the stream according to the callee nameSee Filter rules - Regular Expression based
<calleeFullName regexp="string"/>Filters the stream according to the callee full nameSee Filter rules - Regular Expression based
<calleeType names="string"/>Filters the stream according to the callee typeSee Filter rules - Metamodel based
<linkType names="string"/>Filters the stream according to the link typeSee Filter rules - Metamodel based
<rawStringFromCode regexp="string"/>Filters the stream according to a regular expression on the whole line of codeSee Filter rules - Bookmark based
<leftStringFromCode regexp="string"/>Filters the stream according to a regular expression on the left part of the code before the matched callee nameSee Filter rules - Bookmark based
<rightStringFromCode regexp="string"/>Filters the stream according to a regular expression on the right part of the code after the matched callee nameSee Filter rules - Bookmark based
Putting filters into practice

CAST recommends that filters are introduced in the following way:

  1. Identify recurring dynamic links using the GUI based Dynamic Link Manager (see Reviewing Dynamic Links) based on Caller and Callee objects and the line of code.
  2. Create filters to match these recurring dynamic links
  3. Run the filters using the command line utility (see below for more information)
  4. Verify that the initial command line run has functioned as expected using the GUI based Dynamic Link Manager (see Reviewing Dynamic Links) - i.e. check that the links you wanted to validate/ignore have been validated/ignored.
  5. Associate your rule file to the Application/Technology/Analysis Unit in the CAST Management Studio GUI (see below for more information)
  6. Any rule files associated through the GUI will be processed each time you run an analysis:

Command line

To test your filters, please use the following command line. You can find the DynamicLinks.CLI.exe file in the DLM folder at the root of your CAST installation:

DynamicLinks.CLI.exe executeRules --ruleFile="yourRuleFile.DLM.XML" --profile="My Management on CastStorageService"

Note that if you want to undo any actions that have been applied by the Command Line explained above, you can use the following "undo" syntax. In this situation, all actions previously applied in your filters will be undone (whether Validate or Ignore) and the status of the links will be set to To be reviewed.

DynamicLinks.CLI.exe undoRules --ruleFile="yourRuleFile.DLM.XML" --profile="My Management on CastStorageService"

Associating rule files to Applications/Technologies/Analysis Units

To associate your rule file in the CAST Management Studio GUI, do as follows. Remember to read up on how the "scope" functions:

Application
To apply the filter rule at Application level (i.e. to all Analysis Units and Technologies present in the Application), use the:
  • Application editor > Production tab > Common tab > Dynamic Link Rules:

Technology
To apply the filter rule at Technology level (i.e. to all of the selected Technologies present in the Application), use the:
  • Application editor > Production tab > [Technology_type] tab > Dynamic Link Rules:

Analysis Unit
To apply the filter rule at Analysis Unit level (i.e. to the Analysis Unit alone), use the:
  • Analysis Unit editor > Production tab > Dynamic Link Rules:

See Also

Filter rules - Bookmark based | Filter rules - Metamodel based | Filter rules - Regular Expression based


CAST Website