/** * The plan body. */ public void body() { getParameter("result").setValue(Boolean.TRUE); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSShutdownPlatform sp = new CMSShutdownPlatform(); IGoal req = createGoal("rp_initiate"); req.getParameter("receiver").setValue(getParameter("cms").getValue()); req.getParameter("action").setValue(sp); req.getParameter("ontology").setValue(SFipa.COMPONENT_MANAGEMENT_ONTOLOGY_NAME); dispatchSubgoalAndWait(req); } }
/** * Execute the request. * @param request The request. * @param initiator The requesting agent. * @return The result. */ public Object executeRequest(Object request, IComponentIdentifier initiator) { IGoal execute_request = createGoal(getShortProtocolName()+"_execute_request"); execute_request.getParameter("action").setValue(request); execute_request.getParameter("initiator").setValue(initiator); dispatchSubgoalAndWait(execute_request); return execute_request.getParameter("result").getValue(); }
/** * Method, that is being called, when the request has finished. * Default implementation sets status and result on goal. * @param success The final status of the df search. * @param result The result object. */ protected void requestFinished(boolean success, Object result) { getLogger().info("Request finished with: "+success+" "+ SUtil.arrayToString(result)+" "+this+" "+getComponentName()); getParameter("result").setValue(result); if(!success) fail(); }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSSuspendComponent sa = (CMSSuspendComponent)getParameter("action").getValue(); IGoal sag = createGoal("cms_suspend_component"); sag.getParameter("componentidentifier").setValue(sa.getComponentIdentifier()); dispatchSubgoalAndWait(sag); getParameter("result").setValue(new Done(sa)); } }
/** * Handle the ping request. */ public void body() { getParameter("result").setValue(getBeliefbase().getBelief("ping_answer").getFact()); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSDestroyComponent da = (CMSDestroyComponent)getParameter("action").getValue(); IGoal dag = createGoal("cms_destroy_component"); dag.getParameter("componentidentifier").setValue(da.getComponentIdentifier()); dispatchSubgoalAndWait(dag); getParameter("result").setValue(new Done(da)); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { DFDeregister de = (DFDeregister)getParameter("action").getValue(); IGoal dreg = createGoal("df_deregister"); dreg.getParameter("description").setValue(de.getComponentDescription()); dispatchSubgoalAndWait(dreg); getParameter("result").setValue(new Done(de)); } }
public void body() { IMessageEvent updateMsg = (IMessageEvent) getReason(); IGoal handleUpdate = createGoal("sp_handle_update"); handleUpdate.getParameter("subscription_id").setValue(updateMsg.getParameter(SFipa.CONVERSATION_ID).getValue()); handleUpdate.getParameter("update").setValue(updateMsg.getParameter(SFipa.CONTENT).getValue()); dispatchTopLevelGoal(handleUpdate); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSResumeComponent ra = (CMSResumeComponent)getParameter("action").getValue(); IGoal rag = createGoal("cms_suspend_component"); rag.getParameter("componentidentifier").setValue(ra.getComponentIdentifier()); dispatchSubgoalAndWait(rag); getParameter("result").setValue(new Done(ra)); } }
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); } }
/** * Method, that is being called, when the request has finished. * Default implementation sets status and result on goal. * @param success The final status of the df search. * @param result The result object. */ protected void requestFinished(boolean success, Object result) { getLogger().info(getShortProtocolName()+" finished with: "+success+" "+ SUtil.arrayToString(result)+" "+this+" "+getComponentName()); getParameter("result").setValue(result); if(!success) fail(); }
/** * Make a proposal based on the task description. * @param cfp The cfp including the task to execute. * @return The proposal for executing the task. */ public Object[] makeProposal(Object cfp, IComponentIdentifier initiator) { IGoal make_proposal = createGoal(getShortProtocolName()+"_make_proposal"); make_proposal.getParameter("cfp").setValue(cfp); make_proposal.getParameter("initiator").setValue(initiator); dispatchSubgoalAndWait(make_proposal); return new Object[]{make_proposal.getParameter("proposal").getValue(), make_proposal.getParameter("proposal_info").getValue()}; }
/** * The plan body. */ public void body() { IGoal igoal = createGoal((String)getParameter("goaltype").getValue()); igoal.getParameter("message").setValue(getReason()); dispatchTopLevelGoal(igoal); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { DFModify mo = (DFModify)getParameter("action").getValue(); IGoal reg = createGoal("df_modify"); reg.getParameter("description").setValue(mo.getComponentDescription()); dispatchSubgoalAndWait(reg); mo.setResult((IDFComponentDescription)reg.getParameter("result").getValue()); getParameter("result").setValue(new Done(mo)); } }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { CMSShutdownPlatform sd = (CMSShutdownPlatform)getParameter("action").getValue(); dispatchSubgoalAndWait(createGoal("cms_shutdown_platform")); getParameter("result").setValue(new Done(sd)); } }
/** * */ 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); } }
/** * 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())); } }
/** * Execute a plan. */ public void body() { IComponentIdentifier cid = (IComponentIdentifier)getParameter("componentidentifier").getValue(); IFuture ret =((IComponentManagementService)getServiceContainer().getRequiredService("cms").get(this)).suspendComponent(cid); IComponentDescription desc = (IComponentDescription)ret.get(this); getParameter("componentdescription").setValue(desc); } }
/** * Execute a plan. */ public void body() { IComponentIdentifier aid = (IComponentIdentifier)getParameter("componentidentifier").getValue(); IFuture ret = ((IComponentManagementService)getServiceContainer().getRequiredService("cms").get(this)).resumeComponent(aid); IComponentDescription desc = (IComponentDescription) ret.get(this); getParameter("componentdescription").setValue(desc); }