super(stepContext, enclosingRunner);
this.stepRunner = stepRunner;
this.stepMetrics = stepRunner.batchContext.getStepExecution().getStepMetrics();
this.chunk = chunk;
final RefArtifact readerElement = chunk.getReader();
itemReader = jobContext.createArtifact(readerElement.getRef(), null, readerElement.getProperties(), batchContext);
final RefArtifact writerElement = chunk.getWriter();
itemWriter = jobContext.createArtifact(writerElement.getRef(), null, writerElement.getProperties(), batchContext);
final RefArtifact processorElement = chunk.getProcessor();
if (processorElement != null) {
itemProcessor = jobContext.createArtifact(processorElement.getRef(), null, processorElement.getProperties(), batchContext);
}
if (stepRunner.collectorDataQueue != null) {
final RefArtifact collectorConfig = batchContext.getStep().getPartition().getCollector();
if (collectorConfig != null) {
collector = jobContext.createArtifact(collectorConfig.getRef(), null, collectorConfig.getProperties(), batchContext);
}
}
String attrVal = chunk.getCheckpointPolicy();
if (attrVal == null || attrVal.equals("item")) {
attrVal = chunk.getItemCount();
if (attrVal != null) {
itemCount = Integer.parseInt(attrVal);
if (itemCount < 1) {
throw LOGGER.invalidItemCount(itemCount);
}
}
attrVal = chunk.getTimeLimit();
if (attrVal != null) {
timeLimit = Integer.parseInt(attrVal);
}
} else if (attrVal.equals("custom")) {
checkpointPolicy = "custom";
final RefArtifact alg = chunk.getCheckpointAlgorithm();
if (alg != null) {
checkpointAlgorithm = jobContext.createArtifact(alg.getRef(), null, alg.getProperties(), batchContext);
} else {
throw LOGGER.checkpointAlgorithmMissing(stepRunner.step.getId());
}
} else {
throw LOGGER.invalidCheckpointPolicy(attrVal);