}
}
}
protected void setupComponents(OutputStream outputStream, Map<String, Object> parameters) {
PipelineComponent first = this.components.getFirst();
// first component must be a Starter
if (!(first instanceof Starter)) {
String msg = "Cannot execute pipeline, first pipeline component is no starter";
this.logger.error(msg);
throw new SetupException(new IllegalStateException(msg));
}
// last component must be a Finisher
PipelineComponent last = this.components.getLast();
if (!(last instanceof Finisher)) {
String msg = "Cannot execute pipeline, last pipeline component is no finisher";
this.logger.error(msg);
throw new SetupException(new IllegalStateException(msg));
}
// now try to link the components, always two components at a time
// start at the first component
PipelineComponent currentComponent = first;
first.setup(parameters);
// next component to link is the second in the list
for (ListIterator<T> i = this.components.listIterator(1); i.hasNext();) {
// link the current with the next component
PipelineComponent nextComponent = i.next();
this.linkComponents(currentComponent, nextComponent);
// now advance to the next component
currentComponent = nextComponent;
currentComponent.setup(parameters);