How to use the XML-ACL Codec with JADE

Author: Ion Constantinescu (EPFL)

Date: March 27, 2001 

Java platform: Sun JDK 1.2 Windows 

JADE version 2.2 

This tutorial describes how to install and use the XML-ACL Codec with JADE. This codec implements the FIPA Specifications no. 71 FIPA ACL Message Representation in XML Specification

Installation.

In order to install XML-ACL the following steps must be performed:

  • The XML-ACL codec must be downloaded from the JADE download page.
  • after downloading you MUST unzip the XML-ACL codec package under the root of the jade distribution tree. You should end having a hierarchy like jade/add-ons/xmlacl.
  • SAX parser must be downloaded and installed into the system. See below a list of known parsers and configuration options.
  • The xml parser jar file must be added to the CLASSPATH or specified in the -classpath argument when starting the virtual machine

Compiling

The default Makefile rules don’t take the XML-ACL Codec into account. For handling the compilation process of the XML-ACL Codec you have to use the ‘build.xml’ ant-file located in the xmlacl directory. The following rules are available:

  • ant – compiles the codec class
  • ant lib – creates the xmlacl.jar archive
  • ant clean – removes the compiled classes and the xmlacl.jar archive

Configuration and Usage

The current implementation has been tested with the following parsers:

Parser Name Parser Class
Crimson org.apache.crimson.parser.XMLReaderImpl
Xerces org.apache.xerces.parsers.SAXParser

The current configuration uses Crimson as the default parser. So if you don’t want to make any changes you just have to download Crimson from the link provided above and make sure it is added to the classpath when starting ( either by including it into the $CLASSPATH environment variable – %CLASSPATH% under windows or by specifing it on the command line ) . Notice that the XML-ACL codec must be launched on all the JADE containers

Here is an example of how you would start the platform assuming that you copied crimson.jar from the initial distribution to the jade/lib directory) :

java -classpath ./lib/jade.jar:./lib/jadeTools.jar:./lib/iiop.jar:./lib/crimson.jar:./add-ons/xmlacl/lib/xmlacl.jar jade.Boot -aclcodecs jamr.jadeacl.xml.XMLACLCodec        (for Unix) 

or

java -classpath .\lib\jade.jar;.\lib\jadeTools.jar;./lib/iiop.jar;.\lib\crimson.jar;.\add-ons\xmlacl\lib\xmlacl.jar jade.Boot -aclcodecs jamr.jadeacl.xml.XMLACLCodec       (for Windows) 

If you want to use another parser suplementary you have to specify in the command line the system property org.xml.sax.parser as in the following example ( also assuming that you have copied xerces.jar from the initial distribution to the jade/lib directory ) :

java -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -classpath ./lib/jade.jar:./lib/jadeTools.jar:./lib/iiop.jar:./lib/xerces.jar:./add-ons/xmlacl/lib/xmlacl.jar jade.Boot -aclcodecs jamr.jadeacl.xml.XMLACLCodec ( for Unix )
or
java -Dorg.xml.sax.parser=org.apache.xerces.parsers.SAXParser -classpath .\lib\jade.jar;.\lib\jadeTools.jar;.\lib\iiop.jar;.\lib\xerces.jar;.\add-ons\xmlacl\lib\xmlacl.jar jade.Boot -aclcodecs jamr.jadeacl.xml.XMLACLCodec ( for Windows )

Examples

Using XML-ACLCodec in Jade

When an agent wants to send a XML encoded message, all it has to do is to indicate this in the message envelope. For example (assuming e is the message envelope):

e.setAclRepresentation("fipa.acl.rep.xml.std"); 

and Jade takes care of the rest. When receiving xml encoded messages, the agent does not have to do anything, Jade is working for him.


JADE is a trademark of TILAB (formerly CSELT). 
JADE
 has been developed jointly by TILAB (formerly CSELT) and the Computer Engineering Group of the University of Parma
The XML-ACL Codec implementation was developed in the Artificial Inteligence Laboratory (LIA) at the Swiss Federal Institute of Technology Lausanne (EPFL) (LIA).