Building Agent Factory in NetBeans 6.1
After nearly 2 years of hard work, I am not done yet with my Master’s degree in Advanced Software Engineering because I still have a project to complete and a dissertation to write. I have chosen to work on a great multiagent system (MAS) development toolkit called Agent Factory, developed and maintained at my university, UCD. Even if it is a research project, Agent Factory is quite usable and is improved all the time. For my dissertation, I will have to extend the existing code to include a performance measurement infrastructure that will provide data for the MAS performance analysis I am planning to implement. So I have downloaded the code and I have begun to play with it. Not being a Java head I had some difficulty getting NetBeans to build properly the full system. The problem was me and my understanding of course, not the code which has perfectly up to date Ant build scripts. So after a full afternoon of fumbling around I managed to get everything to build smoothly and I thought that for the non-Java people around there, it could be nice to have a quick startup guide.
So, after downloading the Agent Factory source code from the CVS how do you build it? Well, it depends if you are using an IDE or Ant. But first you have to understand the build architecture. The first level module is the runtime environment, “AF-RTE”. This module does not reference any other component than the standard Java APIs. Then comes the Debugger runtime, “AF-Debugger”, and the common release APIs, grouped under “Common”, that both need only “AF-RTE”. Finally the Agent Factory development kit, “AFAPL2-DK”, references all the modules we have just cited. There are also a bunch of secondary modules that do not change much: “HTPP-MTS”, “Local-MTS” etc. Note that I do not include “AF2ME” in this tutorial, but basically you should be able to apply the recipes I am describing here.
If you want to use Ant only, then you can compile a module by going into the corresponding directory and type “ant compile” or “ant release” if compile is not available. You have to make sure that the “af-release” property defined in the “build.properties” files are consistent because the build system uses the provided value to build JAR file names that are referenced by the compilation targets. In other words, just make sure all the “af-release” properties are set to the same value throughout the properties files. There is a special build file in the “full-build” module that goes through all the projects. My advice is to read carefully the Ant build files to discover where the files are output.
If you want to use an IDE, which is more likely, the idea is that you want reproduce the dependencies described earlier. Here’s the detail of my NetBeans 6.1 configuration procedure to give you an idea of what you need to do. First I have added “AF-RTE” as a NetBeans Java project with existing source code. I specified the “$YOURPATH/AF-RTE/src” full path as the only source package folder (Note: replace $YOURPATH with the path you’re using). No other configuration step is required as “AF-RTE” depends only on the standard Java APIs. I added “AF-Debugger” the same way, pointing “$YOURPATH/AF-Debugger/src” as the source package folder, but this time I added the output of the “AF-RTE” project, “$YOURPATH/AF-RTE/dist/AF-RTE.jar”, as a compile-time library (you can also point to “$YOURPATH/AF-RTE/build/classes”.)
The “Common” module must be added as a “Java Free-form project” based on the existing Ant build file. In the “New Java Free-Form Project” wizard dialog, specify the path “$YOURPATH/Common” as the project location and “$YOURPATH/Common/build.xml” as the build script. Then select “compile” or “release” as the action for building the project. Finally add the different “src” folders as source package folders. After validating the wizard, display the properties of the new project to add some additional information to the “Java Sources Classpath” category. Make sure “Separate Classpath for Each Source Package Folder” is checked, then add the classpaths as follows:
- Compatibility/src: add “$YOURPATH/Common/Logic/build/classes” and “$YOURPATH/AF-RTE/build/classes”.
- Logic/src: add “$YOURPATH/AF-RTE/build/classes”.
Do the same for the “AFAPL2-DK” project with the following dependency settings:
- Compiler/src: add “$YOURPATH/Common/Logic/build/classes” and “$YOURPATH/AF-RTE/build/classes”.
- Core/src: add “$YOURPATH/AFAPL2-DK/Interpreter/build/classes”, “$YOURPATH/Common/Logic/build/classes” and “$YOURPATH/AF-RTE/build/classes”.
- Debugger/src: add “$YOURPATH/AFAPL2-DK/Interpreter/build/classes”, “$YOURPATH/Common/Logic/build/classes” and “$YOURPATH/AF-RTE/build/classes”.
The following screenshots show what you should obtain the project properties pages for the AFAPL2-DK project:
Do the same for the other modules you require like “HTTP-MTS” or “Infrastructures”, et voilĂ , you should obtain the following Project view in NetBeans:
I know that hardcore Java heads will find all this perfectly obvious and redundant, but I didn’t write this article for them so all is well. And no, this is not dogwash.


