jQA logo

Your Software. Your Structures. Your Rules.

This document describes the concepts of jQAssistant and usage information.

1. Overview

jQAssistant is a QA tool which allows the definition and validation of project specific rules on a structural level. It is built upon the graph database Neo4j and can easily be plugged into the build process to automate detection of constraint violations and generate reports about user defined concepts and metrics.

Example use cases:

  • Enforce naming conventions, e.g. EJBs, JPA entities, test classes, packages, maven modules etc.

  • Validate dependencies between modules of your project

  • Separate API and implementation packages

  • Detect common problems like cyclic dependencies or tests without assertions

The rules are expressed in Cypher - the easy-to-learn query language of Neo4j:

MATCH
  (t:Test:Method)
WHERE NOT
  (t)-[:INVOKES]->(:Assert:Method)
RETURN
  t AS TestWithoutAssertion

2. License

jQAssistant is contributed under GNU General Public License, v3.

3. Requirements

  • Java Runtime Environment 7 (64 bit recommended) or later (it is still possible to analyze applications which have been compiled with older Java versions)

  • at least 1GB of RAM

Note
Adjusting memory settings can be achieved by setting the environment variables JQASSISTANT_OPTS (command line) or MAVEN_OPTS (Maven), e.g.
Windows
set JQASSISTANT_OPTS=-Xmx1024M -XX:MaxPermSize=512M
set MAVEN_OPTS=-Xmx1024M -XX:MaxPermSize=512M
Linux
export JQASSISTANT_OPTS=-Xmx1024M -XX:MaxPermSize=512M
export MAVEN_OPTS=-Xmx1024M -XX:MaxPermSize=512M
Note
If Java 7 is used to execute jQAssistant the PermGen size of the JVM must be set to 512MB (-XX:MaxPermSize=512M).

4. Quickstart

4.1. Command Line

4.1.1. Requirements

  • Java Development Kit 7 or later

  • the environment variable JQASSISTANT_OPTS should be set to adjust memory settings

Windows
set JQASSISTANT_OPTS=-Xmx1024M -XX:MaxPermSize=512m
Linux
export JQASSISTANT_OPTS=-Xmx1024M -XX:MaxPermSize=512m
Note
-XX:MaxPermSize=512M is only required for Java 7

4.1.2. Installation

  • Download and unpack the distribution, a directory jqassistant-commandline-neo4jvx-version will be created.

4.1.3. Scan

Windows
bin\jqassistant.cmd scan -f lib
Linux
bin/jqassistant.sh scan -f lib
  • The JAR files contained in the lib/ folder will be scanned.

4.1.4. Explore

Windows
bin\jqassistant.cmd server
Linux
bin/jqassistant.sh server
  • Open a browser and navigate to http://localhost:7474

  • Enter the following query in the top level area and hit Ctrl-Enter:

MATCH
  (a:Artifact)-[:CONTAINS]->(t:Type)-[:DECLARES]->(m:Method)
RETURN
  a.fileName as Artifact, t.fqn AS Type, count(t) AS DeclaredMethods
ORDER BY
  DeclaredMethods DESC
LIMIT 20

4.2. Maven

4.2.1. Requirements

  • Maven 3.2 or later

  • Java Development Kit 7 or later

  • the environment variable MAVEN_OPTS must be set to adjust memory settings

Windows
set MAVEN_OPTS=-Xmx1024M -XX:MaxPermSize=512m
Linux
export MAVEN_OPTS=-Xmx1024M -XX:MaxPermSize=512m
Note
-XX:MaxPermSize=512M is only required for Java 7

4.2.2. Add the plugin

Add the following lines to the parent pom.xml file of your project:

<build>
    <plugins>
        <plugin>
            <groupId>com.buschmais.jqassistant</groupId>
            <artifactId>jqassistant-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>scan</goal>
                        <goal>analyze</goal>
                    </goals>
                    <configuration>
                        <failOnSeverity>MAJOR</failOnSeverity>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<reporting>
    <plugins>
        <plugin>
            <groupId>com.buschmais.jqassistant</groupId>
            <artifactId>jqassistant-maven-plugin</artifactId>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>report</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
    </plugins>
</reporting>

4.2.3. Add a rule

Within your parent module create a directory "jqassistant" and a rules file "my-rules.xml" in it:

jqassistant/my-rules.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/rule/schema/v1.3">

    <constraint id="my-rules:TestClassName">
        <requiresConcept refId="junit4:TestClass" />
        <description>All JUnit test classes must have a name with suffix "Test".</description>
        <cypher><![CDATA[
            MATCH
                (t:Junit4:Test:Class)
            WHERE NOT
                t.name =~ ".*Test"
            RETURN
                t AS InvalidTestClass
        ]]></cypher>
    </constraint>

    <group id="default">
        <includeConstraint refId="my-rules:TestClassName" />
    </group>

</jqa:jqassistant-rules>

4.2.4. Run the build

Execute the following command from your parent module:

mvn install

The build will fail with the message specified by your rule if it is violated. If everything is fine you can also create a report as part of your Maven site:

mvn site

4.2.5. Explore your application

jQAssistant comes with an integrated Neo4j server, you can run it using

mvn jqassistant:server
  • Open a browser and navigate to http://localhost:7474

  • Enter the follwoing query in the top level area and hit Ctrl-Enter:

MATCH
  (t:Type)-[:DECLARES]->(m:Method)
RETURN
  t.fqn AS Type, count(t) AS DeclaredMethods
ORDER BY
  DeclaredMethods DESC
LIMIT 20

5. Introduction

This chapter provides an introduction to the concepts of jQAssistant.

5.1. How it works

The basic idea behind jQAssistant is to integrate the following steps into the build process of a software system:

  1. Scan the generated artifacts and store structural information about them into a database

  2. Analyze the structures using rules which are represented by queries

  3. Report violations

jQAssistant itself is a plugin based framework. It comes with a pre-defined set of plugins containing scanners, rules and reports but can be easily extended by custom rules or implementations.

As database an embedded instance of Neo4j Community Edition is managed and used by jQAssistant. This means that no setup or configuration of a dedicated server is required. Neo4j has been chosen because:

  • it is a mature open source graph database

  • it allows easy modelling of structural elements of a software and their relations

  • it comes with a very expressive and easy to learn query language (Cypher)

5.2. Scanner

Scanners are used to import software structures into the database. They are provided by plugins and may support several types of artifacts, e.g. Java classes, XML files or database structures. The jQAssistant framework (including the command line or Maven plugin) only provides the infrastructure to run a scan operation on a set of items, e.g. files, directories or URLs. Every active plugin decides itself if it accepts and imports a given item by checking several conditions, e.g. file name extensions or a provided scope. The latter is an extra information which provides specific context information like "java:classpath" for a directory containing Java classes or "maven:repository" for a URL.

5.3. Rules

Rules are expressed as Cypher queries and are specified either in XML or AsciiDoc files:

5.3.1. XML example

my-rules.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/rule/schema/v1.3">

    <group id="default">
        <includeConstraint refId="my-rules:MyConstraint"/>
    </group>

    <concept id="my-rules:MyConcept">
        <description>A human readable description of the concept.</description>
        <cypher><![CDATA[
            MATCH
              ...
            WHERE
              ...
            SET
              ...
            CREATE
              ...
            RETURN
              ...
        ]]></cypher>
    </concept>

    <constraint id="my-rules:MyConstraint" severity="blocker">
        <requiresConcept refId="my-rules:MyConcept" />
        <description>A human readable description of the constraint.</description>
        <cypher><![CDATA[
            MATCH
                ...
            WHERE
                ...
            RETURN
                ...
        ]]></cypher>
    </constraint>

</jqa:jqassistant-rules>

5.3.2. AsciiDoc example

my-rules.adoc
[[my-rules:MyConcept]]
.A human readable description of the concept.
[source,cypher,role=concept]
----
MATCH
  ...
WHERE
  ...
SET
  ...
CREATE
  ...
RETURN
  ...
----

[[my-rules:MyConstraint]]
.A human readable description of the constraint.
[source,cypher,role=constraint,requiresConcepts="my-rules:MyConcept",severity=blocker]
----
MATCH
  ...
WHERE
  ...
RETURN
  ...
----

[[my-rules:MyGroup]]
.A human readable description of the group.
[role=group,includesConstraints="my-rules:MyConstraint(minor)"]
== My Group

Each rule comes with an unique id (e.g. "my-rules:MyConstraint") which can be referenced by other rules. jQAssistant will take care about executing the rules in the correct order. Furthermore a human readable description shall help developers to understand the rationale behind them.

5.3.3. Groups

A group is a set of rules that shall be executed together by including them with the option to overwrite their default severity. This allows to adjust analysis depth for different types of builds, e.g. a Continuous Integration build (CI) can be configured to only execute rules with low costs (i.e. execution times) whereas a report build is allowed to run for a longer time with more expensive checks.

5.3.4. Concepts

The information created by the scanner represents the structure of a software project on a raw level. Concept rules allow enriching the database with higher level information to ease the process of writing queries that check for violations (i.e. constraints) . This typically means adding labels, properties or relations.

jQAssistant comes with language and framework plugins which include general technical concepts, e.g.

  • "jpa2:Entity" provided by the JPA2 plugin adds a label "Entity" to a node if it represents a class which is annotated by "@javax.persistence.Entity".

  • "java:MethodOverrides" provided by the Java plugin adds a relation "OVERRIDES" between a method of a sub class to the super class methods it overrides.

It is recommended to use concepts to enrich the database with information which is specific for the concrete project, e.g. labels can be added to

  • package nodes representing modules of the application ("Module")

  • package nodes that represent technical layers ("UI", "EJB")

  • class nodes representing elements with a specific role ("Controller", "Model")

NOTE Even if the primary intention of a concept is to enrich data it still must provide a return clause. If a concept returns an empty result a warning will be generated by jQAssistant. The rationale is that in such case the concept does not match the structure of the application and other rules which depend on it will probably not work as expected. The return clause of the concept shall preferably return a node/relation itself instead of an attribute of it. Similarly, return clauses with only count of matching nodes shall be avoided. With this, XML and HTML reports can provide additional information about the concept.

5.3.5. Constraints

A Constraint is a query which detects violations, e.g.

  • classes with specific roles (e.g. entity, controller, etc.) that are either located in the wrong packages or have names that do not fit defined conventions

  • invocations of methods which are deprecated and/or forbidden (e.g. constructors of java.util.Date)

  • dependencies to other modules which are not allowed

A constraint can depend on one or more concepts and usually is referenced by one or more groups.

NOTE If a constraint returns a result jQAssistant will report an error including the provided description and information about the returned elements. This information shall help the developer to understand and fix the problem.

5.3.6. Severity Of Rules

A rule may optionally define the severity level. jQAssistant allows to break the build if there are violations in the configured severity level (or higher). For example, if the severity is set to critical, and if there are violated constraints with blocker and/or critical severity; the build will break. This feature allows projects to pay down their technical debt in an iterative manner.

Following severity levels are supported:

  • info

  • minor (default for concepts)

  • major (default for constraints)

  • critical

  • blocker

There is no default severity for groups. If a severity is specified then it is applied to all included elements where no further severity is given, e.g.

my-rules.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/rule/schema/v1.3">

    <group id="my-rules:MyGroup" severity="blocker">
        <includeConstraint refId="my-rules:MyConstraint1"/>
        <includeConstraint refId="my-rules:MyConstraint2" severity="minor"/>
    </group>

<jqa:jqassistant-rules/>

or in Asciidoc:

[[my-rules:MyGroup]]
.A human readable description of the group.
[role=group,severity=blocker,requiresConstraints="my-rules:Constraint1,my-rules:Constraint2(minor)"]
== My Group

