Providing a debugger API is a compelling task. I thought about it for a while and here are my first ideas. Comments are welcome :)
Debugging is about setting breakpoints in the process *definition*, intercepting the *execution* and then stepping through the following steps. jBPM already offers a mechanism to observe the execution of a process. I can think of providing debugging facilities by creating a process instance with runtime actions installed at the node-enter event of every activity. I will call them "interceptors".
There are two execution modes, "continuous" or "step-by-step". In the former, only interceptors marked as "breakpoints" can suspend the process execution. In the latter, all interceptors can suspend execution.
Communication between the BPEL runtime and the debugger occurs through some remoting technology. EJBs are an option, but web services seem more appropriate since BPEL is about web services.
The exposed operations are:
setBreakpoint(processName: QName, activityName: String)
Mark the interceptor at the entrance of the specified activity, which belongs to the specified process, as a breakpoint.
debug(processName: QName) : ProcessInstanceHandle
Create an instance of the specified process for debugging purposes. Returns a handle to the newly created instance.
getBranches(instanceHandle: ProcessInstanceHandle) : List<ProcessBranchHandle>
Retrieves the execution branches of the specified process instance.
Executes the specified branch up to the next activity. If the branch currently points to a scope, execution will proceed up to the activity nested within the scope.
Executes the specified branch up to the next activity. If the branch currently points to a scope, execution will proceed up to the activity that follows the scope.