jadex.bdi.planlib.protocols.subscribe.SPInitiationPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applib-bdi Show documentation
Show all versions of jadex-applib-bdi Show documentation
The Jadex applib BDI package contain
ready to use functionalities for
BDI agents mostly in form of modules
called capabilities.
package jadex.bdi.planlib.protocols.subscribe;
import jadex.base.fipa.SFipa;
import jadex.bdi.runtime.IMessageEvent;
import jadex.bdi.runtime.Plan;
public class SPInitiationPlan extends Plan
{
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();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy