Tryllian Ant Tasks

Reference Documentation

Abstract

The ADK comes bundled with several custom Ant tasks. This document describes how these tasks can be used.


Introduction

Ant is a Java-based build tool, which is extensively used by Tryllian for in-house development. To ease this development, we have created a number of tasks which everyone can use in this project.

Ant can be obtained from the Apache Foundation. The tasks were tested against Ant version 1.4.1.

To use these ant tasks, add the following lines to your build script:


<taskdef name="dna"
         classname="com.tryllian.tools.DNAComposerAntTask"/>
<taskdef name="habitat"
         classname="com.tryllian.tools.HabitatAntTask"/>


    

Make sure that the file trylliant.jar is on your CLASSPATH prior to building agents. In addition, be sure to set the ANT environment variable, especially when using the agent-template, kickstart and scenarios uses the ANT tool. The ANT tool is found in the directory calledant within the ADK installation directory. If you want your projects to refer to another location when referencing the ANT directory, you must reset the ANT_HOME environment variable to this new location. This is similar to resetting the ADK_ROOT, as described in the previous section.

Table of Contents

Dna - Use the dnacomposer
Habitat - Start a habitat

Dna — Use the dnacomposer

Description

Invokes the dnacomposer to create an agent DNA file.

The signing options and the agent descriptor are specified as attributes. The files that should be added to the dna file are specified as nested content tags.

Parameters

AttributeDescriptionRequired
dnaThe DNA file that should be created.yes
agentdescriptorThe agentdescriptor describing the lay-out of the agent.yes
keystoreThe keystore where the certificate is stored.yes
aliasThe alias of the keystore specified with the keystore attribute. yes
storepassThe password of the certificate in keystore specified by the alias alias. yes
checkdependenciesIf set to true, the DNA file will only be generated if it did not exist or at least one file has changed. no

Examples

The following examples creates a DNA file called my_agent.dna.

        
<dna    dna="my_agent.dna"
        agentdescriptor="my_agent.xml"
        keystore="keystore.dat"
        alias="my_alias"
        storepass="*****"
        checkdependencies="false">
    <content name="agent.jar"
             file="jarfiles/agent.jar"
             target="normal"/>
    <content name="datamodel.jar"
             file="../mydata.jar"
             target="normal"/>
</dna>
        
      

The following example does the same as the previous example, but it is less verbose.

        
<dna    dna="my_agent.dna"
        agentdescriptor="my_agent.xml"
        keystore="keystore.dat"
        alias="my_alias"
        storepass="*****"
        checkdependencies="false">
    <content file="jarfiles/agent.jar"/>
    <content name="datamodel.jar"
             file="../mydata.jar"/>
</dna>

      

Habitat — Start a habitat

Description

Start a habitat as if you were calling the habitat script. This task has exactly the same functionality as the shell script.

The task requires the ADK directory to be set. Command-line arguments and JVM arguments can be added as nested elements as if this were the Java ant task.

The Habitat is run as if it were started from the ADK_ROOT (just like the shell script).

Parameters

AttributeDescriptionRequired
adkrootThe directory where the ADK residesyes
adkconfigThe directory where the ADK configuration files are stored. no
policyThe Java security policy file to use with the habitat. no

Arguments

arg

You can specify commandline arguments for the habitat by specifying arg elements.

Warning

When you are specifying file arguments, you must spcify them using the file attribute.

classpath

If you want specify extra libraries for the classpath, you can use nested classpath element.

The paths specified here are prepended to the Habitat's own classpath

JVM arguments

If you want to specify extra JVM arguments, you can use nested jvmarg elements.

The elements specified here are prepended to the Habitat's own JVM arguments.

Examples

This starts a new, empty habitat.

        
<habitat  adkroot="../adk-1-3-10"/>
        
      

The following example starts a new habitat which uses a specific habitat file and its own configuration directory.

        
<habitat  adkroot="../adk-1-3-10"
          adkconfig="${user.home}/.adk/">
    <arg file="habitat.xml"/>
</habitat>
        
      

This examples start a new habitat with myfile.jar prepended to the classpath. The habitat is cleared before startup. It uses the 'server' VM.

        
<habitat  adkroot="../adk-1-3-10">
    <arg value="--clean-db"/>
    <jvmarg value="-server"/>
    <classpath>
        <pathelement location="myfile.jar"/>
    </classpath
</habitat>

      

This examples creates a new database for the habitat

        
<habitat  adkroot="../adk-1-3-10">
    <arg value="--create-db"/>
    <arg value="--sql-file"/>
    <arg file="../config/datamodel/datamodel-mckoi.sql"/>
</habitat>