/** * 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); }
if(proposal!=null) IMessageEvent reject = getEventbase().createReply(proposal, getShortProtocolName()+"_reject"); reject.getParameter(SFipa.CONTENT).setValue(reject_proposals[i].getProposal()); sendMessage(reject);
/** * */ public void body() { IMessageEvent msg = (IMessageEvent) getParameter("message").getValue(); IMessageEvent update = getEventbase().createReply(msg, "sp_inform"); update.getParameter(SFipa.CONTENT).setValue(getParameter("update").getValue()); sendMessage(update); } }
/** * 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); }
/** * Execute the plan. */ public void body() { IMessageEvent rep = getEventbase().createReply((IMessageEvent)getReason(), "not_understood"); rep.getParameter(SFipa.CONTENT).setValue(((IParameterElement)getReason()).getParameter(SFipa.CONTENT).getValue()); sendMessage(rep); // sendMessage(((IMessageEvent)getReason()).createReply( // "not_understood", getReason().getParameter(SFipa.CONTENT).getValue())); } }
/** * 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); }
if(failure_reason==null) reply = getEventbase().createReply(cancel_msg, "cm_inform"); reply = getEventbase().createReply(cancel_msg, "cm_failure"); IMessageEvent reply = getEventbase().createReply(inimsg, "cm_not_understood"); sendMessage(reply).get(this); getLogger().info("Receiver cancelled: "+getComponentName());
/** * 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); }
reply = getEventbase().createReply(me, "rp_agree"); sendMessage(reply); reply = getEventbase().createReply(me, "rp_refuse"); sendMessage(reply); return; reply = getEventbase().createReply(me, "rp_inform"); reply.getParameter(SFipa.CONTENT).setValue(res); getLogger().info("Receiver sent inform."); reply = getEventbase().createReply(me, "rp_failure"); sendMessage(reply);
IMessageEvent end = getEventbase().createMessageEvent("da_inform_end_auction"); end.getParameter(SFipa.CONTENT).setValue(new Object[]{Boolean.TRUE,winning_offer}); end.getParameterSet(SFipa.RECEIVERS).addValue(winner); IMessageEvent end = getEventbase().createMessageEvent("da_inform_end_auction"); end.getParameter(SFipa.CONTENT).setValue(new Object[]{Boolean.FALSE,winning_offer}); end.getParameterSet(SFipa.RECEIVERS).addValues(losers.toArray());
reply = getEventbase().createReply(me, getShortProtocolName()+"_agree"); sendMessage(reply); reply = getEventbase().createReply(me, getShortProtocolName()+"_refuse"); sendMessage(reply); return; reply = getEventbase().createReply(me, getShortProtocolName()+"_inform"); reply.getParameter(SFipa.CONTENT).setValue(res); getLogger().info("Receiver sent inform."); reply = getEventbase().createReply(me, getShortProtocolName()+"_failure"); sendMessage(reply);
IMessageEvent end = getEventbase().createMessageEvent("ea_inform_end_auction"); end.getParameter(SFipa.CONTENT).setValue(new Object[]{Boolean.TRUE,winning_offer}); end.getParameterSet(SFipa.RECEIVERS).addValue(winner); IMessageEvent end = getEventbase().createMessageEvent("ea_inform_end_auction"); end.getParameter(SFipa.CONTENT).setValue(new Object[]{Boolean.FALSE,winning_offer}); end.getParameterSet(SFipa.RECEIVERS).addValues(losers.toArray());
sendMessage(getEventbase().createReply(tmp, "da_accept_proposal")); getLogger().info(getComponentName() + " found winner: "+tmp.getParameter(SFipa.SENDER).getValue()); sendMessage(getEventbase().createReply(tmp, "da_reject_proposal")); getLogger().info(getComponentName() + ": rejected proposal");
+cfp+" from: "+tmp.getParameter(SFipa.SENDER).getValue()); IMessageEvent accept = getEventbase().createReply(tmp, "ea_accept_proposal"); +cfp+" from: "+tmp.getParameter(SFipa.SENDER).getValue()); IMessageEvent reject = getEventbase().createReply(tmp, "ea_reject_proposal");
+auctiondesc.getTopic()+" that it doesn't want to participate."); sendMessage(getEventbase().createReply(cfp, "da_not_understood")); sendMessage(getEventbase().createReply(cfp, "da_propose")); getLogger().info(getComponentName()+" accepted proposal: "+cfp.getParameter(SFipa.CONTENT).getValue());
+auctiondesc.getTopic()+" that it doesn't want to participate."); sendMessage(getEventbase().createReply(cfp, "ea_not_understood")); sendMessage(getEventbase().createReply(cfp, "ea_propose"));
reply = getEventbase().createReply(me, getShortProtocolName()+"_refuse"); getLogger().info("No proposal made. Finished."); sendMessage(reply); reply = getEventbase().createReply(me, getShortProtocolName()+"_propose"); reply.getParameter(SFipa.CONTENT).setValue(proposal[0]); getLogger().info("Receiver sent proposal: "+reply); reply = getEventbase().createReply(me, getShortProtocolName()+"_inform"); reply = getEventbase().createReply(me,getShortProtocolName()+"_failure"); getLogger().info("Receiver sent failure: "+reply); sendMessage(reply);
IMessageEvent accept = getEventbase().createReply(proposal, getShortProtocolName()+"_accept"); accept.getParameter(SFipa.CONTENT).setValue(acceptables[i].getProposal()); sendMessage(accept);
IMessageEvent accept = getEventbase().createReply(proposal, getShortProtocolName()+"_accept"); accept.getParameter(SFipa.CONTENT).setValue(acceptables[i].getProposal()); IMessageEvent reply = sendMessageAndWait(accept, getTimeout()); if(proposal!=null) IMessageEvent reject = getEventbase().createReply(proposal, getShortProtocolName()+"_reject"); reject.getParameter(SFipa.CONTENT).setValue(acceptables[i].getProposal()); sendMessage(reject);
public void body() { IMessageEvent msg = (IMessageEvent) getReason(); IMessageEvent reply = getEventbase().createReply(msg, "sp_agree"); sendMessage(reply); IGoal startSub = createGoal("sp_start_subscription"); startSub.getParameter("initiator").setValue(msg.getParameter(SFipa.SENDER).getValue()); startSub.getParameter("subscription_id").setValue(msg); startSub.getParameter("subscription").setValue(msg.getParameter(SFipa.CONTENT).getValue()); dispatchSubgoalAndWait(startSub); } }