Thus execution of the group 'my-rules:MyGroup' will report a violation of constraint…​

  • …​'my-rules-Constraint1' with severity 'blocker' (inherited from the group)

  • …​'my-rules-Constraint2' with severity 'minor' (specified within the group)

5.3.7. Script Languages

Instead of cypher scripting languages like JavaScript, Ruby or Groovy may be used for writing concepts or constraints:

my-scripting-rules.xml
<constraint id="xmlExample:JavaScriptConstraint">
    <description>JavaScript example constraint: returns a result containing the number
        of declared methods for each class.</description>
    <script language="JavaScript">
        // Define the columns returned by the constraint
        var columnNames = java.util.Arrays.asList("Type", "MethodsOfType");
        // Define the list of rows returned by the constraint
        var rows = new java.util.ArrayList();
        // Execute a query using the store
        var typeIterator = store.executeQuery("match (t:Type:Class) return t").iterator();
        while(typeIterator.hasNext()) {
            // Get the next row from the query result
            var typeRow = typeIterator.next();
            // Get the column "t" from the row, it represents a type
            // descriptor as defined by the Java plugin
            var type = typeRow.get("t",
                com.buschmais.jqassistant.plugin.java.api.model.TypeDescriptor.class);
            // Get the declared methods of the type and count them
            var methodIterator = type.getDeclaredMethods().iterator();
            var methodsOfType = 0;
            while( methodIterator.hasNext()) {
                methodIterator.next();
                methodsOfType++;
            }
            // Define the row for the result and put the value for each defined column
            var resultRow = new java.util.HashMap();
            resultRow.put("Class", type);
            resultRow.put("MethodsOfType", methodsOfType);
            rows.add(resultRow);
        }
        // Return the result
        var status = com.buschmais.jqassistant.core.analysis.api.Result.Status.SUCCESS;
        new com.buschmais.jqassistant.core.analysis.api.Result(rule, status, severity, columnNames, rows);
    </script>
</constraint>

or in Asciidoc:

[[asciiDocExample:JavaScriptConstraint]]
.JavaScript example constraint: returns a result containing the number of declared methods for each class.
[source,javascript,role=constraint]
----
// Define the columns returned by the constraint
var columnNames = java.util.Arrays.asList("Type", "MethodsOfType");
// Define the list of rows returned by the constraint
var rows = new java.util.ArrayList();
// Execute a query using the store
var typeIterator = store.executeQuery("match (t:Type:Class) return t").iterator();
while(typeIterator.hasNext()) {
    // Get the next row from the query result
    var typeRow = typeIterator.next();
    // Get the column "t" from the row, it represents a type
    // descriptor as defined by the Java plugin
    var type = typeRow.get("t",
        com.buschmais.jqassistant.plugin.java.api.model.TypeDescriptor.class);
    // Get the declared methods of the type and count them
    var methodIterator = type.getDeclaredMethods().iterator();
    var methodsOfType = 0;
    while( methodIterator.hasNext()) {
        methodIterator.next();
        methodsOfType++;
    }
    // Define the row for the result and put the value for each defined column
    var resultRow = new java.util.HashMap();
    resultRow.put("Class", type);
    resultRow.put("MethodsOfType", methodsOfType);
    rows.add(resultRow);
}
// Return the result
var status = com.buschmais.jqassistant.core.analysis.api.Result.Status.SUCCESS;
new com.buschmais.jqassistant.core.analysis.api.Result(rule, status, severity, columnNames, rows);
----

5.3.8. Rule Parameters

Both concepts and constraints may define required parameters:

my-rules.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/rule/schema/v1.3">

    <concept id="my-rules:ApplicationRootPackage">
        <requiresParameter name="rootPackage" type="String" defaultValue="com.buschmais"/> (1)
        <description>Labels the root package of the application with "Root".</description>
        <cypher><![CDATA[
           MATCH
             (root:Package)
           WHERE
             root.name = {rootPackage} (2)
           SET
             root:Root
           RETURN
             root
        ]]></cypher>
    </concept>

</jqa:jqassistant-rules>
  1. Declaration of a required parameter with a default value.

  2. Reference to a parameter in a Cypher query.

or in Asciidoc:

[[my-rules:my-rules:ApplicationRootPackage]]
.Labels the root package of the application with "Root".
[role=group,role=concept,requiresParameters="String rootPackage; int limit"] (1)
----
MATCH
  (root:Package)
WHERE
  root.name = {rootPackage} (2)
SET
  root:Root
RETURN
  root
----
  1. requiresParameters is a list of parameter declarations separated by ;

  2. Reference to a parameter in a Cypher query.

The following parameter types are supported:

  • char

  • byte

  • short

  • int

  • long

  • float

  • double

  • boolean

  • String

The values for the required parameters must be provided by the execution context, e.g. the jQAssistant Maven plugin or the command line utility. A rule may specify a default value which is used if no concrete value is provided for an execution.

Note
Default values are currently not supported for rules in Asciidoc files.

For rules expressed in Cypher the parameters are referenced by {…​} placeholders. For scripts the values are passed as parameters, i.e. they may be used directly in the code.

5.3.9. Result verification

The default strategy (rowCount) verifies a result of a concept or constraint by counting the number of returned rows, i.e.

  • a concept is valid if it returns at least one row

  • a constraint is valid if it returns no row

This behavior can be customized by specifing min and max thresholds:

<constraint id="my-rules:MyConstraint">
    <description>A human readable description of the constraint.</description>
    <cypher><![CDATA[
        MATCH
          (n)
        WHERE
          ...
        RETURN
          n as Element
    ]]></cypher>
    <verify>
        <rowCount max="20"/>
    </verify>
</concept>
[[my-rules:MyConstraint]]
.A human readable description of the constraint.
[source,cypher,role=constraint,rowCountMax=20]
----
MATCH
  (n)
WHERE
  ...
RETURN
  n as Element
----

It is also possible to verify aggregated results reported as numeric values in a column, e.g.

<concept id="my-rules:MyConstraint">
    <description>A human readable description of the constraint.</description>
    <cypher><![CDATA[
        MATCH
          (n)
        WHERE
          ...
        RETURN
          count(n) as Count
    ]]></cypher>
    <verify>
        <aggregation column="Count" max="20"/>
    </verify>
</concept>
[[my-rules:MyConstraint]]
.A human readable description of the constraint.
[source,cypher,role=constraint,verify=aggregation,aggregationMax=20,aggregationColumn="Count"]
----
MATCH
  (n)
WHERE
  ...
SET
  ...
RETURN
  count(n) as Count
----
  • For each returned row the value of the column "Count" will be verified following the same principles as described above

  • The rule fails if at least one returned row does not match the expected result

  • The attribute column/aggregationColumn can be omitted, in this case the first column of the result is evaluated

  • Similar to the row count verification the attributes min/aggregationMin and max/aggregationMax can be specified for individual thresholds

5.3.10. Report

A rule may select a specific report plugin and pass properties to it:

<concept id="my-rules:MyConcept">
    <description>A human readable description of the concept.</description>
    <cypher><![CDATA[
        MATCH
          (m)-[]->(n)
          ...
        RETURN
          m, n
    ]]></cypher>
    <report reportType="myReport">
        <property name="key">value</property>
    </report>
</concept>
[[my-rules:MyConcept]]
.A human readable description of the concept.
[source,cypher,role=concept,reportType="myReport",reportProperties="key1=value1;key2=value2"]
----
    MATCH
      (m)-[]->(n)
      ...
    RETURN
      m, n
----
5.3.10.1. Primary Column

If a rule reports more than one column it might be necessary to specify the column which contains the primary element the rule refers to, e.g. the Java class. The information may be evaluated by reporting tools, e.g. for creating issues in SonarQube:

<concept id="my-rules:MyConcept">
    <description>A human readable description of the concept.</description>
    <cypher><![CDATA[
        MATCH
          (m)-[]->(n)
          ...
        RETURN
          m, n
    ]]></cypher>
    <report primaryColumn="n" />
</concept>
[[my-rules:MyConcept]]
.A human readable description of the concept.
[source,cypher,role=concept,primaryReportColumn="n"]
----
    MATCH
      (m)-[]->(n)
      ...
    RETURN
      m, n
----

NOTE The first column will be used automatically if no primary column is explicitly specified.

6. Command Line

Shell scripts are provided for executing jQAssistant from the command line of Microsoft Windows® or Unix compatible systems. They are located in the bin/ directory of the distribution:

  • jqassistant.cmd

  • jqassistant.sh

The command line accepts tasks and their specific options:

jqassistant.sh <task1> <task2> <task3> -<option1> -<option2>

The following example will scan the content of the directories classes/ and test-classes/:

jqassistant.sh scan -f classes,test-classes

6.1. Tasks

6.1.1. scan

6.1.1.1. Description

Scans files or directories and stores the gathered information in database. Files or URLs are accepted and may be specified further by scopes, e.g.

jqassistant.sh scan -f lib/,plugins/
jqassistant.sh scan -f java:classpath::classes/
jqassistant.sh scan -u http://host/artifact.jar
jqassistant.sh scan -u http://user:secret@host/artifact.jar
jqassistant.sh scan -u maven:repository::http://my.maven.repository
6.1.1.2. Options
  • -storeUri <uri>

  • -storeUsername <username>

  • -storePassword <password>

  • -f [<scope>::]<file1>,[<scope>::]<file2> or --files [<scope>::]<file1>,[<scope>::]<file2>

    • specifies a list of files or directories to scan

    • a scope may be used as prefix for each file argument

  • -u [<scope>::]<url1>,[<scope>::]<url2> or --urls [<scope>::]<url1>,[<scope>::]<url2>

    • specifies a list of URLs to scan

    • a scope may be used as prefix for each url argument

  • -reset

    • reset the database before scanning

  • -continueOnError

    • continue scanning even if a plugin fails with an unrecoverable error

Note
Using -continueOnError might create inconsistent data. Any reported errors should be reported to the plugin developer.

6.1.2. available-scopes

6.1.2.1. Description

List all available scopes which may be specified for scanning.

6.1.3. analyze

6.1.3.1. Description

Executes an analysis.

6.1.3.2. Options

6.1.4. available-rules

6.1.4.1. Description

List all available rules.

6.1.5. effective-rules

6.1.5.1. Description

List the rules which would be executed for an analysis and the given concepts, constraints or groups.

6.1.6. report

6.1.6.1. Description

Transforms an XML report into HTML.

6.1.6.2. Options

6.1.7. server

6.1.7.1. Description

Starts the integrated Neo4j web server.

  • -serverAddress <address>

    • specifies the binding address for the server (default: localhost)

  • -serverPort <port>

    • specifies the binding port for the server (default: 7474)

  • -daemon

    • terminate the server using <Ctrl-C> instead of waiting for standard input (allows to run the server on a machine as a background process / service)

6.1.8. Common options

6.1.8.1. -s, --storeDirectory <directory>
  • specifies the location of the database to use

  • default: './jqassistant/store'

  • Deprecated: use -storeUri <uri> instead

6.1.8.2. -storeUri <uri>
  • specifies the URI of the database to use, for remote databases 'bolt://localhost:7687'

  • default: 'file:jqassistant/store'

6.1.8.3. -storeUsername <username>
  • specifies the user name for authentication against remote databases

6.1.8.4. -storePassword <password>
  • specifies the password for authentication against remote databases

6.1.8.5. -groups <group1>,<group2>
  • specifies the ids of the groups to be executed

  • default: 'default'

6.1.8.6. -concepts <concept1>,<concept2>
  • specifies the ids of the concepts to be applied

6.1.8.7. -constraints <constraint1>,<constraint2>
  • specifies the ids of the constraints to be validated

6.1.8.8. -defaultConceptSeverity
  • specifies the default severity of concepts without an explicit severity

  • default: 'minor'

6.1.8.9. -defaultConstraintSeverity
  • specifies the default severity of constraints without an explicit severity

  • default: 'major'

