Reference‎ > ‎The recompute utility‎ > ‎

Running Recompute from Ant

The Recompute utility integrates into Ant as a task. To use it, you'll first need to define a task as follows:

<taskdef name="ablrecompute" classname="com.autobizlogic.recompute.AntTask">
          <!-- ABL software -->
<pathelement path=".../ABL/autobizlogic-2.0a.jar" />
<pathelement path=".../ABL/ablrecompute-2.0a.jar" />
          <!-- Required libraries -->
<pathelement path=".../apache-ant-1.8.2/lib/ant.jar" />
<fileset dir=".../hibernate-distribution-3.6.8.Final">
<include name="hibernate3.jar"/>
<include name="lib/required/*.jar"/>
<include name="lib/jpa/*.jar"/>
<pathelement path=".../slf4j-1.6.4/slf4j-log4j12-1.6.4.jar" />
<pathelement path=".../apache-log4j-1.2.16/log4j-1.2.16.jar" />
<pathelement path=".../groovy-1.8.4/embeddable/groovy-all-1.8.4.jar" />
<pathelement path=".../commons-logging-1.1.1/commons-logging-1.1.1.jar" />
<pathelement path=".../commons-beanutils-1.8.3/commons-beanutils-1.8.3.jar" />
<pathelement path=".../commons-jexl-2.1/commons-jexl-2.1.jar" />
          <!-- JDBC driver -->
<pathelement path=".../hsqldb-2.2.5/lib/hsqldb.jar" />
          <!-- Pojo's and logic classes -->
<pathelement path=".../BusLogicIntro/bin" />

Notice the class path, which will of course need to be adapted to your particular environment.

You can then use this task in your Ant scripts as follows:

If you have a config file, you can simply reference it:
<target name="runWithConfig">
<ablrecompute configFile=".../" />

The config file format is documented in the command line page.

If you prefer to specify all the information directly in your Ant script, you can do something like this:

<target name="scanWithParams">
  <logicPackage packageName="" />
  <logicPackage packageName="buslogicintro.businesslogic.orderentry" />
     <entityToCheck name="buslogicintro.businesslogic.orderentry.Customer" />
  <entityToSkip name="buslogicintro.businesslogic.orderentry.Product" />
  qualification="balance > 0" />

The parameters are defined as follows:

 Name Required Description
 action No, default is scan What the Recompute facility should do:
  • scan simply scans the database to look for errors, and generates a report.
  • plan scans the database and creates a plan showing what HQL statements would need to be run to correct the problems (if any). It does not change any data in the database.
  • fix actually fixes all possibles errors.
 hibernateConfigFile Yes The location of the Hibernate configuration file
 databaseUrl Yes The URL to the database to be 
 outputFormatter No, default is xml

 The fully qualified class name of an implementation of com.autobizlogic.recompute.format.ReportFormatterCan also be xml or sql to use one of the standard formatters.

outputFileName No, default is The name of the file to which the report will be written. The following expressions will be expanded:
  • %Y : current year (4 digits)
  • %M : current month (2 digits)
  • %D : current day of the month (2 digits)
  • %h : current hour (2 digits, 00-23)
  • %m : current minute (2 digits, 00-59)
  • %s : current second (2 digits, 00-59)
 recomputeListener No The full class name of a class implementing the com.autobizlogic.recompute.RecomputeListener interface. This class should have a default constructor (no parameters).

Nested elements

In the ablrecompute (or whatever you call it) task, you can use any number of the following:

<logicPackage packageName="" />

Specifies a package containing logic classes. If all your logic classes are not in the same package, you must specify all the packages.

<entityToCheck name="buslogicintro.businesslogic.orderentry.Customer" />

Specifically adds the given entity to the list of entities to check. Note that if you use this element, only the specified entities will be checked (as opposed to the default behavior, which is to check all entities that have business logic). If you want to be even more precise, you can specify a single attribute to be recomputed using the notation com.acme.Customer:balance

<entityToSkip name="buslogicintro.businesslogic.orderentry.Product" />

Specifically removes the given entity from the list of entities to check.

<entityQualification entityName="buslogicintro.businesslogic.orderentry.Customer" qualification="balance > 0" />

Specifies a qualification for a given entity. Only the rows that satisfy this qualification will be checked.