public static JSLJob buildFlowInSplitSubJob(long topLevelJobInstanceId, JobContext jobContext, Split split, Flow flow) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); // Uses the true top-level job instance id, not an internal "subjob" id. String subJobId = generateSubJobId(topLevelJobInstanceId, split.getId(), flow.getId()); subJob.setId(subJobId); //Copy all properties from parent JobContext to flow threads subJob.setProperties(CloneUtility.javaPropsTojslProperties(jobContext.getProperties())); //We don't need to do a deep copy here since each flow is already independent of all others, unlike in a partition //where one step instance can be executed with different properties on multiple threads. subJob.getExecutionElements().add(flow); return subJob; }
private static ExceptionClassFilter cloneExceptionClassFilter(ExceptionClassFilter exceptionClassFilter) { if (exceptionClassFilter == null) { return null; } ExceptionClassFilter newExceptionClassFilter = jslFactory.createExceptionClassFilter(); for (ExceptionClassFilter.Include oldInclude : exceptionClassFilter.getIncludeList()) { newExceptionClassFilter.getIncludeList().add(cloneExceptionClassFilterInclude(oldInclude)); } for (ExceptionClassFilter.Exclude oldExclude : exceptionClassFilter.getExcludeList()) { newExceptionClassFilter.getExcludeList().add(cloneExceptionClassFilterExclude(oldExclude)); } return newExceptionClassFilter; }
private static ExceptionClassFilter.Exclude cloneExceptionClassFilterExclude(ExceptionClassFilter.Exclude exclude) { if (exclude == null) { return null; } ExceptionClassFilter.Exclude newExclude = jslFactory.createExceptionClassFilterExclude(); newExclude.setClazz(exclude.getClazz()); return newExclude; }
ObjectFactory jslFactory = new ObjectFactory(); Property jobName = jslFactory.createProperty(); jobName.setName(TOP_LEVEL_JOB_NAME_PROP); jobName.setValue(getJobName()); properties.getPropertyList().add(jobName); Property instanceId = jslFactory.createProperty(); instanceId.setName(TOP_LEVEL_INSTANCE_ID_PROP); instanceId.setValue(String.valueOf(getInstanceId())); properties.getPropertyList().add(instanceId); Property executionId = jslFactory.createProperty(); executionId.setName(TOP_LEVEL_EXECUTION_ID_PROP); executionId.setValue(String.valueOf(getExecutionId()));
public static JSLJob buildPartitionSubJob(JobContextImpl jobContext, StepContextImpl stepCtx, Step step, int partitionInstance) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); Step newStep = jslFactory.createStep(); if (partition.getCollector() != null) { Partition basePartition = jslFactory.createPartition(); PartitionPlan partitionPlan = jslFactory.createPartitionPlan(); partitionPlan.setPartitions(null); basePartition.setPlan(partitionPlan); newProperties = jslFactory.createJSLProperties(); Property jobName = jslFactory.createProperty(); jobName.setName(StepContextImpl.TOP_LEVEL_STEP_EXECUTION_ID_PROP);
public static JSLJob buildPartitionLevelJSLJob(long topLevelJobExecutionId, Properties jobProperties, Step step, int partitionInstance) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); Step newStep = jslFactory.createStep(); if (partition.getCollector() != null) { Partition basePartition = jslFactory.createPartition(); PartitionPlan partitionPlan = jslFactory.createPartitionPlan(); partitionPlan.setPartitions(null); basePartition.setPlan(partitionPlan);
if (controlElement instanceof End){ End endElement = (End)controlElement; End newEnd = jslFactory.createEnd(); newEnd.setExitStatus(endElement.getExitStatus()); newEnd.setOn(endElement.getOn()); Fail newFail = jslFactory.createFail(); newFail.setExitStatus(failElement.getExitStatus()); newFail.setOn(failElement.getOn()); Next newNext = jslFactory.createNext(); newNext.setOn(nextElement.getOn()); newNext.setTo(nextElement.getTo()); Stop newStop = jslFactory.createStop(); newStop.setExitStatus(stopElement.getExitStatus()); newStop.setOn(stopElement.getOn());
private static ItemProcessor cloneItemProcessor(ItemProcessor itemProcessor) { if (itemProcessor == null) { return null; } ItemProcessor newItemProcessor = jslFactory.createItemProcessor(); newItemProcessor.setRef(itemProcessor.getRef()); newItemProcessor.setProperties(cloneJSLProperties(itemProcessor.getProperties())); return newItemProcessor; }
private static ExceptionClassFilter.Include cloneExceptionClassFilterInclude(ExceptionClassFilter.Include include) { if (include == null) { return null; } ExceptionClassFilter.Include newInclude = jslFactory.createExceptionClassFilterInclude(); newInclude.setClazz(include.getClazz()); return newInclude; }
public static Batchlet cloneBatchlet(Batchlet batchlet){ Batchlet newBatchlet = jslFactory.createBatchlet(); newBatchlet.setRef(batchlet.getRef()); newBatchlet.setProperties(cloneJSLProperties(batchlet.getProperties())); return newBatchlet; }
private static CheckpointAlgorithm cloneCheckpointAlorithm(CheckpointAlgorithm checkpointAlgorithm){ if (checkpointAlgorithm == null) { return null; } CheckpointAlgorithm newCheckpointAlgorithm = jslFactory.createCheckpointAlgorithm(); newCheckpointAlgorithm.setRef(checkpointAlgorithm.getRef()); newCheckpointAlgorithm.setProperties(cloneJSLProperties(checkpointAlgorithm.getProperties())); return newCheckpointAlgorithm; }
public static Chunk cloneChunk(Chunk chunk) { Chunk newChunk = jslFactory.createChunk(); newChunk.setItemCount(chunk.getItemCount()); newChunk.setRetryLimit(chunk.getRetryLimit()); newChunk.setSkipLimit(chunk.getSkipLimit()); newChunk.setTimeLimit(chunk.getTimeLimit()); newChunk.setCheckpointPolicy(chunk.getCheckpointPolicy()); newChunk.setCheckpointAlgorithm(cloneCheckpointAlorithm(chunk.getCheckpointAlgorithm())); newChunk.setProcessor(cloneItemProcessor(chunk.getProcessor())); newChunk.setReader(cloneItemReader(chunk.getReader())); newChunk.setWriter(cloneItemWriter(chunk.getWriter())); newChunk.setNoRollbackExceptionClasses(cloneExceptionClassFilter(chunk.getNoRollbackExceptionClasses())); newChunk.setRetryableExceptionClasses(cloneExceptionClassFilter(chunk.getRetryableExceptionClasses())); newChunk.setSkippableExceptionClasses(cloneExceptionClassFilter(chunk.getSkippableExceptionClasses())); return newChunk; }
public static JSLJob buildPartitionSubJob(Long parentJobInstanceId, JobContext jobContext, Step step, int partitionInstance) { ObjectFactory jslFactory = new ObjectFactory(); JSLJob subJob = jslFactory.createJSLJob(); Step newStep = jslFactory.createStep(); if (partition.getCollector() != null) { Partition basePartition = jslFactory.createPartition(); PartitionPlan partitionPlan = jslFactory.createPartitionPlan(); partitionPlan.setPartitions(null); basePartition.setPlan(partitionPlan);
if (controlElement instanceof End){ End endElement = (End)controlElement; End newEnd = jslFactory.createEnd(); newEnd.setExitStatus(endElement.getExitStatus()); newEnd.setOn(endElement.getOn()); Fail newFail = jslFactory.createFail(); newFail.setExitStatus(failElement.getExitStatus()); newFail.setOn(failElement.getOn()); Next newNext = jslFactory.createNext(); newNext.setOn(nextElement.getOn()); newNext.setTo(nextElement.getTo()); Stop newStop = jslFactory.createStop(); newStop.setExitStatus(stopElement.getExitStatus()); newStop.setOn(stopElement.getOn());
private static ItemProcessor cloneItemProcessor(ItemProcessor itemProcessor) { if (itemProcessor == null) { return null; } ItemProcessor newItemProcessor = jslFactory.createItemProcessor(); newItemProcessor.setRef(itemProcessor.getRef()); newItemProcessor.setProperties(cloneJSLProperties(itemProcessor.getProperties())); return newItemProcessor; }
private static ExceptionClassFilter.Include cloneExceptionClassFilterInclude(ExceptionClassFilter.Include include) { if (include == null) { return null; } ExceptionClassFilter.Include newInclude = jslFactory.createExceptionClassFilterInclude(); newInclude.setClazz(include.getClazz()); return newInclude; }
public static Batchlet cloneBatchlet(Batchlet batchlet){ Batchlet newBatchlet = jslFactory.createBatchlet(); newBatchlet.setRef(batchlet.getRef()); newBatchlet.setProperties(cloneJSLProperties(batchlet.getProperties())); return newBatchlet; }
private static CheckpointAlgorithm cloneCheckpointAlorithm(CheckpointAlgorithm checkpointAlgorithm){ if (checkpointAlgorithm == null) { return null; } CheckpointAlgorithm newCheckpointAlgorithm = jslFactory.createCheckpointAlgorithm(); newCheckpointAlgorithm.setRef(checkpointAlgorithm.getRef()); newCheckpointAlgorithm.setProperties(cloneJSLProperties(checkpointAlgorithm.getProperties())); return newCheckpointAlgorithm; }
public static Chunk cloneChunk(Chunk chunk) { Chunk newChunk = jslFactory.createChunk(); newChunk.setItemCount(chunk.getItemCount()); newChunk.setRetryLimit(chunk.getRetryLimit()); newChunk.setSkipLimit(chunk.getSkipLimit()); newChunk.setTimeLimit(chunk.getTimeLimit()); newChunk.setCheckpointPolicy(chunk.getCheckpointPolicy()); newChunk.setCheckpointAlgorithm(cloneCheckpointAlorithm(chunk.getCheckpointAlgorithm())); newChunk.setProcessor(cloneItemProcessor(chunk.getProcessor())); newChunk.setReader(cloneItemReader(chunk.getReader())); newChunk.setWriter(cloneItemWriter(chunk.getWriter())); newChunk.setNoRollbackExceptionClasses(cloneExceptionClassFilter(chunk.getNoRollbackExceptionClasses())); newChunk.setRetryableExceptionClasses(cloneExceptionClassFilter(chunk.getRetryableExceptionClasses())); newChunk.setSkippableExceptionClasses(cloneExceptionClassFilter(chunk.getSkippableExceptionClasses())); return newChunk; }
if (controlElement instanceof End){ End endElement = (End)controlElement; End newEnd = jslFactory.createEnd(); newEnd.setExitStatus(endElement.getExitStatus()); newEnd.setOn(endElement.getOn()); Fail newFail = jslFactory.createFail(); newFail.setExitStatus(failElement.getExitStatus()); newFail.setOn(failElement.getOn()); Next newNext = jslFactory.createNext(); newNext.setOn(nextElement.getOn()); newNext.setTo(nextElement.getTo()); Stop newStop = jslFactory.createStop(); newStop.setExitStatus(stopElement.getExitStatus()); newStop.setOn(stopElement.getOn());