public String toString() { return "BaseStepControllerImpl for step = " + step.getId(); } }
public String toString() { return "BaseStepControllerImpl for step = " + step.getId(); } }
/** * @return the step name. */ protected String getStepName() { return getStep().getId(); }
protected BaseStepControllerImpl(RuntimeJobExecution jobExecution, Step step, StepContextImpl stepContext, long rootJobExecutionId) { this.jobExecutionImpl = jobExecution; this.jobInstance = jobExecution.getJobInstance(); this.stepContext = stepContext; this.rootJobExecutionId = rootJobExecutionId; if (step == null) { throw new IllegalArgumentException("Step parameter to ctor cannot be null."); } this.step = step; this.stepName = step.getId(); }
private synchronized List<ListenerInfo> getStepListenerInfo(Step step, InjectionReferences injectionRefs) { if (!stepLevelListenerInfo.containsKey(step.getId())) { List<ListenerInfo> stepListenerInfoList = new ArrayList<ListenerInfo>(); stepLevelListenerInfo.put(step.getId(), stepListenerInfoList); Listeners stepLevelListeners = step.getListeners(); if (stepLevelListeners != null) { for (Listener listener : stepLevelListeners.getListenerList()) { ListenerInfo info = buildListenerInfo(listener, injectionRefs); stepListenerInfoList.add(info); } } return stepListenerInfoList; } else { return stepLevelListenerInfo.get(step.getId()); } }
private synchronized List<ListenerInfo> getStepListenerInfo(Step step, InjectionReferences injectionRefs) { if (!stepLevelListenerInfo.containsKey(step.getId())) { List<ListenerInfo> stepListenerInfoList = new ArrayList<ListenerInfo>(); stepLevelListenerInfo.put(step.getId(), stepListenerInfoList); Listeners stepLevelListeners = step.getListeners(); if (stepLevelListeners != null) { for (Listener listener : stepLevelListeners.getListenerList()) { ListenerInfo info = buildListenerInfo(listener, injectionRefs); stepListenerInfoList.add(info); } } return stepListenerInfoList; } else { return stepLevelListenerInfo.get(step.getId()); } }
private synchronized List<ListenerInfo> getStepListenerInfo(Step step, InjectionReferences injectionRefs) { if (!stepLevelListenerInfo.containsKey(step.getId())) { List<ListenerInfo> stepListenerInfoList = new ArrayList<ListenerInfo>(); stepLevelListenerInfo.put(step.getId(), stepListenerInfoList); Listeners stepLevelListeners = step.getListeners(); if (stepLevelListeners != null) { for (Listener listener : stepLevelListeners.getListenerList()) { ListenerInfo info = buildListenerInfo(listener, injectionRefs); stepListenerInfoList.add(info); } } return stepListenerInfoList; } else { return stepLevelListenerInfo.get(step.getId()); } }
private IExecutionElementController getNextElementController() { IExecutionElementController elementController =null; if (currentExecutionElement instanceof Decision) { Decision decision = (Decision)currentExecutionElement; elementController = ExecutionElementControllerFactory.getDecisionController(jobExecution, decision); DecisionControllerImpl decisionController = (DecisionControllerImpl)elementController; decisionController.setPreviousStepExecutions(previousExecutionElement, previousElementController); } else if (currentExecutionElement instanceof Flow) { Flow flow = (Flow)currentExecutionElement; elementController = ExecutionElementControllerFactory.getFlowController(jobExecution, flow, rootJobExecutionId); } else if (currentExecutionElement instanceof Split) { Split split = (Split)currentExecutionElement; elementController = ExecutionElementControllerFactory.getSplitController(jobExecution, split, rootJobExecutionId); } else if (currentExecutionElement instanceof Step) { Step step = (Step)currentExecutionElement; StepContextImpl stepContext = new StepContextImpl(step.getId()); elementController = ExecutionElementControllerFactory.getStepController(jobExecution, step, stepContext, rootJobExecutionId, analyzerQueue); } logger.fine("Next execution element controller = " + elementController); return elementController; }
private IExecutionElementController getNextElementController() { IExecutionElementController elementController =null; if (currentExecutionElement instanceof Decision) { Decision decision = (Decision)currentExecutionElement; elementController = ExecutionElementControllerFactory.getDecisionController(jobExecution, decision); DecisionControllerImpl decisionController = (DecisionControllerImpl)elementController; decisionController.setPreviousStepExecutions(previousExecutionElement, previousElementController); } else if (currentExecutionElement instanceof Flow) { Flow flow = (Flow)currentExecutionElement; elementController = ExecutionElementControllerFactory.getFlowController(jobExecution, flow, rootJobExecutionId); } else if (currentExecutionElement instanceof Split) { Split split = (Split)currentExecutionElement; elementController = ExecutionElementControllerFactory.getSplitController(jobExecution, split, rootJobExecutionId); } else if (currentExecutionElement instanceof Step) { Step step = (Step)currentExecutionElement; StepContextImpl stepContext = new StepContextImpl(step.getId()); elementController = ExecutionElementControllerFactory.getStepController(jobExecution, step, stepContext, rootJobExecutionId, analyzerQueue); } logger.fine("Next execution element controller = " + elementController); return elementController; }
protected void statusStarting() { stepStatus.setBatchStatus(BatchStatus.STARTING); _jobStatusService.updateJobCurrentStep(jobInstance.getInstanceId(), step.getId()); _jobStatusService.updateStepStatus(stepStatus.getStepExecutionId(), stepStatus); stepContext.setBatchStatus(BatchStatus.STARTING); }
protected void statusStarting() { stepStatus.setBatchStatus(BatchStatus.STARTING); _jobStatusService.updateJobCurrentStep(jobInstance.getInstanceId(), step.getId()); _jobStatusService.updateStepStatus(stepStatus.getStepExecutionId(), stepStatus); stepContext.setBatchStatus(BatchStatus.STARTING); }
private void positionReaderAtCheckpoint() { _persistenceManagerService = servicesManager.getPersistenceManagerService(); readerChkptDK = new CheckpointDataKey(jobExecutionImpl.getJobInstance().getInstanceId(), step.getId(), "READER"); CheckpointData readerData = _persistenceManagerService.getCheckpointData(readerChkptDK); try { // check for data in backing store if (readerData != null) { byte[] readertoken = readerData.getRestartToken(); ByteArrayInputStream readerChkptBA = new ByteArrayInputStream(readertoken); TCCLObjectInputStream readerOIS = null; try { readerOIS = new TCCLObjectInputStream(readerChkptBA); readerProxy.open((Serializable) readerOIS.readObject()); readerOIS.close(); } catch (Exception ex) { // is this what I should be throwing here? throw new BatchContainerServiceException("Cannot persist the checkpoint data for [" + step.getId() + "]", ex); } } else { // no chkpt data exists in the backing store readerData = null; readerProxy.open(null); } } catch (ClassCastException e) { throw new IllegalStateException("Expected CheckpointData but found" + readerData); } }
private void positionWriterAtCheckpoint() { _persistenceManagerService = servicesManager.getPersistenceManagerService(); writerChkptDK = new CheckpointDataKey(jobExecutionImpl.getJobInstance().getInstanceId(), step.getId(), "WRITER"); CheckpointData writerData = _persistenceManagerService.getCheckpointData(writerChkptDK); try { // check for data in backing store if (writerData != null) { byte[] writertoken = writerData.getRestartToken(); ByteArrayInputStream writerChkptBA = new ByteArrayInputStream(writertoken); TCCLObjectInputStream writerOIS = null; try { writerOIS = new TCCLObjectInputStream(writerChkptBA); writerProxy.open((Serializable) writerOIS.readObject()); writerOIS.close(); } catch (Exception ex) { // is this what I should be throwing here? throw new BatchContainerServiceException("Cannot persist the checkpoint data for [" + step.getId() + "]", ex); } } else { // no chkpt data exists in the backing store writerData = null; writerProxy.open(null); } } catch (ClassCastException e) { throw new IllegalStateException("Expected CheckpointData but found" + writerData); } } }
private void positionWriterAtCheckpoint() { _persistenceManagerService = servicesManager.getPersistenceManagerService(); writerChkptDK = new CheckpointDataKey(jobExecutionImpl.getJobInstance().getInstanceId(), step.getId(), "WRITER"); CheckpointData writerData = _persistenceManagerService.getCheckpointData(writerChkptDK); try { // check for data in backing store if (writerData != null) { byte[] writertoken = writerData.getRestartToken(); ByteArrayInputStream writerChkptBA = new ByteArrayInputStream(writertoken); TCCLObjectInputStream writerOIS = null; try { writerOIS = new TCCLObjectInputStream(writerChkptBA); writerProxy.open((Serializable) writerOIS.readObject()); writerOIS.close(); } catch (Exception ex) { // is this what I should be throwing here? throw new BatchContainerServiceException("Cannot persist the checkpoint data for [" + step.getId() + "]", ex); } } else { // no chkpt data exists in the backing store writerData = null; writerProxy.open(null); } } catch (ClassCastException e) { throw new IllegalStateException("Expected CheckpointData but found" + writerData); } } }
private void positionReaderAtCheckpoint() { _persistenceManagerService = servicesManager.getPersistenceManagerService(); readerChkptDK = new CheckpointDataKey(jobExecutionImpl.getJobInstance().getInstanceId(), step.getId(), "READER"); CheckpointData readerData = _persistenceManagerService.getCheckpointData(readerChkptDK); try { // check for data in backing store if (readerData != null) { byte[] readertoken = readerData.getRestartToken(); ByteArrayInputStream readerChkptBA = new ByteArrayInputStream(readertoken); TCCLObjectInputStream readerOIS = null; try { readerOIS = new TCCLObjectInputStream(readerChkptBA); readerProxy.open((Serializable) readerOIS.readObject()); readerOIS.close(); } catch (Exception ex) { // is this what I should be throwing here? throw new BatchContainerServiceException("Cannot persist the checkpoint data for [" + step.getId() + "]", ex); } } else { // no chkpt data exists in the backing store readerData = null; readerProxy.open(null); } } catch (ClassCastException e) { throw new IllegalStateException("Expected CheckpointData but found" + readerData); } }
@Test public void testModelNoValidate() throws Exception { JAXBContext ctx = JAXBContext.newInstance("com.ibm.jbatch.jsl.model"); Unmarshaller u = ctx.createUnmarshaller(); FileInputStream fis = new FileInputStream(new File("test/files/valid.job1.xml")); // Use this for anonymous type //Job job = (Job)u.unmarshal(url.openStream()); // Use this for named complex type, which is what the spec uses. Object elem = u.unmarshal(fis); JSLJob job = (JSLJob)((JAXBElement)elem).getValue(); assertEquals("job1", job.getId()); assertEquals(1, job.getExecutionElements().size()); Step step = (Step)job.getExecutionElements().get(0); assertEquals("step1", step.getId()); Batchlet b = step.getBatchlet(); assertEquals("step1Ref", b.getRef()); }
this.stepStatus = _jobStatusService.getStepStatus(jobInstance.getInstanceId(), step.getId()); if (stepStatus == null) { logger.finer("No existing step status found. Create new step execution and proceed to execution.");
@Test public void testModelValidate() throws Exception { JAXBContext ctx = JAXBContext.newInstance("com.ibm.jbatch.jsl.model"); Unmarshaller u = ctx.createUnmarshaller(); u.setSchema(ValidatorHelper.getXJCLSchema()); JSLValidationEventHandler handler = new JSLValidationEventHandler(); u.setEventHandler(handler); FileInputStream fis = new FileInputStream(new File("test/files/valid.job1.xml")); // Use this for anonymous type //Job job = (Job)u.unmarshal(url.openStream()); // Use this for named complex type, which is what the spec uses. Object elem = u.unmarshal(fis); assertFalse("XSD invalid, see sysout", handler.eventOccurred()); JSLJob job = (JSLJob)((JAXBElement)elem).getValue(); assertEquals("job1", job.getId()); assertEquals(1, job.getExecutionElements().size()); Step step = (Step)job.getExecutionElements().get(0); assertEquals("step1", step.getId()); Batchlet b = step.getBatchlet(); assertEquals("step1Ref", b.getRef()); }
this.stepStatus = _jobStatusService.getStepStatus(jobInstance.getInstanceId(), step.getId()); if (stepStatus == null) { logger.finer("No existing step status found. Create new step execution and proceed to execution.");
.getJobInstance().getInstanceId(), step.getId());