jadex.bdi.planlib.cms.CMSLocalShutdownPlatformPlan 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.cms;
import jadex.bdi.runtime.Plan;
import jadex.bridge.IComponentIdentifier;
import jadex.bridge.IComponentManagementService;
/**
* Shutdown the platform.
*/
// Todo: remove from CMS?
public class CMSLocalShutdownPlatformPlan extends Plan
{
/**
* The plan body.
*/
public void body()
{
IComponentManagementService cms = (IComponentManagementService)getServiceContainer().getRequiredService("cms").get(this);
IComponentIdentifier root = getScope().getComponentIdentifier();
boolean foundroot = false;
while(!foundroot)
{
IComponentIdentifier parent = (IComponentIdentifier)cms.getParent(root).get(this);
if(parent==null)
foundroot = true;
else
root = parent;
}
cms.resumeComponent(root).get(this);
cms.destroyComponent(root);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy