From JADE tutorial:
For each published service a description is provided including the
service type, the service name, the languages and ontologies required
to exploit that service and a number of service-specific properties.
The DFAgentDescription, ServiceDescription and Property classes,
included in the jade.domain.FIPAAgentManagement package, represent the
three mentioned abstractions. In order to publish a service an agent
must create a proper description (as an instance of the
DFAgentDescription class) and call the register() static method of the
DFService class. Typically, but not necessarily, service registration
(publication) is done in the setup() method as shown below in the case
of the Book seller agent.
If I want to describe it as simple as possible, every agent which offers a service should register its service in the yellow pages (called Directory Facilitator or DF in JADE and each platform have at least one DF), so the other agents in same platform can search for it.
For registering in DF, you need to create a ServiceDescription
, this usually done in setup
method of agents:
protected void setup() {
...
// Register the book-selling service in the yellow pages
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
ServiceDescription sd = new ServiceDescription();
sd.setType("book-selling");
sd.setName("JADE-book-trading");
dfd.addServices(sd);
try {
DFService.register(this, dfd);
}
catch (FIPAException fe) {
fe.printStackTrace();
}
...
}