Jadex 0.96-beta1

jadex.runtime
Interface IPlanExecutor

All Known Implementing Classes:
JavaMobilePlanExecutor, JavaStandardPlanExecutor

public interface IPlanExecutor

The plan executor is responsible for creating plan bodies and executing plan steps. Different implementations may exist for different types of plan bodies.


Method Summary
 void cleanup(jadex.runtime.impl.RPlan plan)
          Cleanup after plan execution.
 Object createPlanBody(jadex.runtime.impl.RPlan plan)
          Create the body of a plan.
 jadex.runtime.impl.IREvent eventWaitFor(jadex.runtime.impl.RPlan rplan, jadex.runtime.impl.WaitAbstraction wa)
          Block a plan until an event matching the wait abstraction occurs.
 boolean executeAbortedStep(jadex.runtime.impl.RPlan plan)
          Execute a step of the plans aborted() code.
 boolean executeFailedStep(jadex.runtime.impl.RPlan plan)
          Execute a step of the plans failed() code.
 boolean executePassedStep(jadex.runtime.impl.RPlan plan)
          Execute a step of the plans passed() code.
 boolean executePlanStep(jadex.runtime.impl.RPlan plan)
          Execute a step of a plan.
 Thread getExecutionThread(jadex.runtime.impl.RPlan rplan)
          Get the executing thread of a plan.
 void interruptPlanStep(jadex.runtime.impl.RPlan plan)
          Interrupt a plan step during execution (micro plan step).
 

Method Detail

createPlanBody

Object createPlanBody(jadex.runtime.impl.RPlan plan)
                      throws Exception
Create the body of a plan.

Parameters:
plan - The plan.
Returns:
The created body. May throw any kind of exception, when the body creation fails
Throws:
Exception

executePlanStep

boolean executePlanStep(jadex.runtime.impl.RPlan plan)
                        throws Exception
Execute a step of a plan. Executing a step should cause the latest event to be handled. Will be called by the scheduler for every event to be handled. May throw any kind of exception, when the plan execution fails

Returns:
True, if plan was interrupted (micro plan step).
Throws:
Exception

executePassedStep

boolean executePassedStep(jadex.runtime.impl.RPlan plan)
                          throws Exception
Execute a step of the plans passed() code. This method is called, after the plan has finished successfully (i.e. without exception). Will be called by the scheduler for the first time and every subsequent event to be handled. May throw any kind of exception, when the execution fails

Returns:
True, if execution was interrupted (micro plan step).
Throws:
Exception

executeFailedStep

boolean executeFailedStep(jadex.runtime.impl.RPlan plan)
                          throws Exception
Execute a step of the plans failed() code. This method is called, when the plan has failed (i.e. due to an exception occurring in the plan body). Will be called by the scheduler for the first time and every subsequent event to be handled. May throw any kind of exception, when the execution fails

Returns:
True, if execution was interrupted (micro plan step).
Throws:
Exception

executeAbortedStep

boolean executeAbortedStep(jadex.runtime.impl.RPlan plan)
                           throws Exception
Execute a step of the plans aborted() code. This method is called, when the plan is terminated from the outside (e.g. when the corresponding goal is dropped or the context condition of the plan becomes invalid) Will be called by the scheduler for the first time and every subsequent event to be handled. May throw any kind of exception, when the execution fails

Returns:
True, if execution was interrupted (micro plan step).
Throws:
Exception

interruptPlanStep

void interruptPlanStep(jadex.runtime.impl.RPlan plan)
Interrupt a plan step during execution (micro plan step). The plan is requested to stop the execution to allow consequences of performed plan actions (like belief changes) taking place. When the plan type does not support interruption inside plan steps, interruption can be ignored. In this case all plan steps are executed as if they were atomic blocks.


cleanup

void cleanup(jadex.runtime.impl.RPlan plan)
Cleanup after plan execution. In general, plan execution should be finished, when this method is called. but in exceptional situations (e.g. unexpected death of agent) this method might get called for a still running (or still aborting) plan. In this case the execution should be terminated (without further abort) and all resources be freed.


getExecutionThread

Thread getExecutionThread(jadex.runtime.impl.RPlan rplan)
Get the executing thread of a plan.

Parameters:
rplan - The plan.

eventWaitFor

jadex.runtime.impl.IREvent eventWaitFor(jadex.runtime.impl.RPlan rplan,
                                        jadex.runtime.impl.WaitAbstraction wa)
Block a plan until an event matching the wait abstraction occurs. Only used for standard plans, which block during execution.


Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.