All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bdi.planlib.df.DFLocalSearchPlan Maven / Gradle / Ivy

Go to download

The Jadex applib BDI package contain ready to use functionalities for BDI agents mostly in form of modules called capabilities.

There is a newer version: 2.4
Show newest version
package jadex.bdi.planlib.df;

import jadex.base.fipa.IDF;
import jadex.base.fipa.IDFComponentDescription;
import jadex.bdi.runtime.Plan;
import jadex.bridge.ISearchConstraints;
import jadex.commons.future.IFuture;


/**
 *  Plan to register at the df.
 */
public class DFLocalSearchPlan extends Plan
{
	/**
	 *  Plan body.
	 */
	public void body()
	{
		// Todo: support other parameters!?
		IDFComponentDescription desc = (IDFComponentDescription)getParameter("description").getValue();
		ISearchConstraints	con	= (ISearchConstraints)getParameter("constraints").getValue();
		boolean remote = getParameter("remote").getValue()!=null? 
			((Boolean)getParameter("remote").getValue()).booleanValue(): false;

		// todo: support remote search (search on all DFs on remote platforms also).
		if(remote)
			throw new UnsupportedOperationException("Remote DF search not yet implemented.");
		IFuture ret = ((IDF)getServiceContainer().getRequiredService("df").get(this)).search(desc, con);
		IDFComponentDescription[] result = (IDFComponentDescription[])ret.get(this);
		
		getParameterSet("result").addValues(result);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy