www.ironjacamar.orgCommunity Documentation

Chapter 7. Validator

Table of Contents

7.1. Introduction
7.2. Reports
7.3. Running the standalone validator
7.4. Apache Ant integration
7.4.1. Usage
7.5. Apache Maven integration
7.5.1. Usage

The IronJacamar 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, as an Apache Ant task and as a Apache Maven plugin 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.


The validator can be run on the command line by

cd doc/validator
./validator.sh <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 IronJacamar container.

First you have to define the taskdef for the task

<taskdef name="validator"
         classname="org.jboss.jca.validator.ant.ValidatorTask"
         classpathref="ironjacamar.lib.path.id"/>
      

See the Apache Ant documentation for additional instructions on installation.

The validator integrates with Apache Maven such that you can generate the reports directly from your build environment before deploying the resoruce adapter into the IronJacamar container.

To be able to use the validator plugin in your Maven project, you will have to add the following plugin declaration in the pom.xml of your project:




<build>
  <plugins>
    <plugin>
      <groupId>org.jboss.ironjacamar</groupId>
      <artifactId>ironjacamar-validator-maven</artifactId>
      <!-- The version of the plugin you want to use -->
      <version>1.2.0.Final</version>
      <executions>
        <execution>
          <goals>
            <goal>validate</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <!-- output directory-->
        <outputDir>.</outputDir>
        
        <!-- rar filename -->
        <rarFile>/path/to/myresourceadapter.rar</rarFile>
        
        <!--  optional classpath 
        <classpath>
          <param>classpath1</param>
          <param>classpath2</param>
        </classpath>
        -->
      </configuration>
    </plugin>
  </plugins>
</build>        

        

See the Apache Maven documentation for additional instructions on installation.