public String getBEServiceClassName() {
return "jade.core.messaging.TopicManagementService";
}
public ServiceHelper getHelper(Agent a) {
ServiceHelper sh = new TopicManagementHelper() {
private Agent myAgent;
public void init(Agent a) {
myAgent = a;
}
public AID createTopic(String topicName) {
return TopicUtility.createTopic(topicName);
}
public boolean isTopic(AID id) {
return TopicUtility.isTopic(id);
}
public void register(AID topic) throws ServiceException {
try {
invoke(myAgent.getLocalName(), "register", new Object[]{topic});
}
catch (NotFoundException nfe) {
throw new ServiceException("Registering agent "+myAgent.getLocalName()+" not found on the back-end");
}
catch (IMTPException imtpe) {
throw new ServiceException("Communication error: "+imtpe.getMessage(), imtpe);
}
}
public void deregister(AID topic) throws ServiceException {
try {
invoke(myAgent.getLocalName(), "deregister", new Object[]{topic});
}
catch (NotFoundException nfe) {
throw new ServiceException("Deregistering agent "+myAgent.getLocalName()+" not found on the back-end");
}
catch (IMTPException imtpe) {
throw new ServiceException("Communication error: "+imtpe.getMessage(), imtpe);
}
}
};
sh.init(a);
return sh;
}