public void action() { ACLMessage msg = receive(); if (msg == null) { block(); return; } try { ContentElement content = getContentManager().extractContent(msg); Concept action = ((Action) content).getAction(); switch (msg.getPerformative()) { case (ACLMessage.REQUEST): System.out.println("Request from " + msg.getSender().getLocalName()); if (action instanceof CreateAccount) addBehaviour(new HandleCreateAccount(myAgent, msg)); else if (action instanceof MakeOperation) addBehaviour(new HandleOperation(myAgent, msg)); else replyNotUnderstood(msg); break; case (ACLMessage.QUERY_REF): System.out.println("Query from " + msg.getSender().getLocalName()); if (action instanceof Information) addBehaviour(new HandleInformation(myAgent, msg)); else replyNotUnderstood(msg); break; default: replyNotUnderstood(msg); } } catch (Exception ex) { ex.printStackTrace(); } }