Chapter 6. Scenario: Deploying Agents and Modifying DNA files

Table of Contents

6.1. Adding jars to the DNA
6.2. Adding jars as "shared reference"

This example explains the following features:

6.1. Adding jars to the DNA

To use an extra JAR file, perform the following three steps:

  1. Add the jar to your classpath (edit build.properties).

  2. Modify DNA ANT target (edit build.xml).

  3. Modify the descriptor (create/modify a file in the descriptors directory).

The chat3 example uses the regular expressions library to process incoming messages. The sources can be found in scenarios/src/tryllian/scenarios/chat3 directory

ChatterAgent3.java (The chatter agent)
PatternChatterGenerator.java (Generates simple responses)
ReplyToChatterTask2.java (Tasks that answers chatter agents)

Look at project.classpath in the build.properties file, the structure of the chat3 target in the build.xml file and the descriptor file descriptors/chat3.descriptor.xml.

Note

The link to the build.xml file may not work with all browsers.

To compile the example, type in the scenarios directory :

build chat3

To run the example:

habitat chat3.xml

6.2. Adding jars as "shared reference"

Adding a jar to every agent can take up a lot of extra disk space, especially if you have many different agents. In that case, consider including the jar as a "shared reference". In this situation, there is only one copy of the jar and all agents will carry a reference to it. An example of a shared reference is the AFC, the class library every agent uses.