6.1.8.10. -defaultGroupSeverity
  • specifies the default severity of groups without an explicit severity

  • default: 'none'

6.1.8.11. -r, --ruleDirectory <directory>
  • specifies the directory where rule files are located

  • default: './jqassistant/rules'

6.1.8.12. -rulesUrl <url>
  • specifies the URL of a file containing rules

  • this option is exclusive, i.e. it will disable loading rules from plugins or rule directories

6.1.8.13. -reportDirectory
  • specifies the directory where reports (XML, HTML) will be stored

  • default: './jqassistant/report'

7. Maven Plugin

jQAssistant provides a plugin for Apache Maven which can be used to provide either fully automated scanning and analysis during the build process or manual execution from a command line.

7.1. Setup

7.1.1. Project Scope

Software projects often consist of several modules which are assembled to executable or deployable artifacts. In a Maven project these modules are usually organized hierarchically with a common parent module which is referenced directly or indirectly by all sub-modules. For each project jQAssistant uses a separate database with its own set of rules. Thus if a goal is executed within a Maven structure jQAssistant first determines the project scope, i.e. the root module, by searching within the tree starting from the current module following the parent relation until either a module is found where a directory "jqassistant/" exists or no parent is defined. The determined root module defines the location of

  • the set of rules to apply (from the directory "jqassistant/")

  • the database, default "{project.build.directory}/jqassistant/store"

  • the generated native report, default: "{project.build.directory}/jqassistant/jqassistant-report.xml")

  • and the generated HTML report, default "{project.build.directory}/site/jqassistant.html")

The following examples demonstrate different scenarios, the root modules as detected by jQAssistant are marked using asterisks.

Single project consisting of two modules
root*
   |-pom.xml
   |
   |-jqassistant
   |           |-rules.xml
   |
   |-module1
   |       |-pom.xml
   |
   |-module2
           |-pom.xml
Multiple projects, each consisting of two modules
root
   |-pom.xml
   |
   |-project1*
   |        |-jqassistant
   |        |           |-rules1.xml
   |        |
   |        |-pom.xml
   |        |-module1
   |        |       |-pom.xml
   |        |
   |        |-module2
   |                |-pom.xml
   |
   |-project2*
            |-jqassistant
            |           |-rules2.xml
            |-pom.xml
            |-module1
            |       |-pom.xml
            |
            |-module2
                    |-pom.xml
Note
The described mechanism is designed to work for Maven module structures which are organized in hierarchies with consistent parent relations. For other setups it is possible to enforce using the module where the mvn goal is invoked as root module by setting the configuration option useExecutionRootAsProjectRoot (-Djqassistant.useExecutionRootAsProjectRoot).

7.1.2. Plugin Configuration

The jQAssistant Maven plugin must be configured in the pom.xml of the root module, it should not be overwritten by sub-modules.

Setup of the jQAssistant Maven plugin
<project ...>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>com.buschmais.jqassistant</groupId>
                <artifactId>jqassistant-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <id>scan</id>
                        <goals>
                            <goal>scan</goal>
                        </goals>
                        <!--
                        <configuration>
                            <scanIncludes>
                                <resetStore>true</resetStore>
                                <scanInclude>
                                    <path>config</path>
                                </scanInclude>
                                <scanInclude>
                                    <path>/opt/jenkins/var-jqa/workspace/rel-jqa-maven-plugin-manual-ManagedBuild/target/checkout/target/extra-classes</path>
                                    <scope>java:classpath</scope>
                                </scanInclude>
                            </scanIncludes>
                            <scanProperties>
                                <customScanner.property>value</customScanner.property>
                            </scanProperties>
                            <continueOnError>false</continueOnError>
                        </configuration>
                        -->
                    </execution>
                    <execution>
                        <id>analyze</id>
                        <goals>
                            <goal>analyze</goal>
                        </goals>
                        <!--
                        <configuration>
                            <warnOnSeverity>MINOR</warnOnSeverity>
                            <failOnSeverity>MAJOR</failOnSeverity>
                            <concepts>
                                <concept>junit4:TestClass</concept>
                            </concepts>
                            <constraints>
                                <constraint>junit4:TestMethodWithoutAssertion</constraints>
                            </constraints>
                            <groups>
                                <group>default</group>
                            </groups>
                            <ruleParameter>
                                <myRuleParameter>com.buschmais</myRuleParameter>
                            </ruleParameters>
                            <reportProperties>
                                <customReport.fileName>
                                    /opt/jenkins/var-jqa/workspace/rel-jqa-maven-plugin-manual-ManagedBuild/target/checkout/target/customReport.txt
                                </customReport.fileName>
                            </reportProperties>
                        </configuration>
                        -->
                    </execution>
                </executions>
                <!--
                <configuration>
                    <skip>false</skip>
                    <useExecutionRootAsProjectRoot>false</useExecutionRootAsProjectRoot>
                    <store>
                        <uri>file:target/myDatabaseDirectory</uri>
                        <username></username>
                        <password></password>
                    </store>
                    <storeLifecycle>REACTOR</storeLifecycle>
                    <rule>
                        <defaultConceptSeverity>MINOR</defaultConceptSeverity>
                        <defaultConstraintSeverity>MAJOR</defaultConstraintSeverity>
                        <defaultGroupSeverity></defaultGroupSeverity>
                    </rule>
                    <rulesDirectory>jqassistant</rulesDirectory>
                    <rulesDirectories>
                        <rulesDirectory>
                            /opt/jenkins/var-jqa/workspace/rel-jqa-maven-plugin-manual-ManagedBuild/target/checkout/target/generated-rules
                        </rulesDirectory>
                    </rulesDirectories>
                    <xmlReportFile>
                        /opt/jenkins/var-jqa/workspace/rel-jqa-maven-plugin-manual-ManagedBuild/target/checkout/target/jqassistant/jqassistant-report.xml
                    </xmlReportFile>
                    <serverAddress>localhost</serverAddress>
                    <serverPort>7474</serverPort>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.buschmais.jqassistant.plugin</groupId>
                        <artifactId>jqassistant.plugin.jpa2</artifactId>
                        <version>1.4.0</version>
                    </dependency>
                </dependencies>
                -->
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.buschmais.jqassistant</groupId>
                <artifactId>jqassistant-maven-plugin</artifactId>
                <version>1.4.0</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>
    ...
</project>
Note
Depending on the available Java Runtime environment the Maven plugin automatically uses Neo4j 2.x (Java 7) or Neo4j 3.x (Java 8 or later).

7.1.3. Command Line

Goals may also be executed from the command line:

mvn com.buschmais.jqassistant:jqassistant-maven-plugin:available-rules

Adding the following lines to the file settings.xml (usually located in the $HOME/.m2) eases execution of jQAssistant goals from the command line:

<pluginGroups>
    <pluginGroup>com.buschmais.jqassistant</pluginGroup>
</pluginGroups>

The same goal can now be executed using the following command line statement:

mvn jqassistant:available-rules

7.2. Goals

7.2.1. jqassistant:scan

7.2.1.1. Description

Scans the project directories according to the given configuration (e.g. compiled classes and test classes) and stores the gathered information in database.

7.2.1.2. Configuration
Warning
Using 'continueOnError' might create inconsistent data. Any reported errors should be reported to the plugin developer.

7.2.2. jqassistant:available-scopes

7.2.2.1. Description

List all available scopes which may be specified for scanInclude properties.

7.2.3. jqassistant:reset

7.2.3.1. Description

Resets the database by deleting all nodes and relationships.

7.2.4. jqassistant:server

7.2.4.1. Description

