Copyright © 2001 Tryllian Solutions B.V.
Abstract
The ADK comes bundled with several custom Ant tasks. This document describes how these tasks can be used.
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.
Dna — Use the dnacomposer
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.
| Attribute | Description | Required |
|---|---|---|
| dna | The DNA file that should be created. | yes |
| agentdescriptor | The agentdescriptor describing the lay-out of the agent. | yes |
| keystore | The keystore where the certificate is stored. | yes |
| alias | The alias of the keystore specified with the keystore attribute. | yes |
| storepass | The password of the certificate in keystore specified by the alias alias. | yes |
| checkdependencies | If set to true, the DNA file will only be generated if it did not exist or at least one file has changed. | no |
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
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).
| Attribute | Description | Required |
|---|---|---|
| adkroot | The directory where the ADK resides | yes |
| adkconfig | The directory where the ADK configuration files are stored. | no |
| policy | The Java security policy file to use with the habitat. | no |
You can specify commandline arguments for the habitat by specifying arg elements.
When you are specifying file arguments, you must spcify them using the file attribute.
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>