/** * Send cfps to all receivers. * @param cfp The cfp. * @param convid The conversation id. * @param receivers The receivers. */ protected void sendCFP(Object cfp, String convid, List receivers) { // Send CFP. IMessageEvent cfpm = getEventbase().createMessageEvent("da_cfp"); cfpm.getParameterSet(SFipa.RECEIVERS).addValues(receivers.toArray()); cfpm.getParameter(SFipa.CONTENT).setValue(cfp); cfpm.getParameter(SFipa.CONVERSATION_ID).setValue(convid); getLogger().info(getComponentName() + ": cfp(" + cfp + ")"); sendMessage(cfpm); }
/** * Send cfps to all receivers. * @param cfp The cfp. * @param convid The conversation id. * @param receivers The receivers. */ protected void sendCFP(Object cfp, String convid, List receivers) { // Send CFP. IMessageEvent cfpm = getEventbase().createMessageEvent("ea_cfp"); cfpm.getParameterSet(SFipa.RECEIVERS).addValues(receivers.toArray()); cfpm.getParameter(SFipa.CONTENT).setValue(cfp); cfpm.getParameter(SFipa.CONVERSATION_ID).setValue(convid); getLogger().info(getComponentName() + ": cfp(" + cfp + ")"); sendMessage(cfpm); }
/** * Announce the planned auction. * @param auctiondesc the auction description. * @param receivers The receivers. * @param convid The conversation id. */ protected void announceAuction(Object auctiondesc, List receivers, String convid) { // Send the inform_start_auction-message to all receivers. start = getEventbase().createMessageEvent("ea_inform_start_auction"); start.getParameterSet(SFipa.RECEIVERS).addValues(receivers.toArray()); start.getParameter(SFipa.CONTENT).setValue(auctiondesc); start.getParameter(SFipa.CONVERSATION_ID).setValue(convid); getLogger().info(getComponentName() + ":\tinform_start_auction"); getWaitqueue().addReply(start); sendMessage(start); }
/** * Announce the planned auction. * @param auctiondesc the auction description. * @param receivers The receivers. * @param convid The conversation id. */ protected void announceAuction(Object auctiondesc, List receivers, String convid) { // Send the inform_start_auction-message to all receivers. start = getEventbase().createMessageEvent("da_inform_start_auction"); start.getParameterSet(SFipa.RECEIVERS).addValues(receivers.toArray()); start.getParameter(SFipa.CONTENT).setValue(auctiondesc); start.getParameter(SFipa.CONVERSATION_ID).setValue(convid); getLogger().info(getComponentName() + ": inform_start_auction"); getWaitqueue().addReply(start); sendMessage(start); }
end.getParameterSet(SFipa.RECEIVERS).addValue(winner); end.getParameter(SFipa.CONVERSATION_ID).setValue(convid); sendMessage(end); end.getParameterSet(SFipa.RECEIVERS).addValues(losers.toArray()); end.getParameter(SFipa.CONVERSATION_ID).setValue(convid); sendMessage(end);
end.getParameterSet(SFipa.RECEIVERS).addValue(winner); end.getParameter(SFipa.CONVERSATION_ID).setValue(convid); sendMessage(end); end.getParameterSet(SFipa.RECEIVERS).addValues(losers.toArray()); end.getParameter(SFipa.CONVERSATION_ID).setValue(convid); sendMessage(end);
cancel.getParameterSet(SFipa.RECEIVERS).addValues(message.getParameterSet(SFipa.RECEIVERS).getValues()); cancel.getParameter(SFipa.CONVERSATION_ID).setValue(message.getParameter(SFipa.CONVERSATION_ID).getValue()); cancel.getParameter(SFipa.LANGUAGE).setValue(message.getParameter(SFipa.LANGUAGE).getValue()); sendMessage(cancel); long time = getTime(); List rec = SUtil.arrayToList(message.getParameterSet(SFipa.RECEIVERS).getValues()); try
/** * Send the cfp message. * @param nr The current negotation record. * @param convid The conversation id. */ protected void sendCFP(NegotiationRecord nr, String convid) { startAtomic(); if(me!=null) { getWaitqueue().removeReply(me); } me = createMessageEvent(getShortProtocolName()+"_cfp"); me.getParameterSet(SFipa.RECEIVERS).addValues(nr.getParticipants()); me.getParameter(SFipa.CONVERSATION_ID).setValue(convid); me.getParameter(SFipa.CONTENT).setValue(nr.getCFP()); if(getParameter(SFipa.LANGUAGE).getValue()!=null) me.getParameter(SFipa.LANGUAGE).setValue(getParameter(SFipa.LANGUAGE).getValue()); if(getParameter(SFipa.ONTOLOGY).getValue()!=null) me.getParameter(SFipa.ONTOLOGY).setValue(getParameter(SFipa.ONTOLOGY).getValue()); getWaitqueue().addReply(me); endAtomic(); getLogger().info(getComponentName()+" (I)CNPPlan initiated: "+convid); sendMessage(me); }
public void body() { IMessageEvent subReq = createMessageEvent("sp_subscribe"); subReq.getParameter(SFipa.CONTENT).setValue(getParameter("subscription").getValue()); subReq.getParameterSet("receivers").addValue(getParameter("receiver").getValue()); if(getParameter("language").getValue()!=null) subReq.getParameter("language").setValue(getParameter("language").getValue()); if(getParameter("ontology").getValue()!=null) subReq.getParameter("ontology").setValue(getParameter("ontology").getValue()); if(getParameter("conversation_id").getValue()!=null) subReq.getParameter("conversation_id").setValue(getParameter("conversation_id").getValue()); getParameter("subscription_id").setValue(subReq.getParameter(SFipa.CONVERSATION_ID)); getWaitqueue().addReply(subReq); IMessageEvent reply = sendMessageAndWait(subReq); if (!SFipa.AGREE.equals(reply.getParameter(SFipa.PERFORMATIVE).getValue())) fail(); } }
/** * Perform the request. */ public void body() { //getLogger().info(getScope().getName() + ": Request initiator action called: " + this); getLogger().info("Request/Query initiator action called: " + this+" "+getComponentName()); // Prepare message event. request = createMessageEvent(getShortProtocolName()+"_request"); request.getParameter(SFipa.CONTENT).setValue(getParameter("action").getValue()); request.getParameterSet("receivers").addValue(getParameter("receiver").getValue()); if(getParameter("language").getValue()!=null) request.getParameter("language").setValue(getParameter("language").getValue()); if(getParameter("ontology").getValue()!=null) request.getParameter("ontology").setValue(getParameter("ontology").getValue()); // Send message and wait for answer. try { getWaitqueue().addReply(request); IMessageEvent event = sendMessageAndWait(request, getTimeout()); event = handleFirstAnswer(event); handleSecondAnswer(event); } catch(TimeoutException e) { requestFinished(false, STATUS_TIMEOUT); } }
/** * Perform the request. */ public void body() { //getLogger().info(getScope().getName() + ": Request initiator action called: " + this); getLogger().info("Request initiator action called: " + this+" "+getComponentName()); // Prepare message event. request = createMessageEvent("rp_request"); request.getParameter(SFipa.CONTENT).setValue(getParameter("action").getValue()); request.getParameterSet("receivers").addValue(getParameter("receiver").getValue()); if(getParameter("language").getValue()!=null) request.getParameter("language").setValue(getParameter("language").getValue()); if(getParameter("ontology").getValue()!=null) request.getParameter("ontology").setValue(getParameter("ontology").getValue()); if(getParameter("conversation_id").getValue()!=null) request.getParameter("conversation_id").setValue(getParameter("conversation_id").getValue()); // Send message and wait for answer. try { getWaitqueue().addReply(request); IMessageEvent event = sendMessageAndWait(request, getTimeout()); event = handleFirstAnswer(event); handleSecondAnswer(event); } catch(TimeoutException e) { requestFinished(false, STATUS_TIMEOUT); } }