org.apache.commons.workflow
Interface Block
- All Superinterfaces:
- Owner, Step
- All Known Subinterfaces:
- Iterator
- All Known Implementing Classes:
- BaseBlock, IfAnyStep, IfNotAnyStep, IfNotStep, IfStep, WhileAnyStep, WhileNotAnyStep, WhileNotStep, WhileStep
public interface Block
- extends Owner, Step
A Block is a Step that can include nested Steps.
It is used to create Step implementations supporting conditional
execution and iteration.
DESIGN NOTES - The execute()
method will
be called when the Block is first encountered in the normal flow of
execution (as with any other Step), and each time the execution of the
nested Steps associated with this Block. The Block implementation is
responsible for satisfying the following contract requirements:
- Determine whether this is a first-time entry, or a repeated entry
after execution of the nested Steps for this Block:
- Peek at the top item on the
BlockState
stack maintained
for us by the current Context
.
- If the top item exists, and has a
block
property
equal to the current Block, this is a repeated entry after execution
of the nested Steps for this Block.
- If there is no top element, or the top element is for a different
Block
, this is the initial entry from the preceeding
Step in the current Activity (or Block).
- When this is the initial entry into the Block, make a decision about
whether the nested Steps should be executed:
- If the nested Steps SHOULD be executed, create a
new
BlockState
object (associated with this
Block
) and push it onto the BlockState
stack. Then, set the next Step to be the first nested Step
for this Block.
- If the nested Steps SHOULD NOT be executed,
simply return. The next Step will have already been set to the
next Step of the current Activity (or Block) at the same nesting
level.
- When this is a repeated entry into the Block, make a decision about
whether the nested Steps should be executed again:
- If the nested Steps SHOULD be executed again,
set the next Step to be the first nested Step for this Block.
- If the nested Steps SHOULD NOT be executed again,
pop our
BlockState
object off of the stack
maintained by our Context
. Then, set the next Step
to the nextStep
property of this Block, which will
cause execution to flow past the Block.
- Version:
- $Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
- Author:
- Craig R. McClanahan
Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.