ctx = new CartagoBasicContext(a.getName(), workspaceName, workspaceHost);
}
@Override
public void action() {
ACLMessage request = myAgent.receive();
if (request != null) {
logger.debug("Request received. Parsing...");
if (request.getPerformative() != ACLMessage.REQUEST) {
logger.debug("Message with performative different from REQUEST.");
ACLMessage notUnderstood = request.createReply();
notUnderstood.setPerformative(ACLMessage.NOT_UNDERSTOOD);
notUnderstood.setContent("Unable to process your request. Reason: Unprocessable performative");
myAgent.send(notUnderstood);
logger.debug("Not understood message (performative) sent to agent "+request.getSender().getLocalName());
}
else {
logger.debug("Message with right performative.");
try {
String[] parsed = parseRequest(request.getContent());
} catch (WrongProtocolRoleRequestEnactmentException e) {
// Bad request received
ACLMessage notUnderstood = request.createReply();
notUnderstood.setPerformative(ACLMessage.NOT_UNDERSTOOD);
notUnderstood.setContent("Unable to process your request. Reason: Unprocessable request content: "+request.getContent());
myAgent.send(notUnderstood);
logger.debug("Not understood message (content) sent to agent "+request.getSender().getLocalName());
}
}
} else {