|
Packaging Hawk rulebase files into a Monitoring Archive using Ant |
|
Facts -
Tibco
|
|
Sunday, 04 December 2011 12:35 |
|
This note has been tested with Ant 1.8, Groovy 1.8 and Tibco Hawk 4.8.
The following ant code creates a monitoring archive based on two Hawk rulebases. For example each hawk rulebase can monitor a BusinessWorks engine part of a fault tolerant set up.
<path id="hawkMarToolLibraries">
<pathelement location="${tibco.hawk.dir}/lib/mar.jar"/>
<pathelement location="${tibco.hawk.dir}/lib/util.jar"/>
<pathelement location="${tibco.hawk.dir}/lib/talon.jar"/>
<pathelement location="${tibco.hawk.dir}/lib/config.jar"/>
<pathelement location="${tibco.hawk.dir}/lib/console.jar"/>
<pathelement location="${tibco.tra.dir}/lib/Deployment.jar"/>
<pathelement location="${tibco.tra.dir}/lib/TIBCOxml.jar"/>
<pathelement location="${tibco.tra.dir}/lib/TIBCOrt.jar"/>
<pathelement location="${tibco.tpcl.dir}/lib/xercesImpl.jar"/>
<pathelement location="${tibco.hawk.dir}/lib/crimson.jar"/>
<pathelement location="${tibco.rv.dir}/lib/tibrvj.jar"/>
</path>
<target name="packageRulebaseFiles">
<mkdir dir="dist/HRB"/>
<copy file="build/file1.hrb" tofile="dist/HRB/${packageName}1.hrb"/>
<copy file="build/file2.hrb" tofile="dist/HRB/${packageName}2.hrb"/>
<groovy>
ant.java(
classname:'com.tibco.hawk.mar.tool.Launcher',
classpathref:'hawkMarToolLibraries',
failonerror:true,
newenvironment:true,
fork:true
)
{
sysproperty(key:'PATH', path:properties.get('tibco.rv.dir') +'/bin:' +properties.get('tibco.hawk.dir') +'/bin')
arg(value:'cvdf')
arg(value:properties.get('packageName'))
arg(file:'dist/' +properties.get('packageName') +'.mar')
arg(file:'dist/HRB/' +properties.get('packageName') +'*.hrb')
}
</groovy>
</target>
Note the use of file name expansion inside the file attribute of the last arg tag of the java task. This is useful when packaging many rulebase files into a single Monitoring Archive (MAR file), since the java code accepts a maximum of 7 arguments. Also note the classpathref attribute and the definition of the system properties pointing to the Rendezvous and Hawk bin directories with the sysproperty tag.
Of course the ant code above can be executed by calling ant from the command line. But it is much easier to set up a build system such as Jenkins and then call the script from its web front-end with just a single click.
|