/** * Create a new message event. * @return The new message event. */ public IMessageEvent createMessageEvent(String type) { return getEventbase().createMessageEvent(type); }
content = "Sorry word is not in database: "+eword; IMessageEvent re = getEventbase().createReply(me, reply); re.getParameter(SFipa.CONTENT).setValue(content); sendMessage(re);
/** * Create a new intenal event. * @return The new intenal event. */ public IInternalEvent createInternalEvent(String type) { return getEventbase().createInternalEvent(type); }
/** * Dispatch an internal event. * @param event The event. * Note: plan step is interrupted after call. */ public void dispatchInternalEvent(IInternalEvent event) { getEventbase().dispatchInternalEvent(event); }
/** * Send a message and wait until it is sent. * @param me The message event. */ public IFuture<Void> sendMessage(IMessageEvent me) { return getEventbase().sendMessage(me); }
/** * Dispatch an internal event. */ public IFuture<Void> dispatchInternalEvent(IInternalEvent event) { IBDIXAgentFeature bdif = component.getComponentFeature(IBDIXAgentFeature.class); bdif.getEventbase().dispatchInternalEvent(event); return IFuture.DONE; } }
if(proposal!=null) IMessageEvent reject = getEventbase().createReply(proposal, getShortProtocolName()+"_reject"); reject.getParameter(SFipa.CONTENT).setValue(reject_proposals[i].getProposal()); sendMessage(reject);
/** * 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); }
/** * Dispatch an internal event. */ public IFuture<Void> dispatchInternalEvent(IInternalEvent event) { IBDIXAgentFeature bdif = component.getComponentFeature(IBDIXAgentFeature.class); bdif.getEventbase().dispatchInternalEvent(event); return IFuture.DONE; } }
reply = "failure"; IMessageEvent replymsg = getEventbase().createReply((IMessageEvent)getReason(), reply); replymsg.getParameter(SFipa.CONTENT).setValue(cont); sendMessage(replymsg);
/** * 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 a plan. */ public void body() { IMessageEvent querybet = (IMessageEvent)getReason(); // Reply to dealer. IMessageEvent msg = getEventbase().createReply(querybet, "refuse_bet"); msg.getParameter(SFipa.CONTENT).setValue(querybet.getParameter(SFipa.CONTENT).getValue()); getLogger().info("sending decline to the dealer..."); sendMessage(msg); } }
/** * 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); }
cont = "Request format not correct."; IMessageEvent re = getEventbase().createReply(me, reply); re.getParameter(SFipa.CONTENT).setValue(cont); sendMessage(re);
/** * 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); }
reply = "failure"; IMessageEvent replymsg = getEventbase().createReply((IMessageEvent)getReason(), reply); replymsg.getParameter(SFipa.CONTENT).setValue(cont); sendMessage(replymsg);
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());
reply = "failure"; IMessageEvent replymsg = getEventbase().createReply((IMessageEvent)getReason(), reply); replymsg.getParameter(SFipa.CONTENT).setValue(cont); sendMessage(replymsg);
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 = "failure"; IMessageEvent re = getEventbase().createReply((IMessageEvent)getReason(), reply); re.getParameter(SFipa.CONTENT).setValue(cont); sendMessage(re);