Starts the integrated Neo4j web server (default address: http://localhost:7474).

7.2.4.2. Configuration

7.2.5. jqassistant:analyze

7.2.5.1. Description

Executes an analysis.

7.2.5.2. Configuration

7.2.8. jqassistant:report

7.2.8.1. Description

Transforms the XML report into HTML (i.e. for generating a Maven site).

7.3. Common Configuration Properties

7.3.1. Execution

7.3.1.1. skip (-Djqassistant.skip)
  • skip execution of the plugin

  • default: 'false'

7.3.1.2. useExecutionRootAsProjectRoot (-Djqassistant.useExecutionRootAsProjectRoot)
  • force the module where 'mvn' is being executed to be used as root module

  • default: 'false'

7.3.2. Store

7.3.2.1. store
  • specifies the configuration of the database to use

  • uri

    • URI of the database, supported URI schemes are

    • 'file' for embedded databases, e.g. 'file:target/mystore'

    • 'bolt' (experimental) for connecting to a running Neo4j instance (3.x+), e.g. 'bolt://localhost:7687'

  • username

    • username ('bolt' connections only)

  • password

    • password ('bolt' connections only)

  • default: use embedded database at 'file:{rootModule}/target/jqassistant/store'

7.3.2.2. storeDirectory (-Djqassistant.store.directory)
  • specifies the location of the database, either a relative path to the root module directory or an absolute path

  • default: '{rootModule}/target/jqassistant/store'

7.3.2.3. storeLifecycle (-Djqassistant.store.lifecycle)
  • specifies the lifecycle of the data store

    • 'REACTOR': cache the store for the execution time of the reactor for fast execution

    • 'MODULE': open and close the store for each module, slower but required for maven reactors containing extensions

  • default: 'REACTOR'

7.3.3. Analysis And Report

7.3.3.1. concepts (-Djqassistant.concepts)
  • specifies the ids of the concepts to be applied

7.3.3.2. constraints (-Djqassistant.constraints)
  • specifies the ids of the constraints to be validated

7.3.3.3. groups (-Djqassistant.groups)
  • specifies the ids of the groups to be executed

  • default: 'default'

7.3.3.4. rule
  • specifies rule-related settings

  • defaultConceptSeverity

    • the default severity of concepts without an explicit severity

    • default: 'MINOR'

  • defaultConstraintSeverity

    • the default severity of constraints without an explicit severity

    • default: 'MAJOR'

  • defaultGroupSeverity

    • the default severity of groups without an explicit severity

    • default: none

7.3.3.5. rulesDirectory (-Djqassistant.rules.directory)
  • specifies the name of the directory which contains rules

  • this directory is also used to identify the root module of a project, see Project Scope

  • default: 'jqassistant'

7.3.3.6. rulesDirectories (-Djqassistant.rules.directories)
  • specifies a list of directory names relative to the root module containing additional rules

7.3.3.7. rulesUrl <url> (-Djqassistant.rules.url)
  • specifies the URL of a file containing rules

  • this option is exclusive, i.e. it will disable loading rules from plugins or rule directories

7.3.3.8. xmlReportFile (-Djqassistant.report.xml)
  • specifes the target file for writing the XML report

  • default: '{rootModule}/target/jqassistant/jqassistant-report.xml'

8. Plugins

This section provides detailed descriptions of all distributed plugins.

8.1. CDI Plugin

Provides rules for CDI.

8.1.1. Scanner for beans.xml files

Imports bean descriptors from META-INF/beans.xml or WEB-INF/beans.xml files.

8.1.1.1. Nodes labled with :File:Cdi:Beans

Represents a beans.xml file.

Table 1. Properties of :File:Cdi:Beans
Name Description

fileName

The file name

version

The version of the CDI specification this descriptor represents, e.g. 1.0

beanDiscoveryMode

The bean discovery mode, i.e. all, annotated or none

Table 2. Relations of :File:Cdi:Beans
Name Target label(s) Cardinality Description

HAS_INTERCEPTOR

Nodes labled with :Java:Type

0..n

References an interceptor type which is activated

HAS_DECORATOR

Nodes labled with :Java:Type

0..n

References a decorator type which is activated

HAS_ALTERNATIVE

Nodes labled with :Java:Type

0..n

References an alternative type (class or stereotype annotation) which is activated

8.1.2. Concepts and Constraints provided by the CDI Plugin

8.1.2.1. Concepts provided by the CDI plugin

8.1.3. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.2. EJB3 Plugin

Provides rules for EJB3.

8.2.1. Concepts and Constraints provided by the EJB3 Plugin

8.2.1.1. Concepts provided by the EJB3 plugin

8.3. GraphML Plugin

Provides a report plugin for generating GraphML files from the results of concepts.

8.3.1. GraphML Report

This plugin generates GraphML XML files for result data of concepts. Those files can be used with several graph rendering and analytics tools like yEd and Gephi.

By default all concepts ending in .graphml will be rendered (e.g. "module:modules.graphml").

8.3.1.1. Configuration
Table 3. Configuration properties
Property Description Default

graphml.report.conceptPattern

Regular expression that describes the concept ids to use for rendering the result as GraphML file.

.*\.graphml$

graphml.report.directory

The directory where the .graphml files will be created

jqassistant/report

graphml.report.yedgraphml

Flag to enable/disable the generation of yEd specific GraphML-Elements for labeling.

true

8.3.1.2. Example

The following concept will return package dependencies (as provided by the concept [dependency:Package]) as GraphML document:

reports.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/analysis/rules/schema/v1.0">

    <concept id="report:PackageDependencies.graphml">
        <requiresConcept refId="dependency:Package" />
        <description>Reports all package dependencies.</description>
        <cypher><![CDATA[
            MATCH
              (p1:Package)-[d:DEPENDS_ON]->(p2:Package)
            RETURN
              p1, d, p2
        ]]></cypher>
    </concept>

</jqa:jqassistant-rules>

The plugin also supports virtual relations, i.e. which are constructed in the return clause of the query. A part of the return clause constructs a JSON-Object with several properties:

role

to identify the type of virtual element (value: relationship)

type

relationship type

startNode

the start node of the relationship

endNode

the end node of the relationship

The following example virtually propagates the dependencies of Java types to the package level without creating a relationship in the store:

reports.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/analysis/rules/schema/v1.0">

    <concept id="report:VirtualPackageDependencies.graphml">
        <description>Reports all package dependencies.</description>
        <cypher><![CDATA[
            MATCH
              (p1:Package)-[:CONTAINS]->(t1:Type),
              (p2:Package)-[:CONTAINS]->(t2:Type),
              (t1)-[:DEPENDS_ON]->(t2)
            RETURN
              p1,
              {
                role: "relationship",
                type: "DEPENDS_ON",
                startNode: p1,
                endNode: p2
              },
              p2
        ]]></cypher>
    </concept>

</jqa:jqassistant-rules>

Virtual nodes will be provided in the same way like virtual relationships. These are the properties to use in the JSON-Object:

role

to identify the type of virtual element (value: node)

properties

node properties

labels

a list of labels for this node

The following example virtually aggregates some data without creating a node in the store:

reports.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/analysis/rules/schema/v1.0">

    <concept id="report:VirtualDataNode.graphml">
        <description>Aggregates data in a virtual node.</description>
        <cypher><![CDATA[
            MATCH
              (m:Method)
            RETURN
              {
                role: "node",
                properties: {totalCyclomaticComplexity : sum(m.cyclomaticComplexity)},
                labels: ["Metrics", "CyclomaticComplexity"]
              }
        ]]></cypher>
    </concept>

</jqa:jqassistant-rules>

To get a better structured GraphML file subgraphs can be generated. With this pattern it is possible to drill down in the graph. These are the properties to use in the JSON object:

role

to identify the type of virtual element (value: graph)

parent

subgraphs must be nested in a parent node

nodes

all nodes that will be included in the subgraph

relationships

a list of relationships for the nodes. The relationships will be drawn if start- and end-node are part of the GraphML file.

The following example creates a virtual subgraph:

reports.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/analysis/rules/schema/v1.0">

    <concept id="report:Subgraph.graphml">
        <description>Creates a Subgraph for a better overview.</description>
        <cypher><![CDATA[
            MATCH
              (t:Class)-[:DECLARES]->(m:Method)
            OPTIONAL MATCH
              (m)-[i:INVOKES]->(:Method)
            RETURN
              {
                role: "graph",
                parent: t,
                nodes: collect(m),
                relationships: collect(i)  (1)
              } as subgraph
        ]]></cypher>
    </concept>

</jqa:jqassistant-rules>
  1. The relationships can be used overall subgraphs

8.4. Java Plugin

Provides scanner for Java elements (e.g. packages, classes, manifest and property files) and rules for common language concepts (e.g. Deprecation), dependencies and metrics.

8.4.1. Artifact Scanner

8.4.1.1. Nodes labled with `:Java:Artifact

A directory or archive containing packages, classes and resources.

Table 4. Properties of :Java:Artifact
Name Description

fqn

Fully qualified name, e.g. java.lang

fileName

The file name of the artifact. `

Table 5. Relations of :Java:Artifact
Name Target label(s) Cardinality Description

CONTAINS

[:File]

0..n

References contained files, e.g. packages, classes or resources

REQUIRES

Nodes labled with :Java:Type

0..n

References a type which is required by a class in this artifact

8.4.1.2. Nodes labled with :Java:Artifact:Directory

A directory representing a Java artifact.

8.4.1.3. Nodes labled with :Java:Artifact:Jar:Archive:Container

A JAR file representing a Java artifact.

8.4.2. Package Scanner

Imports Java packages.

8.4.2.1. Nodes labled with :Java:Package:Container

A Java package, i.e. a directory containing .class files or other directories.

Table 6. Properties of :Java:Package:Container
Name Description

fqn

Fully qualified name, e.g. java.lang

name

The local name, e.g. lang

Table 7. Relations of :Java:Package:Container
Name Target label(s) Cardinality Description

CONTAINS

Nodes labled with :Java:Type

0..n

References a type located in the package

CONTAINS

Nodes labled with :Java:Package:Container

0..n

References a package located in the package

8.4.3. Class Scanner

Imports Java classes, i.e. all scanned files having a .class suffix. Nodes with following labels will be created:

NOTE Some of these labels may be further qualified with other labels, see the description below.

NOTE The full set of information is only available for class files which have actually been scanned. Types which are only referenced (i.e. from external libraries not included in the scan) are represented by :Type nodes with a property fqn and DECLARES relations to their members. These are :Field or :Method labeled nodes which only provide the property signature.

8.4.3.1. Configuration
Table 8. Configuration properties
Property Description Default

java.class.model.Type.DEPENDS_ON.weight

Enables/disables calculation of the weight attribute for DEPENDS_ON relations between types

true

8.4.3.2. Nodes labled with :Java:Type

A Java type. Can be qualified by either :Class, :Interface, :Enum or :Annotation

Table 9. Properties of :Java:Type
Name Description

fqn

Fully qualified name, e.g. java.lang.Object

name

The local name, e.g. Object

sourceFileName

The name of the source file, e.g. Object.java (optional).

visibility

optional, the visibility of the type, can be either public, protected, default or private

abstract

optional, true indicates that the type is abstract, e.g. public abstract class …​

static

optional, true indicates that the type has the static modifier, e.g. private static class …​

final

optional, true indicates that the type is final, e.g. public final class…​

synthetic

optional, true indicates that the type is synthetic, i.e. it has been generated

byteCodeVersion

The byte code version of the class file, e.g. 52 for "Java SE 8"

md5

The MD5 hash sum of the class file.

valid

true if the class file could be scanned successfully.

Table 10. Relations of :Java:Type
Name Target label(s) Cardinality Description

DECLARES

Nodes labled with :Java:Type

0..n

Declares an inner type of the type

DECLARES

:Java:Method

0..n

Declares a method of the type

DECLARES

Nodes labled with :Java:Field

0..n

Declares a field of the type

EXTENDS

Nodes labled with :Java:Type

0..1

References a type this type extends from

IMPLEMENTS

Nodes labled with :Java:Type

0..1

References an "Interface" type this type implements

ANNOTATED_BY

Nodes labled with :Java:Value:Annotation

0..n

References an annotation which is present on the type

DEPENDS_ON

Nodes labled with :Java:Type

0..n

References a type which this type depends on (i.e. every reference to another class)

NOTE Types which are referenced by scanned classes but have not been scanned themselves will only provide the property fqn and the relation DECLARES.

NOTE Inheritance between interfaces (i.e. public interface A extends B { …​ }) is represented using IMPLEMENTS relations, i.e. queries must use (a:Type:Interface)-[:IMPLEMENTS]→(b:Type:Interface) for pattern matching.

Table 11. Properties of :DEPENDS_ON
Name Description

weight

The weight of the dependency, i.e. the count of occurrences of the referenced type

Table 12. Properties of :READS, :WRITES and :INVOKES
Name Description

lineNumber

The line number the referenced field or method is read, written or invoked

8.4.3.3. Nodes labled with :Java:Type:Class

Qualifies a Java type as class.

8.4.3.4. Nodes labled with :Java:Type:Interface

Qualifies a Java type node as interface.

8.4.3.5. Nodes labled with :Java:Type:Enum

Qualifies a Java type as enumeration.

8.4.3.6. Nodes labled with :Java:Type:Annotation

Qualifies a Java type as annotation.

8.4.3.7. Nodes labled with :Java:Field

A field declared in a Java type.

Table 13. Properties of :Java:Field
Name Description

name

The field name, e.g. id

signature

The raw signature of the field, e.g. int id, java.lang.String toString()

visibility

optional, The visibility of the field, can be either public, protected, default or private

static

optional, true indicates that the field has the static modifier, e.g. static int id;

final

optional, true indicates that the field is final, e.g. final int id;

transient

optional, true indicates that the field is transient, e.g. transient int id;

volatile

optional, true indicates that the field is volatile, e.g. volatile int id;

synthetic

optional, true indicates that the field is synthetic, i.e. it has been generated

Table 14. Relations of :Java:Field
Name Target label(s) Cardinality Description

OF_TYPE

Nodes labled with :Java:Type

1

References the type of the field

ANNOTATED_BY

Nodes labled with :Java:Value:Annotation

0..n

References an annotation which is present on the field

HAS

Nodes labled with :Java:Value

0..1

References the primitive value which is used for initialzing the field

NOTE Fields which are referenced by scanned classes but have not been scanned themselves will only provide the property signature.

8.4.3.8. :Java:Method

A method declared in a Java type.

Table 15. Properties of :Java:Method
Name Description

name

The method name, e.g. getId

signature

The raw signature of the method, e.g. int getId(), java.lang.String concat(java.lang.String,java.lang.String)

visibility

optional, The visibility of the method, can be either public, protected, default or private

static

optional, true indicates that the method has the static modifier, e.g. static int getId();

final

optional, true indicates that the method is final, e.g. final int getId();

native

optional, true indicates that the method is native, e.g. native int getId();

synthetic

optional, true indicates that the method is synthetic, i.e. it has been generated

firstLineNumber

The first line number of the method body

lastLineNumber

The last line number of the method body

effectiveLineCount

The count of source code lines containing code

cyclomaticComplexity

The cyclomatic complexity of the method

Table 16. Relations of :Java:Method
Name Target label(s) Cardinality Description

HAS

Nodes labled with :Java:Parameter

0..n

References a parameter of the method

THROWS

Nodes labled with :Java:Type

0..n

References the exception type thrown by the method

RETURNS

Nodes labled with :Java:Type

0..n

References the return type of the method

ANNOTATED_BY

Nodes labled with :Java:Value:Annotation

0..n

References an annotation which is present on the method declaration

READS

Nodes labled with :Java:Field

0..n

References a field which is read by the method

WRITES

Nodes labled with :Java:Field

0..n

References a field which is written by the method

INVOKES

:Java:Method

0..n

References a method which is invoked by the method

DECLARES

Nodes labled with :Java:Variable

0..n

References a variable method which is declared by the method

NOTE Methods which are referenced by scanned classes but have not been scanned themselves will only provide the property signature

8.4.3.9. Nodes labled with :Java:Method:Constructor

Qualifies a method as constructor.

8.4.3.10. Nodes labled with :Java:Parameter

A method parameter.

Table 17. Properties of :Java:Parameter
Name Description

index

The index of the parameter according to the method signature (starting with 0)

Table 18. Properties of :Java:Parameter
Name Target label(s) Cardinality Description

OF_TYPE

Nodes labled with :Java:Type

1

References the type of the parameter

ANNOTATED_BY

Nodes labled with :Java:Value:Annotation

0..n

References an annotation which is present on the parameter

8.4.3.11. Nodes labled with :Java:Variable

A variable declared in a method.

Table 19. Properties of :Java:Variable
Name Description

name

The variable name, e.g. i

signature

The raw signature of the variable, e.g. int i, java.lang.String name

8.4.3.12. Nodes labled with :Java:Value

A value, can be qualified by either :Primitive, :Annotation, :Class, :Enum or :Array.

Table 20. Properties of :Java:Value
Name Description

name

The method name, e.g. value

8.4.3.13. Nodes labled with :Value:Primitive

A primitive value.

Table 21. Properties of :Java:Value:Primitive
Name Description

value

The value

8.4.3.14. Nodes labled with :Java:Value:Annotation

Represents a annotation on a Java element, e.g. @Entity public class …​

Table 22. Relations of :Java:Value:Annotation:
Name Target label(s) Cardinality Description

OF_TYPE

Nodes labled with :Java:Type

1

References the type of the annotation

HAS

Nodes labled with :Java:Value

0..n

References an attribute of the annotation, e.g. @Entity(name="MyEntity")

8.4.3.15. Nodes labled with :Java:Value:Class

Represents a class instance, e.g. as specified by annotation attribute.

Table 23. Relations of `:Java:Value:Class:
Name Target label(s) Cardinality Description

IS

Nodes labled with :Java:Type

1

References the type

8.4.3.16. Nodes labled with :Java:Value:Enum

Represents an enum value.

Table 24. Relations of :Java:Value:Enum:
Name Target label(s) Cardinality Description

IS

Nodes labled with :Java:Field

1

References the field representing the enumeration value

8.4.3.17. Nodes labled with :Java:Value:Array

Represents an array value, i.e. a node referencing value nodes.

Table 25. Relations of :Java:Value:Array:
Name Target label(s) Cardinality Description

CONTAINS

Nodes labled with :Java:Value

0..n

References a value contained in the array

8.4.4. Manifest File Scanner

Imports manifest descriptors from META-INF/MANIFEST.MF files.

8.4.4.1. Nodes labled with :File:Java:Manifest

A MANIFEST.MF file containing sections.

Table 26. Properties of :File:Java:Manifest
Name Description

fileName

The file name

Table 27. Relations of :File:Java:Manifest
Name Target label(s) Cardinality Description

DECLARES

Nodes labled with :Java:ManifestSection

0..n

References a manifest section

8.4.4.2. Nodes labled with :Java:ManifestSection

A manifest section.

Table 28. Relations of :Java:ManifestSection
Name Target label(s) Cardinality Description

HAS

Nodes labled with :Java:Value:ManifestEntry

0..n

References a manifest entry in the section

8.4.4.3. Nodes labled with :Java:Value:ManifestEntry

A manifest entry.

Table 29. Properties of :Java:Value:ManifestEntry
Name Description

name

The name of the entry, e.g. Main-Class

value

The value of the entry, e.g. com.buschmais.jqassistant.scm.cli.Main

8.4.5. Property File Scanner

Imports text-based property files and XML-based property files, i.e. all files having a suffix .properties or .xml with the doctype <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">.

8.4.5.1. Nodes labled with :File:Properties or :File:Properties:Xml

A property file containing key/value pairs. A node with the labels :File:Properties can represent a text based property file (*.properties) or a XML based property file (*.xml).

Table 30. Properties of :File:Java:Properties and :File:Java:Properties:Xml
Name Description

fileName

The file name

Table 31. Relations of :File:Java:Properties and :File:Java:Properties:Xml
Name Target label(s) Cardinality Description

HAS

Nodes labled with :Java:Value:Property

0..n

References a property value

8.4.5.2. Nodes labled with :Java:Value:Property

A key value/pair.

Table 32. Properties of :Java:Value:Property
Name Description

name

The name of the property

value

The value of the property

8.4.6. Service Loader File Scanner

Imports service loader descriptors from META-INF/services directories.

8.4.6.1. Nodes labled with :File:Java:ServiceLoader

A file containing the implementation class names for a service interface

Table 33. Properties of :File:Java:ServiceLoader
Name Description

fileName

The file name

Table 34. Relations of :File:Java:ServiceLoader
Name Target label(s) Cardinality Description

OF_TYPE

Nodes labled with :Java:Type

1

The type representing the service interface

CONTAINS

Nodes labled with :Java:Type

0..n

References a type which implements the service interface

8.4.7. Concepts and Constraints provided by the Java Plugin

8.4.7.1. Concepts provided by the Java plugin

8.4.8. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.5. Java 8 Plugin

Provides Java 8 specific rules, e.g. concepts for functional interfaces and default methods.

8.5.1. Concepts and Constraints provided by the Java 8 Plugin

8.5.1.1. Concepts provided by the Java 8 plugin

8.6. Java EE 6 Plugin

Aggregates plugins providing scanners and rules for Java EE 6 technologies (e.g. JPA2, EJB3).

8.6.1. Scanner for EAR files

Imports EAR (Enterprise ARchive) files.

8.6.1.1. Nodes labled with :File:Enterprise:Application:Archive:Container

A file representing an EAR file.

Table 35. Properties of :File:Enterprise:Application:Archive:Container
Name Description

fileName

The file name

Table 36. Relations of :File:Enterprise:Application:Archive:Container
Name Target label(s) Cardinality Description

CONTAINS

[:File]

0..n

References the files contained in the archive.

8.6.1.2. Nodes labled with :File:Enterprise:Application:Xml

Represents a Java EE application.xml descriptor.

Table 37. Properties of :File:Enterprise:Application:Xml
Name Description

fileName

The file name

initializeInOrder

If initialize-in-order is true, modules must be initialized in the order they’re listed in the deployment descriptor

libraryDirectory

The path to the library directory.

Table 38. Relations of :File:Enterprise:Application:Xml
Name Target label(s) Cardinality Description

HAS_DESCRIPTION

Nodes labled with :Description

0..n

References a description of this descriptor.

HAS_DISPLAY_NAME

Nodes labled with :DisplayName

0..n

References a display name of this descriptor.

HAS_ICON

Nodes labled with :Icon

0..n

References an icon of this descriptor.

HAS_MODULE

Nodes labled with :Enterprise:Application:Module

1..n

References a module specified by this descriptor.

HAS_SECURITY_ROLE

Nodes labled with :SecurityRole

0..n

References a security role defined by this descriptor.

8.6.1.3. Nodes labled with :Enterprise:Application:Module

Represents a declared module of a Java EE Java application. Can be qualified by either :Ejb, :Web, :Connector or :JavaClient.

Table 39. Properties of :Enterprise:Application:Module
Name Description

path

The path to the module archive within the enterprise application archive.

8.6.1.4. Nodes labled with :Enterprise:Application:Module:Web

Represents a declared web module of a Java EE Java application.

Table 40. Properties of :Enterprise:Application:Module:Web
Name Description

contextRoot

The context root path to use for the web module.

8.6.2. Scanner for WAR files

Imports WAR (Web Application Archive) files.

8.6.2.1. Nodes labled with :File:Web:Application:Archive:Container

A file representing WAR file.

Table 41. Properties of :File:Web:Application:Archive:Container
Name Description

fileName

The file name

Table 42. Relations of :File:Web:Application:Archive:Container
Name Target label(s) Cardinality Description

CONTAINS

[:File]

0..n

References the files contained in the archive.

8.6.2.2. Nodes labled with :File:Web:Xml

Represents a web application descriptor.

Table 43. Relations of :File:Web:Xml
Name Target label(s) Cardinality Description

HAS_SESSION_CONFIG

Nodes labled with :SessionConfig

0..1

References the session configuration.

HAS_SERVLET

Nodes labled with :Servlet

0..n

References a servlet declaration.

HAS_SERVLET_MAPPING

ServletMapping

0..n

References a servlet mapping declaration.

HAS_FILTER

Filter

0..n

References a filter declaration.

HAS_FILTER_MAPPING

FilterMapping

0..n

References a filter mapping declaration.

HAS_LISTENER

Listener

0..n

References a listener declaration.

HAS_CONTEXT_PARAM

[.ParamValue]

0..n

References a context parameter declaration.

HAS_ERROR_PAGE

ErrorPage

0..n

References an error page declaration.

HAS_SECURITY_CONSTRAINT

SecurityConstraint

0..n

References a security constraint declaration.

HAS_SECURITY_ROLE

Nodes labled with :SecurityRole

0..n

References a security role declaration.

HAS_LOGIN_CONFIG

LoginConfig

0..n

References a login configuration.

8.6.2.3. Nodes labled with :SessionConfig

Represents a session configuration.

Table 44. Properties of :SessionConfig
Name Description

sessionTimeout

The session timeout.

8.6.2.4. Nodes labled with :Servlet

Represents a servlet declaration.

Table 45. Properties of :Servlet
Name Description

enabled

Indicates if this servlet is enabled.

jspFile

The JSP file representing the servlet.

loadOnStartup

Indicates whether the servlet will be loaded on startup.

Table 46. Relations of :Servlet
Name Target label(s) Cardinality Description

HAS_DESCRIPTION

Nodes labled with :Description

0..n

References a description of this descriptor.

HAS_DISPLAY_NAME

Nodes labled with :DisplayName

0..n

References a display name of this descriptor.

HAS_ICON

Nodes labled with :Icon

0..n

References an icon of this descriptor.

HAS_INIT_PARAM

[:ParamValue]

0..n

References a init parameter.

8.6.3. Scanner for JSF-template files

Imports JSF template files (e.g. *.jspx) and builds references between them (template/includes).

8.6.3.1. Configuration
Table 47. Configuration properties
Property Description Default

facelet.file.pattern

Regular expression that describes scanable JSF template files.

.*\\.jspx

8.6.3.2. Nodes labled with :File:Jsf:Facelet

A JSF template file.

Table 48. Properties of :File:Jsf:Facelet
Name Description

fileName

The file name

Table 49. Relations of :File:Jsf:Facelet
Name Target label(s) Cardinality Description

INCLUDES

[:File:Jsf:Facelet]

0..n

References a included JSF template file (e.g. <ui:include src="include.jspx"/>)

WITH_TEMPLATE

[:File:Jsf:Facelet]

0..1

References a used JSF template file (e.g. <ui:composition template="template.jspx" …​>)

8.6.3.3. Nodes labled with :Description

Represents an internationalized description.

Table 50. Properties of :Description
Name Description

lang

The language, e.g. en

value

The description.

8.6.3.4. Nodes labled with :DisplayName

Represents an internationalized display name.

Table 51. Properties of :DisplayName
Name Description

lang

The language, e.g. en

value

The description.

8.6.3.5. Nodes labled with :Icon

Represents an icon.

Table 52. Properties of :Icon
Name Description

smallIcon

The file name of the small icon, e.g. smallIcon.png.

largeIcon

The file name of the large icon, e.g. largeIcon.png.

8.6.3.6. Nodes labled with :SecurityRole

Represents a security role.

Table 53. Relations of :SecurityRole
Name Target label(s) Cardinality Description

HAS_DESCRIPTION

Nodes labled with :Description

0..n

References a description of this security role.

HAS_ROLE_NAME

Nodes labled with :Description

1

References the role name.

8.6.3.7. Nodes labled with :RoleName

Represents a role name.

Table 54. Properties of :RoleName

Name

Description

name

The name of the role.

8.6.4. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.7. JAX-RS Plugin

Provides rules for JAX-RS.

8.7.1. Concepts and Constraints provided by the JAX-RS Plugin

8.7.1.1. Concepts provided by the JAX-RS plugin

8.8. JPA 2 Plugin

Provides a scanner for persistence.xml descriptors and rules for JPA2 specific elements (e.g. entities).

8.8.1. Scanner for persistence.xml files

Imports persistence descriptors from META-INF/persistence.xml or WEB-INF/persistence.xml files.

8.8.1.1. :File:Jpa:Persistence

A persistence.xml file containing persistence units.

Table 55. Properties of :File:Jpa:Persistence
Name Description

fileName

The file name

version

The version of the JPA specification this descriptor represents, e.g. 2.0

Table 56. Relations of :File:Jpa:Persistence
Name Target label(s) Cardinality Description

CONTAINS

:Jpa:PersistenceUnit

0..n

References a contained persistence unit

8.8.1.2. :Jpa:PersistenceUnit

A persistence unit.

Table 57. Properties of :Jpa:PersistenceUnit
Name Description

description

The description of the persistence unit.

excludeUnlistedClasses

If the persistence unit should only contain listed classes or all entities.

transactionType

The transaction type, can be RESOURCE_LOCAL or JTA

provider

The class name of the JPA provider.

jtaDatasource

The JNDI name of the transactional datasource

nonJtaDatasource

The JNDI name of the non-transactional datasource

validationMode

The validation mode, can be NONE, CALLBACK or AUTO

sharedCacheMode

The shared cache mode, e.g. NONE

Table 58. Relations of :Jpa:PersistenceUnit
Name Target label(s) Cardinality Description

CONTAINS

Nodes labled with :Java:Type

0..n

References a persistent type (entity) contained in the persistence unit

HAS

[:Value:Property]

0..n

References a property of the persistence unit

8.8.2. Concepts and Constraints provided by the JPA 2 Plugin

8.8.2.1. Concepts provided by the JPA 2 plugin

8.8.3. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.9. JSON Plugin

Provides a scanner for JSON files

8.9.1. Scanner for JSON Files

Scanner to scan RFC 7159 compliant JSON files.

8.9.1.1. Configuration
Table 59. Configuration properties
Property Description

json.file.include

A comma separated list of file name patterns, wildcards (?,\*) are allowed, e.g. /data/town.json.tmpl.

json.file.exclude

A comma separated list of file name patterns, wildcards (?,\*) are allowed, e.g. /data/data.json.

8.9.1.2. Nodes labled with :Json:File
Table 60. Properties of :Json:File
Name Description

fileName

The file of the JSON document.

valid

Flag to indicate if the JSON document is valid according to RFC 7159.

Table 61. Relations of :Json:File
Name Target label(s) Cardinality Description

CONTAINS

Nodes labled with :Json:Object, Nodes labled with :Json:Array or Nodes labled with :Json:Scalar

1

References the contained JSON value.

8.9.1.3. Nodes labled with :Json:Array
Table 62. Properties of :Json:Array
Name Description

None

Table 63. Relations of :Json:Array
Name Target label(s) Cardinality Description

CONTAINS_VALUE

Nodes labled with :Json:Object, Nodes labled with :Json:Array or Nodes labled with :Json:Scalar

0..n

References a value contained in the array.

8.9.1.4. Nodes labled with :Json:Key
Table 64. Properties of :Json:Key
Name Description

name

The literal name of the key.

Table 65. Relations of :Json:Key
Name Target label(s) Cardinality Description

HAS_VALUE

Nodes labled with :Json:Object, Nodes labled with :Json:Array or Nodes labled with :Json:Scalar

1

The value associated with the key.

8.9.1.5. Nodes labled with :Json:Object
Table 66. Properties of :Json:Object
Name Description

None

Table 67. Relations of :Json:Object
Name Target label(s) Cardinality Description

HAS_KEY

Nodes labled with :Json:Key

0..n

The key of a key value pair in an JSON object.

8.9.1.6. Nodes labled with :Json:Scalar
Table 68. Properties of :Json:Scalar
Name Description

value

The value itself.

Table 69. Relations of :Json:Scalar
Name Target label(s) Cardinality Description

None

8.9.1.7. Nodes labled with :Json:Value

The label :Value is only a marker label without any own properties or relationships. It marks only an element of an JSON structure as value associated with an other JSON element.

For example:

  • The elements of an JSON array are labeled as Value.

  • The value of an key value pair is labeled as Value.

Table 70. Properties of :Json:Value
Name Description

None

Table 71. Relations of :Json:Value
Name Target label(s) Cardinality Description

None

8.9.1.8. Examples

This section provides some examples how a JSON document is mapped to a graph structure by the JSON plugin of jQAssistant.

8.9.1.8.1. Object with Array Value
An JSON object with a single key with an array as value
{
  "A": [ "B", "C" ]
}
example 01
Figure 1. Graph structure created out of the source document
8.9.1.8.2. Empty JSON Array
An empty JSON array
[
]
example 02
Figure 2. Graph struture created out of the source document
8.9.1.8.3. Object with an empty Object as Value
An JSON object with an empty Object as Value
{
  "A": { }
}
example 03
Figure 3. Graph struture created out of the source document
8.9.1.8.4. JSON Object with Objects as Value
An JSON object objects as value
{
  "A": {
    "B" : "C",
    "D" : { }
  }
}
example 04
Figure 4. Graph struture created out of the source document

8.9.2. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.10. JUnit Plugin

Provides scanner for JUnit test reports and rules (e.g. for test classes/methods and ignored tests).

8.10.1. Scanner for JUnit4 test suite results

Imports results from JUnit 4 and JUnit 5 test suites written by Maven Surefire and Maven Failsave matching the file name TEST-.xml.

8.10.1.1. Nodes labled with :File:Junit:TestSuite

A file containing results of a JUnit 4 or JUnit 5 test suite.

Table 72. Properties of :File:JUnit:TestSuite
Name Description

fileName

The file name

name

The name of the test suite, e.g. the name of the class defining the suite

tests

The number of executed tests

failures

The number of failed tests

errors

The number of tests in error

skipped

The number of skipped tests

time

The time it took to run the suite

Table 73. Relations of :File:JUnit:TestSuite
Name Target label(s) Cardinality Description

CONTAINS

[:JUnit::TestCase]

0..n

References test cases

8.10.1.2. :JUnit:TestCase

A test case.

Table 74. Properties of :JUnit::TestCase
Name Description

name

The name of the test, e.g. the name of the test method

className

The name of the class containing the test

time

The time it took to run the test

result

The result of the test, either SUCCESS, FAILURE, ERROR or SKIPPED

Table 75. Relations of :JUnit:TestCase
Name Target label(s) Cardinality Description

HAS_FAILURE

:JUnit:Failure

0..1

References failure details

HAS_ERROR

:JUnit:Error

0..1

References error details

8.10.1.3. :JUnit:Failure

Provides detail information about a test case with result FAILURE.

Table 76. Properties of :JUnit:Failure
Name Description

type

The failure type, e.g. java.lang.AssertionError

details

Detail information, e.g. the stack trace.

8.10.1.4. :JUnit:Error

Provides detail information about a test case with result ERROR.

Table 77. Properties of :JUnit:Error
Name Description

type

The error type, e.g. "java.lang.RuntimeException"

details

Detail information, e.g. the stack trace.

8.10.2. Concepts and Constraints provided by the JUnit Plugin

8.10.2.1. Concepts provided by the JUnit plugin

8.10.3. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.11. Maven 2 Repository Plugin

Provides a scanner for maven repositories.

8.11.1. Scanner for remote Maven repositories

Downloads the repository index and retrieves all available new artifacts for scanning.

This plugin should be triggered on the command line by providing an URL and a specific scope:

Examples:

>jqassistant.cmd scan -u maven:repository::http://[<user>:<password>@]<repository url>
>jqassistant.cmd scan -u maven:repository::http://foo:bar@example.com/m2repo
Tip
The plugin supports incremental runs on a maven repository. In this case only new artifacts will be downloaded and scanned. Old snapshot artifacts will be handled as predecessors (see below). Note that such predecessor artifacts will have no direct relationship to the :Maven:Repository node.
Tip
For incremental scanning it is necessary that the exactly the same URL is provided on sub-sequent scans.
8.11.1.1. Configuration
Table 78. Configuration properties
Property Description Default

m2repo.directory

A directory path. This directory is the target for Maven indices and artifacts.

./jqassistant/data/m2repo

m2repo.filter.includes

A comma separated list of artifact patterns to include in the scan

include all artifacts

m2repo.filter.excludes

A comma separated list of artifact patterns to exclude from the scan

exclude no artifacts

m2repo.artifacts.scan

A boolean value. If true then the content of the artifacts is scanned.

true

m2repo.artifacts.keep

A boolean value. If true then all downloaded artifacts where deleted after scanning.

false

Tip
The artifact patterns follow the Maven syntax, i.e. [groupId]:[artifactId]:[type]:[version] or [groupId]:[artifactId]:[type]:[classifier]:[version] and allow using wildcards.
8.11.1.2. Nodes labled with :Maven:Repository

A remote Maven repository.

Table 79. Properties of :Maven:Repository
Name Description

url

the remote URL

lastUpdate

timestamp of the last scan

Table 80. Relations of :Maven:Repository
Name Target label(s) Cardinality Description

CONTAINS_POM

[:Maven:Pom:Xml]

0..n

References the POMs in the repository

CONTAINS_ARTIFACT

Nodes labled with :Maven:Artifact

0..n

References the artifacts in the repository

8.11.2. Scanner for remote maven artifacts

Gets the maven artifact coordinates to retrieve the artifact from an repository and scans it. The scanner accepts org.apache.maven.index.ArtifactInfo-Items with the scope maven:repository.

Note
This plugin needs some prerequisites to work properly. The context must contain a MavenRepositoryDescriptor to which the new Maven Artifact belongs and an ArtifactProvider-Object to load the artifact from the configured repository.

8.11.3. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.12. Maven 3 Plugin

Provides a scanner for Maven 3 modules.

8.12.1. Scanner for Maven projects

Imports information from Maven projects.

8.12.1.1. Nodes labled with :Maven:Project:File:Directory

A pom.xml file describing a single Maven project.

Table 81. Properties of :Maven:Project:File:Directory
Name Description

fileName

The directory of the project.

name

The name

groupId

The group id

artifactId

The artifact id

packaging

The packaging type, e.g. jar

version

The version

Table 82. Relations of :Maven:Project:File:Directory
Name Target label(s) Cardinality Description

CREATES

Nodes labled with :Maven:Artifact

0..n

References an artifact created by the project

HAS_MODEL

Nodes labled with :Maven:Pom

1

References the POM model of the project

HAS_EFFECTIVE_MODEL

Nodes labled with :Maven:Pom

1

References the effective POM model of the project

HAS_PARENT

Nodes labled with :Maven:Project:File:Directory

0..1

References the parent project (optional)

HAS_MODULE

Nodes labled with :Maven:Project:File:Directory

0..n

References modules of this project (optional)

8.12.1.2. Nodes labled with :Maven:Artifact

Represents an artifact, e.g. a JAR-File.

Table 83. Properties of :Maven:Artifact
Name Description

group

The group name

name

The artifact name

type

The type, e.g. jar

classifier

The classifier

version

The version

Table 84. Relations of :Maven:Artifact
Name Target label(s) Cardinality Description

CONTAINS

:File

0..n

References a file contained in the artifact

DEPENDS_ON

Nodes labled with :Maven:Artifact

0..n

References an artifact which is a declared dependency

Table 85. Properties of :DEPENDS_ON
Name Description

scope

The declared scope, e.g. compile

optional

true indicates that this dependency is optional.

8.12.2. Scanner for Maven POMs

Imports information from Maven POMs (e.g. pom.xml) files.

8.12.2.1. Nodes labled with :Maven:Pom

A POM describing a Maven project.

Table 86. Properties of :Maven:Pom
Name Description

group

The group id

name

The artifact id

type

The type, e.g. jar

classifier

The classifier (optional)

version

The version

Table 87. Relations of :Maven:Pom
Name Target label(s) Cardinality Description

HAS_PARENT

Nodes labled with :Maven:Pom

0..1

References a parent artifact

HAS_PROPERTY

:Value:Property

0..n

References a property

HAS_PROFILE

Nodes labled with :Maven:Profile

0..n

References defined profiles

USES_LICENSE

Nodes labled with :Maven:License

0..n

References used licenses

MANAGES_DEPENDENCY

Nodes labled with :Maven:Artifact

0..n

References an artifact which is a managed dependency

DECLARES_DEPENDENCY

Nodes labled with :Maven:Artifact

0..n

References an artifact which is a declared dependency

HAS_MODULE

Nodes labled with :Maven:Module

0..n

References a sub module

MANAGES_PLUGIN

Nodes labled with :Maven:Plugin

0..n

References a managed plugin

USES_PLUGIN

Nodes labled with :Maven:Plugin

0..n

References a plugin that is used during maven lifecycle

HAS_CONTRIBUTOR

:Maven:Contributor

0..n

References a contributor

HAS_DEVELOPER

:Maven:Developer

0..n

References a developer

HAS_ORGANIZATION

:Maven:Organization

0..1

References the organization behind the project

HAS_REPOSITORY

Nodes labled with :Maven:Repository

0..1

References a repository declared for this project.

8.12.2.2. :Maven:Contributor

A contributor of the project.

Table 88. Properties of :Maven:Contributor
Name Description

id

The unique ID of the developer in the SCM

email

The email address of the developer.

name

The full name of the developer.

organization

The organization to which the contributor belongs.

organizationUrl

The URL of the organization.

timezone

The timezone the developer is in.

url

The URL for the homepage of the developer.

Table 89. Relations of :Maven:Contributor
Name Target label(s) Cardinality Description

HAS_ROLES

:Maven:Role

0..n

References a role the contributor has in the project.

8.12.2.3. :Maven:Developer

A developer taking part in the development of the project.

Table 90. Properties of :Maven:Developer
Name Description

id

The unique ID of the developer in the SCM

email

The email address of the developer.

name

The full name of the developer.

organization

The organization to which the contributor belongs.

organizationUrl

The URL of the organization.

timezone

The timezone the developer is in.

url

The URL for the homepage of the developer.

Table 91. Relations of :Maven:Developer
Name Target label(s) Cardinality Description

HAS_ROLES

:Maven:Role

0..n

References a role the developer has in the project.

8.12.2.4. :Maven:Organization

The organization behind the project.

Table 92. Properties of :Maven:Organization
Name Description

name

The name of the organization.

url

The URL of the organization.

8.12.2.5. Nodes labled with :Maven:Repository

A Maven repository declared for a Maven POM or a profile in a Maven POM.

Table 93. Properties of :Maven:Repository
Name Description

name

The name of the repository.

layout

The layout of the repository.

releasesEnabled

Flag if this repository is enabled for releases.

releasesChecksumPolicy

The checksum policy to be used for releases provided by this repository.

releasesUpdatePolicy

The update policy to be used for releases provided by this repository.

snapshotsEnabled

Flag if this repository is enabled for snapshots.

snapshotsChecksumPolicy

The checksum policy to be used for snapshots provided by this repository.

snapshotsUpdatePolicy

The update policy to be used for snapshots provided by this repository.

url

The URL of the repository.

8.12.2.6. :Maven:Role

The roles a person plays in the project.

Table 94. Properties of :Maven:Role
Name Description

name

The name of the role a person plays in the project.

8.12.2.7. Nodes labled with :Maven:Profile

A maven profile

Table 95. Properties of :Maven:Profile
Name Description

id

The profile id

Table 96. Relations of :Maven:Profile
Name Target label(s) Cardinality Description

HAS_PROPERTY

:Value:Property

0..n

References a property

MANAGES_DEPENDENCY

Nodes labled with :Maven:Artifact

0..n

References an artifact which is a managed dependency

DECLARES_DEPENDENCY

Nodes labled with :Maven:Artifact

0..n

References an artifact which is a declared dependency

HAS_MODULE

Nodes labled with :Maven:Module

0..n

References a sub module

MANAGES_PLUGIN

Nodes labled with :Maven:Plugin

0..n

References a managed plugin

USES_PLUGIN

Nodes labled with :Maven:Plugin

0..n

References a plugin that is used during maven lifecycle

HAS_ACTIVATION

Nodes labled with :Maven:ProfileActivation

0..1

References the conditions which will trigger the profile.

HAS_REPOSITORY

Nodes labled with :Maven:Repository

0..1

References a repository declared for this profile.

8.12.2.8. Nodes labled with :Maven:ProfileActivation

A maven profile activation

Table 97. Properties of :Maven:ProfileActivation
Name Description

activeByDefault

Specifies if the profile is activated by default

jdk

Specifies jdk needed to activate the profile

Table 98. Relations of :Maven:ProfileActivation
Name Target label(s) Cardinality Description

HAS_PROPERTY

:Value:Property

0..1

References a property

ACTIVATED_BY_FILE

Nodes labled with :Maven:ActivationFile

0..1

References file specification used to activate a profile

ACTIVATED_BY_OS

Nodes labled with :Maven:ActivationOS

0..1

References os specification used to activate a profile

8.12.2.9. Nodes labled with :Maven:ActivationFile

File specification used to activate a profile

Table 99. Properties of :Maven:ActivationFile
Name Description

exists

Specifies the name of the file that should exist to activate a profile

missing

Specifies the name of the file that should be missing to activate a profile

8.12.2.10. Nodes labled with :Maven:ActivationOS

Defines operating system’s attributes to activate a profile

Table 100. Properties of :Maven:ActivationOS
Name Description

arch

Specifies the architecture of the OS to be used to activate a profile

family

Specifies the general family of the OS to be used to activate a profile

name

Specifies the name of the OS to be used to activate a profile

version

Specifies the version of the OS to be used to activate a profile

8.12.2.11. Nodes labled with :Maven:Module

A Maven module

Table 101. Properties of :Maven:Module
Name Description

name

The module name

8.12.2.12. Nodes labled with :Maven:Plugin

A Maven plugin

Table 102. Properties of :Maven:Plugin
Name Description

group

The group id

name

The artifact id

type

The type, e.g. jar

classifier

The classifiert

version

The version

inherited

Whether any configuration should be propagated to child POMs

Table 103. Relations of :Maven:Plugin
Name Target label(s) Cardinality Description

HAS_EXECUTION

Nodes labled with :Maven:PluginExecution

0..n

References a PluginExecution

HAS_CONFIGURATION

Nodes labled with :Maven:Configuration

0..1

References the configuration for the plugin

IS_ARTIFACT

Nodes labled with :Maven:Artifact

1

References Maven artifact representing the Maven plugin

8.12.2.13. Nodes labled with :Maven:License

A used license

Table 104. Properties of :Maven:License
Name Description

name

The full legal name of the license.

url

The official url for the license text.

comments

Addendum information pertaining to this license.

distribution

The primary method by which this project may be distributed.

8.12.2.14. Nodes labled with :Maven:PluginExecution

A plugin execution

Table 105. Properties of :Maven:PluginExecution
Name Description

id

The plugin id

inherited

Whether any configuration should be propagated to child POMs.

phase

The build lifecycle phase to bind the goals in this execution to.

Table 106. Relations of :Maven:PluginExecution
Name Target label(s) Cardinality Description

HAS_GOAL

Nodes labled with :Maven:ExecutionGoal

0..n

The goals to execute with the given configuration

HAS_CONFIGURATION

Nodes labled with :Maven:Configuration

0..1

References the configuration for the plugin

8.12.2.15. Nodes labled with :Maven:Configuration

A configuration for plugins, executions

Table 107. Relations of :Maven:Configuration
Name Target label(s) Cardinality Description

CONTAINS

:Java:Value

0..n

References a value or a list of values

8.12.2.16. Nodes labled with :Maven:ExecutionGoal

A goal for plugin executions

Table 108. Properties of :Maven:ExecutionGoal
Name Description

name

The name of the goal

8.12.3. Concepts and Constraints provided by the Maven 3 Plugin

8.12.3.1. Concepts provided by the Maven 3 plugin

8.12.4. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.13. OSGi Plugin

Provides rules for OSGi bundles (e.g. Bundles, Activator).

8.13.1. Concepts and Constraints provided by the OSGi Plugin

8.13.1.1. Concepts provided by the OSGi plugin

8.14. RDBMS Plugin

Provides a scanner for importing the metadata of a relational database schema.

8.14.1. Scanner for metadata of a relational database schema

Imports the metadata of a relational database schema, i.e. schemas, tables and columns.

NOTE The JDBC driver must be available on the jQAssistant classpath, e.g. as dependency of the Maven plugin or copied to the plugins/ folder of the distribution.

8.14.1.1. Connection URI scanner

The connection information may be specified as URI using scope rdbms:connection, e.g. on the command line

jqassistant.sh scan -u rdbms:connection::jdbc:oracle:thin:username/password@host:1521:sid
8.14.1.2. Connection property file scanner

The connection properties can also be read from property files having a file name with prefix rdbms, e.g. rdbms_test.properties. Each of them must contain at least the properties driver, url, user and password, e.g.

rdbms_test.properties
## Required configuration properties
driver=org.hsqldb.jdbc.JDBCDriver
url=jdbc:hsqldb:file:target/myDatabase
user=SA
password=

## Optional properties which are passed to Schema Crawler (http://schemacrawler.sourceforge.net/), they affect the level of queried information.

## The name of the database specific driver provided by schema crawler, supported values are "sybaseiq", "sqlserver", "sqlite", "postgresql", "oracle", "mysql", "hsqldb", "derby", "db2"
# bundled_driver=mysql

## It may be necessary to use another info level for performance or compatibility reasons, e.g. if a database does not support retrieving metadata for stored
## procedures you might try to set "retrieve_routines=false". Allowed values are "standard", "minimum", "maximum" or "detailed"
# info_level=standard

## Activation/deactivation of single options on the selected info level
# retrieve_additional_column_attributes=true
# retrieve_additional_database_info=true
# retrieve_additional_jdbc_driver_info=true
# retrieve_additional_table_attributes=true
# retrieve_foreign_keys=true
# retrieve_indices=true
# retrieve_index_information=true
# retrieve_routines=true
# retrieve_routine_columns=true
# retrieve_routine_information=true
# retrieve_schema_crawler_info=true
# retrieve_sequence_information=true
# retrieve_tables=true
# retrieve_table_columns=true
# retrieve_trigger_information=true
# retrieve_view_information=true
8.14.1.3. Nodes labled with :Rdbms:Connection:Properties

Represents a file containing the connection properties described above which have been used to read the schema metadata. It provides the same properties and relations as [:File:Properties].

Table 109. Relations of :Rdbms:Connection:Properties
Name Target label(s) Cardinality Description

DESCRIBES_SCHEMA

Nodes labled with :Rdbms:Schema

1

References the schema

8.14.1.4. Nodes labled with :Rdbms:Schema

Describes a database schema.

Table 110. Properties of :Rdbms:Schema
Name Description

name

The name of the schema.

Table 111. Relations of :Rdbms:Schema
Name Target label(s) Cardinality Description

HAS_TABLE

Nodes labled with :Rdbms:Table

0..n

References the tables in the schema

HAS_VIEW

Nodes labled with :Rdbms:View

0..n

References the views in the schema

HAS_SEQUENCE

Nodes labled with :Rdbms:Sequence

0..n

References the sequences in the schema

8.14.1.5. Nodes labled with :Rdbms:Table

Describes a database table.

Table 112. Properties of :Rdbms:Table
Name Description

name

The name of the table.

Table 113. Relations of :Rdbms:Table
Name Target label(s) Cardinality Description

HAS_COLUMN

Nodes labled with `:Rdbms:Column

0..n

References the columns of the table

HAS_PRIMARY_KEY

Nodes labled with :Rdbms:PrimaryKey

0..1

References the primary key of the table

HAS_INDEX

Nodes labled with :Rdbms:Index

0..*

References indices defined for the table

8.14.1.6. Nodes labled with :Rdbms:View

Describes a database view.

Table 114. Properties of .Rdbms:View
Name Description

name

The name of the view.

Table 115. Relations of :Rdbms:View
Name Target label(s) Cardinality Description

HAS_COLUMN

Nodes labled with `:Rdbms:Column

0..n

References the columns of the view

8.14.1.7. Nodes labled with `:Rdbms:Column

Describes a column of a table.

Table 116. Properties of :Rdbms:Column
Name Description

name

The name of the column

autoIncremented

Indicates an auto incremented value

generated

Indicates a generated value

defaultValue

The default value

size

The size of the column

decimalDigits

The number of digits for decimal types

partOfIndex

Indicates that the column is part of an index

partOfPrimaryKey

Indicates that the column is part of the primary key

partOfForeignKey

Indicates that the column is part of a foreign key

Table 117. Relations of :Rdbms:Column
Name Target label(s) Cardinality Description

OF_COLUMN_TYPE

Nodes labled with :Rdbms:ColumnType

1

References the column type

8.14.1.8. Nodes labled with :Rdbms:ColumnType

Describes a column data type, e.g. VARCHAR.

Table 118. Properties of :Rdbms:ColumnType
Name Description

databaseType

The database specific name of the type

autoIncrementable

Indicates that values of this type can auto incremented

precision

The precision

minimumScale

The minimum scale

maximumScale

The maximum scale

fixedPrecisionScale

The fixed precision scale

numericPrecisionRadix

The numeric precision radix

caseSensitive

Indicates that the type is case sensitive

unsigned

Indicates that the type is unsigned

userDefined

Indicates that the type is user defined

8.14.1.9. Nodes labled with :Rdbms:PrimaryKey

Describes a primary key of a table.

Table 119. Properties of :Rdbms:PrimaryKey
Name Description

name

The name of the primary key.

Table 120. Relations of :Rdbms:PrimaryKey
Name Target label(s) Cardinality Description

ON_PRIMARY_KEY_COLUMN

Nodes labled with :Rdbms:ColumnType

1

References a primary key column

8.14.1.10. ON_PRIMARY_KEY_COLUMN

Describes the properties of a column in a primary key.

Table 121. Properties of ON_PRIMARY_KEY_COLUMN
Name Description

indexOrdinalPosition

The ordinal position of the column in the primary key.

sortSequence

The sort sequence, i.e. "ascending" or "descending".

8.14.1.11. Nodes labled with :Rdbms:Index

Describes an index defined for table.

Table 122. Properties of :Rdbms:Index
Name Description

name

The name of the index.

unique

true if the index is unique.

cardinality

The cardinality of the index.

indexType

The index type.

pages

The pages.

Table 123. Relations of :Rdbms:Index
Name Target label(s) Cardinality Description

ON_INDEX_COLUMN

Nodes labled with :Rdbms:ColumnType

1

References an indexed column

8.14.1.12. ON_INDEX_COLUMN

Describes the properties of a column used by an index.

Table 124. Properties of ON_INDEX_COLUMN
Name Description

indexOrdinalPosition

The ordinal position of the column in the primary key.

sortSequence

The sort sequence, i.e. ascending or descending.

8.14.1.13. Nodes labled with `:Rdbms:ForeignKey

Describes a foreign key.

Table 125. Properties of :Rdbms:ForeignKey
Name Description

name

The name of the foreign key

deferrability

The deferrability

deleteRule

The delete rule, e.g. cascade

updateRule

The update rule

Table 126. Relations of :Rdbms:ForeignKey
Name Target label(s) Cardinality Description

HAS_FOREIGN_KEY_REFERENCE

Nodes labled with :Rdbms:ForeignKeyReference

1..n

The foreign key references

8.14.1.14. Nodes labled with :Rdbms:ForeignKeyReference

Describes a foreign key reference, i.e. a pair consisting of a foreign key referencing a primary key.

Table 127. Relations of :Rdbms:ForeignKeyReference
Name Target label(s) Cardinality Description

FROM_FOREIGN_KEY_COLUMN

Nodes labled with `:Rdbms:Column

1

The foreign key column

TO_PRIMARY_KEY_COLUMN

Nodes labled with `:Rdbms:Column

1

The primary key column

8.14.1.15. Nodes labled with :Rdbms:Sequence

Describes a database sequence.

Table 128. Properties of :Rdbms:Sequence
Name Description

name

The name of the sequence

minimumValue

The minimum value

maximumValue

The maximum value

increment

The increment

cycle

Indicates that the sequence restarts at the minimumValue if the the maximumValue has been reached.

8.14.2. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.15. Spring Plugin

Provides rules for applications using the Spring framework.

8.15.1. Concepts and Constraints provided by the Spring Plugin

8.15.1.1. Concepts provided by the Spring plugin

8.16. TestNG Plugin

Provides rules for TestNG.

8.16.1. Concepts and Constraints provided by the TestNG Plugin

8.16.1.1. Concepts provided by the TestNG plugin

8.17. Tycho Plugin

Provides a scanner for tycho modules.

8.17.1. Scanner for Tycho projects

Adds Tycho specific resources to be scanned to the file system scanner.

8.18. XML Plugin

Provides scanners for XML and XSD documents.

8.18.1. Scanner for XML files

Imports all XML in a generic representation, e.g. namespaces, elements, attributes and text, using the Scanner for XML sources. The files to scan may be configured using include and exclude filters.

8.18.1.1. Configuration
Table 129. Configuration properties
Property Description Default

xml.file.include

A comma separated list of file name patterns, wildcards (?,*) are allowed, e.g. /*-INF/ejb-jar.xml.

xml.file.exclude

A comma separated list of file name patterns, wildcards (?,*) are allowed, e.g. /*-INF/ejb-jar.xml.

8.18.2. Scanner for XML sources

Imports all XML documents in a generic representation, e.g. namespaces, elements, attributes and text.

This plugin is internally used by other plugins (e.g. Scanner for XML files) to create an alternative native structure of XML documents.

8.18.2.1. :Xml:Document

Represents an XML document.

Table 130. Properties of :Xml:Document
Name Description

xmlVersion

The XML version

standalone

The "standalone" attribute of the XML declaration.

characterEncodingScheme

The encoding of the XML file.

xmlWellFormed

Indicates if the document is well-formed, i.e. could be parsed.

Table 131. Relations of :Xml:Document
Name Target label(s) Cardinality Description

HAS_ROOT_ELEMENT

:Xml:Element

1

References the root element of the document.

8.18.2.2. :Xml:Element

An XML element.

Table 132. Relations of :Xml:Element
Name Target label(s) Cardinality Description

DECLARES_NAMESPACE

:Xml:Namespace

0..n

References namespaces which are declared on the element.

OF_NAMESPACE

:Xml:Namespace

0..1

References the namespace of the element.

HAS_ELEMENT

:Xml:Element

0..n

References child elements of the element.

HAS_ATTRIBUTE

:Xml:Attribute

0..n

References attributes of the element.

HAS_TEXT

:Xml:Text

0..n

References the text values of the element.

8.18.2.3. :Xml:Namespace

A XML namespace declaration.

Table 133. Properties of :Xml:Namespace
Name Description

uri

The namespace URI.

prefix

The optional namespace prefix

8.18.2.4. :Xml:Attribute

An XML attribute.

Table 134. Properties of :Xml:Attribute
Name Description

name

The name of the atribute.

value

The value of the attribute.

Table 135. Relations of :Xml:Attribute
Name Target label(s) Cardinality Description

OF_NAMESPACE

:Xml:Namespace

0..1

References the namespace of the attribute.

8.18.2.5. :Xml:Text

A text value of an XML element.

Table 136. Properties of :Xml:Element
Name Description

value

The text value.

8.18.3. Generic scanner for XSD files

Imports all files with the file name suffix ".xsd" using the Scanner for XML files.

8.18.4. Model of the Plugin

Refer to the plugin Javadoc for details about the model.

8.19. YAML Plugin

Provides a scanner for YAML files

8.19.1. Generic scanner for YAML files

Imports YAML 1.1 files in a generic representation for jQAssistant.

Seen from a more formal perspective a YAML document is build by a tree of nodes. Each node can have one of the following values as content: scalar value, sequence or mapping. This plugin imports a YAML file in a simplified manner as simply model of keys and values. See section Examples for examples.

Important
This YAML scanner does not support the full YAML 1.1 specification as is is intended to help to scan and validate YAML configuration files with the help of a simple graph model. If you need an better support for YAML files, please report a feature request.
8.19.1.1. Activation of the plugin

The YAML scanner is not activated by default for the jQAssistant Plugin for Maven, but for the commandline tool for jQAssistant. To activated for the jQAssistant for Maven it must be added to the list of dependencies as shown below.

<plugin>
    <groupId>com.buschmais.jqassistant.scm</groupId>
    <artifactId>jqassistant-maven-plugin</artifactId>
    <version>{projectVersion}</version>
    <dependencies>
        <dependency>
            <groupId>com.buschmais.jqassistant.plugin</groupId>
            <artifactId>jqassistant.plugin.yaml</artifactId>
            <version{projectVersion}</version>
        </dependency>
    </dependencies>
</plugin>
8.19.1.2. Nodes labled with :File:YAML

A file with the file extension .yaml containing zero or more YAML documents.

Table 137. Relations of :File:Xml
Name Target label(s) Cardinality Description

CONTAINS_DOCUMENT

:Document:YAML

0..n

References a document in the file

Table 138. Properties of :File:YAML
Name Description

valid

Property to indicate if the documents of this file have been parsed successfully or not. If the YAML scanner was able to parse all documents, this property is true. Otherwise it is false. This property can be used to check if all of your YAML files could have been parsed or not.

An non-parsable file with YAML documents will not have any outgoing relationships to any dependent YAML documents. Please consider this aspect when writing your queries.

8.19.1.3. :Document:YAML
Table 139. Relations of :Document:YAML
Name Target label(s) Cardinality Description

CONTAINS_VALUE

Nodes labled with :Key:YAML

0..n

References a key in the containing document

CONTAINS_KEY

Nodes labled with :Value:YAML

0..n

References a value in the containing document

8.19.1.4. Nodes labled with :Key:YAML
Table 140. Properties of :Key:YAML
Name Description

name

The name of the key

fqn

The full qualified name of the key. It is build by joining all parent keys and the name of the current key with a dot as delimiter

Table 141. Relations of :Key:YAML

Name

Target label(s)

Cardinality

Description

CONTAINS_KEY

Nodes labled with :Key:YAML

0..n

References a child key of the containing key

CONTAINS_VALUE

Nodes labled with :Value:YAML

0..n

References a value assigned to the key

8.19.1.5. Nodes labled with :Value:YAML

Nodes tagged with :Value:YAML represents YAML scalars assigned to a Nodes labled with :Key:YAML.

Table 142. Properties of :Value:YAML

Name

Description

value

The value itself.

Table 143. Relations of :Value:YAML

Name

Target label(s)

Cardinality

Description

CONTAINS_VALUE

Nodes labled with :Value:YAML

0..n

References a child value assigned to this value

8.19.1.6. Examples

Not written yet.

8.19.2. Model of the Plugin

Refer to the plugin Javadoc for details about the model.