jQAssistant 1.0.0-RC1 released

jQAssistant 1.0.0-RC1 released

Keine Kommentare zu jQAssistant 1.0.0-RC1 released

A release candidate of jQAssistant is now available – and it brings lots of new and interesting features!

Try them and provide feedback!

Scanners for Java application archives

The Java EE 6 plugin now provides plugins for scanning application containers like WAR or EAR files:

jqassistant.sh scan -f my-library.jar
jqassistant.sh scan -f my-web-app.war
jqassistant.sh scan -f my-enterprise-app.ear

This allows artifact related queries, e.g.

MATCH
  (war:Web:Application)-[:CONTAINS]->(artifact:Artifact)
RETURN
  war.fileName, collect(artifact.fqn)
MATCH
  (war:Web:Application)-[:CONTAINS]->(:Web:Xml)-[:HAS_SESSION_CONFIG]->(config)
RETURN
  war.fileName, config.sessionTimeout
MATCH
  (ear:Enterprise:Application)-[:CONTAINS]->(:Application:Xml)-[:HAS_MODULE]->(module:Module)
RETURN
  ear.fileName, collect(module.path)

Improved Java classes scanner

It is now possible to find out which Java types are required by files representing an artifact (e.g. JAR files):

MATCH
  (artifact:Artifact)-[:REQUIRES]->(requiredType:Type)
RETURN
  artifact.fqn, collect(requiredType.fqn)

The scanner now also adds a DEPENDS_ON relation between Java types, e.g. for analyis of allowed/forbidden dependencies or for creating metrics:

MATCH
  (type:Type)-[:DEPENDS_ON]->(otherType:Type)
RETURN
  type.fqn, count(type) as Dependencies
ORDER BY
  Dependencies desc

Scanner for pom.xml files

The Maven plugin has been extended to allow access to the model of a pom.xml file which is either part of a Maven project or an already packaged artifact (e.g. JAR file):

MATCH
  (pom:Pom:Xml)-[:MANAGES_DEPENDENCY]->(dependency:Artifact)
RETURN
  pom.fqn, collect(dependency.fqn)

Maven Repository Plugin

There is another new plugin providing a scanner which allows analyis of Maven 2 repositories that are accessible via HTTP and provide an index (e.g. Nexus or Artifactory):

jqassistant.sh scan -u maven:repository::http://my-repository-host/releases

Note that this command will fetch and scan the whole content of the repository which may cause lots of traffic if it represents a proxy or cache for other repositories (e.g. Maven central).

RDBMS plugin

This new plugin comes with a scanner that accepts property files following the name pattern „jqassistant.plugin.rdbms_*.properties“. It is assumed that these files contain JDBC connection data for relational databases:

jqassistant.plugin.rdbms_MyDB.properties

## Required configuration properties
driver=org.hsqldb.jdbc.JDBCDriver
url=jdbc:hsqldb:file:target/myDatabase
user=SA
password=
jqassistant.sh scan -f jqassistant.plugin.rdbms_MyDB.properties

The scanner will use this information to retrieve the available metadata, e.g. schemas, tables, columns, primary and foreign key, indices, stored procedures, etc.:

MATCH
  (schema:Schema)-[:HAS_TABLE]->(table:Table)
RETURN
  schema.name, collect(table.name)

Self-documenting rules

Concepts and constraints can now be written using AsciiDoc:

jqassistant/my-rules.adoc

= Rules

== Backend

The backend is based on services which are available to the UI and REST layers. A service class is identifed by the annotation @Service. 

[[my-rules:MyConcept]]
.Label all classes annotated with @Service as "Service". 
[source,cypher,role=concept]
----
MATCH
  (type:Type)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(serviceType:Type)
WHERE
  serviceType.fqn="org.jqassistant.demo.Service"
SET
  type:Service
RETURN
  type as Service 
----

These documents are accepted by jQAssistant and can also be rendered to HTML – rules are documentation and documentation are rules.

Express rules using script languages

So far only Cypher queries could be used to write concepts for enriching the scanned data or constraints for detecting violations. It is now possible to traverse the graph using script languages like JRuby, Groovy or JavaScript:

<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");
        ...
        var typeIterator = store.executeQuery("match (t:Type:Class) return t").iterator();
        ...
        // Return the result
        new com.buschmais.jqassistant.core.analysis.api.Result(rule, severity, columnNames, rows);
    </script>
</constraint>

The documentation provides a detailed example.

Release Notes

There is even more! For a full list of changes refer to the release notes, the documentation provides usage information.

Distribution

jQAssistant is available as a downloadable distribution or as Maven plugin:

<dependency>
    <groupId>com.buschmais.jqassistant.scm</groupId>
    <artifactId>jqassistant-maven-plugin</artifactId>
    <version>1.0.0-RC1</version>
</dependency>

The Get Started page provides information for doing first steps in scanning an application or running an analysis.

Feedback

An important feature is missing? The documentation lacks relevant information? There is a bug preventing scans or analysis? An interesting use case needs to be discussed?

Help us to improve jQAssistant!

There are several channels to provide feedback: a discussion group, a gitter channel, the issue tracker, e-mail or just leave a comment below.

About the author:

@dirkmahler

Leave a comment

Back to Top