分类: Java
2007-06-02 08:39:03
package jadePrime.manage;
import jade.core.Agent;
import jade.core.AID;
import
jade.domain.AMSService;
import
jade.domain.FIPAAgentManagement.*;
public class AMSDump extends Agent
{
protected void setup()
{
AMSAgentDescription
[] agents = null;
try {
SearchConstraints c = new SearchConstraints();
c.setMaxResults (new Long(-1));
agents =
AMSService.search( this, new AMSAgentDescription
(), c );
}
catch (Exception e) {
System.out.println( "Problem
searching AMS: " + e );
e.printStackTrace();
}
AID myID =
getAID();
for (int i=0; i
{
AID
agentID = agents[i].getName();
System.out.println(
(
agentID.equals( myID ) ? "*** " : " ")
+ i + ": " + agentID.getName()
);
}
doDelete();
//System.exit(0);
}