Iterator steps = match.getSequence();
if (steps.hasNext()) {
// we have at least one step.
// Loop over the steps, processing each in turn.
StreamBuffer buffer = null;
InputStream stepInput;
OutputStream stepOutput;
// Type of validation to be performed by each step
StepType stepType = null;
while (steps.hasNext()) {
final Step step = (Step) steps.next();
if (logger.isDebugEnabled()) {
logger.debug("Invoking migration step :"+step);
}
// Calculate the input stream for this step.
// If we have a previous output, then that must be the
// input for this step, otherwise use the original
// input.
if (buffer != null) {
stepInput = buffer.getInput();
} else {
stepInput = inputStream;
}
// Calculate the output stream for this step.
// If we have another step to process, then we must
// buffer the output of the step, otherwise use the
// original output.
if (steps.hasNext()) {
buffer = streamBufferFactory.create();
stepOutput = buffer.getOutput();
} else {
stepOutput = outputCreator.createOutputStream();
}
// Workout which step this is