The JBoss JCA container features a validator which checks resource adapter archives against the Java Connector Architecture (JCA) specification.
The validator is doing a static analysis of the resource adapter classes and checks them against the rules defined in the validator.
The validator is used in the deployer chain of the JCA container, and is available as a standalone tool and an Apache Ant too.
The validator works by scanning the resource adapter in question and output a report which lists which rules have been violated.
An example could be
Severity: ERROR Section: 19.4.2 Description: A ResourceAdapter must implement a "public int hashCode()" method. Code: com.mycompany.myproject.ResourceAdapterImpl Severity: ERROR Section: 19.4.2 Description: A ResourceAdapter must implement a "public boolean equals(Object)" method. Code: com.mycompany.myproject.ResourceAdapterImpl
which means that com.mycompany.myproject.ResourceAdapterImpl is missing an equals and hashCode implementation.
Table 8.1. Validator report
Key | Desciption |
---|---|
Severity |
Specifies the severity of the rule.
|
Section | A reference to a section in the Java Connector Architecture specification where the requirement is defined. |
Descrption | A short description of the rule. |
Code | The class which triggered the rule. |
The validator can be run on the command line by
java -jar jboss-jca-validator.jar <file>
The reports will be generated into the current directory under the name of <file>.log.
The validator integrates with Apache Ant such that you can generate the reports directly from your build environment before deploying the resoruce adapter into the JBoss JCA container.
First you have to define the taskdef for the task
<taskdef name="validator" classname="org.jboss.jca.validator.ant.ValidatorTask" classpathref="jbossjca.lib.path.id"/>
See the Apache Ant documentation for additional instructions on installation.