DMT Framework Scanner - 1.2

Extension ID

com.castsoftware.dmtxmlscanner

What’s new?

See Release Notes - 1.2.

Description

The DMT Framework Scanner (com.castsoftware.dmtxmlscanner) extension automatically generates information for the “Source Code Delivery” report that is available in the CAST Delivery Manager Tool. The extension can be downloaded on its own as a standalone extension and is also shipped and automatically installed with CAST 8.3.x where x ≥ 5.

What does it do

The extension will scan all source code it encounters during the packaging action (scan phase) in the CAST Delivery Manager Tool and will attempt to identify a framework/technology/analyzer based on predefined patterns provided with the extension. Information about any framework/technology/analyzer that is identified in the source code will be provided in the Source Code Delivery report that is available in the CAST Delivery Manager Tool - this information can then be used, for example, to install any additional extensions that may be required:

Out of the box framework pattern support

The extension is shipped with a set of predefined pattern configuration files that are set up to identify the most common frameworks. When the extension is installed, the “active” pattern configuration files can be found in the following location:

<delivery_folder>\dmtxmlscanner-<version>\*.config

The following patterns are provided “out of the box” - please check each .config file to see which frameworks are supported:

Technology/Item Pattern file Notes
Technology analyzer.config

Identifies technology types based on file extensions. For example:

Analyzer_Name=file extensions seperated by ','(coma) without dot
Python=py,pyx,pxd,pxi,pyt,pyw,wsgi,xpy,wscript,pytb,numpy,numpyw,numsc
Cpp=c,cpp,c++,w,pc,cxx,h++,hh,hpp,hxx,tcc,tpp,upc
JEE=java
ABAP=abap
ANTLR=g4
ASP=aspx,aspx-vb,asp,asax,,ascx,ashx,asmx,axd
ActionScript=as

This will give the following results, which can be used, for example, to identify which CAST AIP extensions may need to be installed:

C / C++

ccpp_language.config

Identifies frameworks based on file extensions and other methods.
.NET

dotnet_language.config

Identifies frameworks based on file extensions and other methods.
JEE XML file

framework_doctypes.config

Identifies frameworks based on the URL referenced in the DOCTYPE element in the XML file.
JEE XML file

framework_xmlnamespaces.config

Identifies frameworks based on the XMLNS attribute of the first node in the XML file, or the schema location. For example, the following is taken from a Spring Framework 3.1 for Spring Beans:

<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:util="http://www.springframework.org/schema/util"
        xmlns:jee="http://www.springframework.org/schema/jee"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
            http://www.springframework.org/schema/util
            http://www.springframework.org/schema/util/spring-util-3.1.xsd
            http://www.springframework.org/schema/jee
            http://www.springframework.org/schema/jee/spring-jee-3.1.xsd"
        default-lazy-init="true">

The above would be matched by the following predefined pattern:

springbeans;3.1;http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
Note that if a version number attribute is found in the XMLNS, then this number will be recorded, rather than the version number specified in the *.config file.
JEE XML file

framework_xmlnodes.config

Identifies frameworks based on the first XML element in the XML file if it doesn't have any attributes.

If it is not possible to identify the framework with the first element in the XML file, then the next child element will be used: this is targeted at build systems such as Maven and Ant which use an initial <project> element with attributes and then a child element called <target>, take for example this Ant XML file:

<project name="simpleCompile" default="deploy" basedir=".">
   <target name="init">
      <property name="sourceDir" value="src"/ >
      <property name="outputDir" value="classes" />
      <property name="deployJSP" value="/web/deploy/jsp" />
      <property name="deployProperties" value="/web/deploy/conf" />
   </target>

To match the above, use the following configuration in the .config file:

ant;;project/target
Java java_language.config Identifies frameworks based on file extensions and other methods.
PHP php_language.config Identifies frameworks based on file extensions and other methods.
Python python_language.config Identifies frameworks based on file extensions and other methods.
Web related (AngularJS, jQuery etc.) web_language.config Identifies frameworks based on file extensions and other methods.

Customizing framework support

If you would like to customize the list of frameworks identified by the extension, you can do so by modifying the appropriate *.config file located here:

<delivery_folder>\dmtxmlscanner-<version>\*.config

This will modify the extension in the current Delivery folder for all Applications managed in that Delivery folder. The majority of *.config files use the following format:

fileExtensions=<semi-colon_separated_list>
<framework_name1>;<version>;<framework_identifier_pattern>
<framework_name2>;<version>;<framework_identifier_pattern>
etc.

framework_xmlnamespaces.config

When using the framework_xmlnamespaces.config to match XML namespaces, you can use a “wildcard” pattern when you want to match multiple different frameworks in the same XML file, as follows:

<framework>;x.y.z;<framework_identifier_pattern>

For example, to avoid entering the following in the .config file to match the specific versions of the ActiveMQ framework:

activemq;4.1.1;http://activemq.apache.org/schema/core/activemq-core-4.1.1.xsd
activemq;4.1.2;http://activemq.apache.org/schema/core/activemq-core-4.1.2.xsd

you can use the following to match all versions of the framework:

activemq;x.y.z;http://activemq.apache.org/schema/core/activemq-core-x.y.z.xsd

XML file size limit

All XML files over 1MB in size will be ignored - this is to avoid performance issues when very large XML files are present in the source code.

Compatibility

CAST Imaging Core
Supported
8.3.x where x ≥ 5 (tick)

Download and installation instructions

  • The extension will not be automatically downloaded and installed in CAST Imaging Console. If you need to use it, should manually install the extension.

CAST Delivery Manager Tool GUI

The extension provides two CAST Delivery Manager Tool “discoverers”, these can be seen below:

Discoverer Description
Source file scanner Scans file extensions only as defined in the .config files named <technology>_language.config and analyzer.config
XML scanner Scans only XML files as defined in the .config files named framework_<type>.config
  • If you have existing packages:
    • and this extension (nor its predecessor the DMT XML Scanner 1.0) have been installed before, then both discoverers will not be automatically activated (i.e. ticked). If you would like to benefit from the information provided by the extension in the Source Code Delivery report, please enable them before the next package action.
    • and the extension’s predecessor (DMT XML Scanner 1.0) has been installed before, then the XML scanner discoverer will be ticked, but the Source file scanner will not.
  • For all packages created after the installation of the extension, both discoverers will be automatically activated (i.e. ticked).

What results can you expect?

The results of the source code scan can be seen in the Source Code Delivery report in the CAST Delivery Manager Tool:

This report is an XML file and a specific section is dedicated to reporting any frameworks/versions that have been identified in the source code, for example: