if (step.subpipeline().size() == 0) {
// I need to instantiate an atomic step to replace this declaration in the
// pipeline I'm about to create.
Step atomicReplacement = new Step(runtime, step.getNode(),step.getDeclaredType(),step.getName());
atomicReplacement.setDeclaration(step);
// TODO: Make sure options and parameters get copied over correctly!
String wrapper = "XML-CALABASH-GENERATED-WRAPPER-PIPELINE";
QName ptype = new QName("", "XML-CALABASH-WRAPPER-TYPE");
// This is an atomic step, manufacture a dummy wrapper pipeline for it.
DeclareStep pipeline = new DeclareStep(runtime, step.getNode(), wrapper);
for (Input input : step.inputs()) {
Input pInput = new Input(runtime, input.getNode());
pInput.setPort(input.getPort());
pInput.setPrimary(input.getPrimary());
pInput.setSequence(input.getSequence());
pInput.setParameterInput(input.getParameterInput());
pipeline.addInput(pInput);
PipeNameBinding pnb = new PipeNameBinding(runtime, input.getNode());
pnb.setStep(wrapper);
pnb.setPort(pInput.getPort());
input.addBinding(pnb);
atomicReplacement.addInput(input);
}
for (Output output : step.outputs()) {
Output pOutput = new Output(runtime, output.getNode());
pOutput.setPort(output.getPort());
pOutput.setPrimary(output.getPrimary());
pOutput.setSequence(output.getSequence());
Input pInput = new Input(runtime, output.getNode());
pInput.setPort("|" + output.getPort());
pInput.setSequence(output.getSequence());
pipeline.addInput(pInput);
PipeNameBinding pnb = new PipeNameBinding(runtime, output.getNode());
pnb.setStep(step.getName());
pnb.setPort(output.getPort());
pInput.addBinding(pnb);
pipeline.addOutput(pOutput);
atomicReplacement.addOutput(output);
}
pipeline.addStep(atomicReplacement);
pipeline.setDeclaredType(ptype);
runtime.declareStep(ptype,pipeline);