Author: Giovanni Caire (TILab S.p.a)
This example shows a mobile agent, which is able to migrate or clone across multiple network hosts. In this version of JADE only intra-platform mobility is supported. An agent can navigate across different agent containers but is confined to a single JADE platform (see the programmer’s guide for more details on Agent Mobility).
To launch this examples, the user can activate the main container (java jade.Boot -gui), several agent containers (java jade.Boot -container) and then start MobileAgent from command line (java jade.Boot -container mobile:examples.mobile.MobileAgent).Through the agent’s GUI it is possible to select the location (i.e. container) on which move or clone the agent.
The agent is also able to serve requests from other agents. In particular it must receive a REQUEST ACLMessage with one of the following contents:
- (move <destination>) to move the Agent to another container.
Example: (move Front-End) or (move Container-1)
- (exit) to request the agent to exit
- (stop) to stop the counter
- (continue) to continue counting
|This class contains the two resources used by the agent behaviours: the counter cnt and the flag cntEnabled. At the setup it adds two behaviours to serve the incoming messages and to increment the counter. In particular, notice the usage of the two methods beforeMove() and afterMove() to execute some application-specific tasks just before and just after the agent migration takes effect.|
|Jade classes used:|