Author: Fabio Bellifemine (TILab S.p.a)
Date: 6/01/2001

This examples shows how to transport serialized Java objects inside an ACLMessage.
It is also an example of how to register, deregister, and search agents and services with the DF.
Finally, it also show how to force the platform to encode messages in bit-efficient ACLCodec or XML ACLCodec.

You can launch the example with the following simple command:

java jade.Boot -platform writer:examples.Base64.ObjectWriterAgent  reader:examples.Base64.ObjectReaderAgent

or, much more interesting, with the following 2 commands:

java jade.Boot -port 1099 writer:examples.Base64.ObjectWriterAgent

java jade.Boot -port 1200 reader:examples.Base64.ObjectReaderAgent

in this case, you must also federated the DF of the two platforms such that the ObjectWriterAgent’s search is propagated to the DF of the second platform also.

The Person class it is here used  just as a support class for the object reader and writer agents.

This agent makes the following task:
    1. registers itself with the df as a reader;
    2. waits a message from its companion, the ObjectWriterAgent;
    3. reads the content of the message. If the language was set to “JavaSerialization” it assumes, by a-priori knowledge, that the content  it is encoded in Base64 and contains a Java object.
Jade classes used:


This agent makes the following task:
    1. searches in the DF for an ObjectReaderAgent;
    2. sends an ACLMessage with a content encoded in Base64 to the  ObjectReaderAgent.  
    3. sends the same message by using the BitEfficient ACLCodec (notice that the message is actually coded only if the receiver belongs to another platform) first, and the XML ACLCodec then
4. sends an ACLMessage with a content encoded as a String
5. sends the same message by using again BitfficientACLCodec and XMLACLCodec
Jade classes used: