Custom metrics can be defined for:
- standard CAST AIP supported technologies
- custom technologies configured via the CAST Universal Analyzer (see the Creating or modifying a custom extension using the CAST Universal Analyzer framework)
Custom metrics are grep based metrics that use regular expressions to generate the required data. They are not based on the technology's grammar - if, indeed there is any.
Please note that :The
the legacy CastMetrics.xml file that is stored in the CAST AIP installation folder is no longer used during an analysis/snapshot generation. If you have customized this file in the past, its content must be moved to one or several XXXCastMetrics.xml files. It is highly recommended to have one file per custom language or one file for custom metrics for a standard language.
File naming conventions
The XXX in the name of the XML file signifies that you are free to choose how you name the file provided that you retain CastMetrics.xml as the end part of the filename. CAST suggests using the name of the technology as a prefix to CastMetrics.xml but this is not obligatory. In addition you are not limited to three characters. You could, for example, use a file called CASTXSLCastMetrics.xml.
Ensuring the XXXCastMetrics.xml file is taken into account
Step 1 - File location
The XXXCastMetrics.xml file must be manually copied to the following location so that it is taken into account during the analysis:
%ALLUSERSPROFILE%%PROGRAMDATA%\CAST\CAST\<version>\Configuration\Languages\<technology folder name>\XXXCastMetrics.xml
When extending metrics for technologies analyzed by a custom
UA language pack
- When extending metrics for technologies that are analyzed by a custom or CAST provided UA language pack, the <technology folder name> folder will already exist. It is the same folder as is used to store the XXXMetaModel.xml file and the files used in the language pack.
- In addition, the XXXCastMetrics.xml file may already exist in this folder - if this is the case, CAST recommends creating an additional XXXCastMetrics.xml file to configure your bespoke metrics to avoid modifying the XXXCastMetrics.xml file configured for the language pack. Take the example of the this PHP Language Pack provided by CAST - this already has a PHPCastMetrics.xml file and an additional PHPCustomCastMetrics.xml has been created for bespoke metrics:
When extending metrics for technologies analyzed by a standard CAST AIP analyzer
- When extending metrics for technologies such as Cobol, VB or other technologies supported by a standard CAST AIP analyzer, you will need to create the <technology folder name> folder yourself. CAST recommends that this folder is named the same as the technology your are targeting with your XXXCastMetrics.xml file. You can find out what name to use by using the same folder name as is used in AIP - navigate to the following location to see a list of core AIP technology names:
- Take the example of extending the Cobol technology - the CobolCastMetrics.xml file is should located in a folder called Cobol:
Step 2 - Install the <all users dir> extension with CAST Server Manager
You now need to run CAST Server Manager > Manage Extensions to install the <all users dir> extension. This will ensure that the custom XXXCastMetrics.xml is installed correctly. This is explained in more detail here:
|This step must be completed when creating custom metrics for both custom UA language packs AND core AIP technologies.|
XML file encoding
The XXXCASTMetrics.xml file used in the Language Package must use the UTF-8 encoding as follows: