/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { DFRegister re = (DFRegister)getParameter("action").getValue(); IGoal reg = createGoal("df_register"); reg.getParameter("description").setValue(re.getComponentDescription()); dispatchSubgoalAndWait(reg); re.setResult((IDFComponentDescription)reg.getParameter("result").getValue()); getParameter("result").setValue(new Done(re)); } }
/** * The body method is called on the * instantiated plan instance from the scheduler. */ public void body() { // System.out.println("df register"); DFRegister re = new DFRegister(); IDFComponentDescription desc = (IDFComponentDescription)getParameter("description").getValue(); Number lt = (Number)getParameter("leasetime").getValue(); // When AID is omitted, enter self. Hack??? if(desc.getName()==null || lt!=null) { IComponentIdentifier bid = desc.getName()!=null ? desc.getName() : getScope().getComponentIdentifier(); Date leasetime = lt==null ? desc.getLeaseTime() : new Date(getTime()+lt.longValue()); desc = new DFComponentDescription(bid, desc.getServices(), desc.getProtocols(), desc.getOntologies(), desc.getLanguages(), leasetime); } re.setComponentDescription(desc); IGoal req = createGoal("rp_initiate"); req.getParameter("receiver").setValue(getParameter("df").getValue()); req.getParameter("action").setValue(re); req.getParameter("ontology").setValue(SFipa.COMPONENT_MANAGEMENT_ONTOLOGY_NAME); dispatchSubgoalAndWait(req); getParameter("result").setValue(((DFRegister)((Done)req.getParameter("result").getValue()).getAction()).getResult()); } }