/** * @see org.springframework.batch.core.listener.CompositeItemProcessListener#beforeProcess(java.lang.Object) */ @Override public void beforeProcess(T item) { try { itemProcessListener.beforeProcess(item); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in beforeProcess.", getTargetException(e)); } }
/** * @see org.springframework.batch.core.listener.CompositeChunkListener#afterChunk(ChunkContext context) */ @Override public void afterChunk(ChunkContext context) { try { chunkListener.afterChunk(context); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in afterChunk.", getTargetException(e)); } }
/** * @see org.springframework.batch.core.listener.CompositeChunkListener#beforeChunk(ChunkContext context) */ @Override public void beforeChunk(ChunkContext context) { try { chunkListener.beforeChunk(context); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in beforeChunk.", getTargetException(e)); } }
/** * @see org.springframework.batch.core.listener.CompositeItemReadListener#afterRead(java.lang.Object) */ @Override public void afterRead(T item) { try { itemReadListener.afterRead(item); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in afterRead.", getTargetException(e)); } }
/** * @see org.springframework.batch.core.listener.CompositeItemReadListener#beforeRead() */ @Override public void beforeRead() { try { itemReadListener.beforeRead(); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in beforeRead.", getTargetException(e)); } }
/** * @see ItemWriteListener#afterWrite(List) */ @Override public void afterWrite(List<? extends S> items) { try { itemWriteListener.afterWrite(items); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in afterWrite.", getTargetException(e)); } }
/** * @see ItemWriteListener#beforeWrite(List) */ @Override public void beforeWrite(List<? extends S> items) { try { itemWriteListener.beforeWrite(items); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in beforeWrite.", getTargetException(e)); } }
/** * @see org.springframework.batch.core.listener.CompositeStepExecutionListener#afterStep(StepExecution) */ @Override public ExitStatus afterStep(StepExecution stepExecution) { try { return stepListener.afterStep(stepExecution); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in afterStep.", e); } }
/** * @see org.springframework.batch.core.listener.CompositeItemReadListener#onReadError(java.lang.Exception) */ @Override public void onReadError(Exception ex) { try { itemReadListener.onReadError(ex); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in onReadError.", e); } }
/** * @see ItemWriteListener#onWriteError(Exception, List) */ @Override public void onWriteError(Exception ex, List<? extends S> items) { try { itemWriteListener.onWriteError(ex, items); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in onWriteError.", e); } }
/** * @see org.springframework.batch.core.listener.CompositeStepExecutionListener#beforeStep(org.springframework.batch.core.StepExecution) */ @Override public void beforeStep(StepExecution stepExecution) { try { stepListener.beforeStep(stepExecution); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in beforeStep.", e); } }
/** * @see org.springframework.batch.core.listener.CompositeItemProcessListener#onProcessError(java.lang.Object, * java.lang.Exception) */ @Override public void onProcessError(T item, Exception ex) { try { itemProcessListener.onProcessError(item, ex); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in onProcessError.", e); } }
@Override public void afterChunkError(ChunkContext context) { try { chunkListener.afterChunkError(context); } catch (RuntimeException e) { throw new StepListenerFailedException("Error in afterFailedChunk.", e); } }
/** * Convenience method to check whether the given object is or can be made * into a {@link StepListener}. * * @param delegate the object to check * @return true if the delegate is an instance of any of the * {@link StepListener} interfaces, or contains the marker * annotations */ public static boolean isListener(Object delegate) { return AbstractListenerFactoryBean.isListener(delegate, StepListener.class, StepListenerMetaData.values()); } }
/** * Convenience method to check whether the given object is or can be made * into a {@link JobExecutionListener}. * * @param delegate the object to check * @return true if the delegate is an instance of * {@link JobExecutionListener}, or contains the marker annotations */ public static boolean isListener(Object delegate) { return AbstractListenerFactoryBean.isListener(delegate, JobExecutionListener.class, JobListenerMetaData .values()); } }
/** * Public setter for injecting {@link JobExecutionListener}s. They will all * be given the listener callbacks at the appropriate point in the job. * * @param listeners * the listeners to set. */ public void setJobExecutionListeners(JobExecutionListener[] listeners) { for (int i = 0; i < listeners.length; i++) { this.listener.register(listeners[i]); } }
/** * Register a step listener for callbacks at the appropriate stages in a step execution. * * @param listener a {@link StepExecutionListener} */ public void registerStepExecutionListener(StepExecutionListener listener) { this.stepExecutionListener.register(listener); }
/** * <p> * Register an additional {@link RetryReadListener}. * </p> * * @param listener the {@link RetryReadListener} to register */ public void register(RetryReadListener listener) { listeners.add(listener); }
/** * @see org.springframework.batch.core.listener.CompositeSkipListener#onSkipInWrite(java.lang.Object, * java.lang.Throwable) */ @Override public void onSkipInWrite(S item, Throwable t) { skipListener.onSkipInWrite(item, t); }
@Before public void setUp() { listener.setMethodToThrowExceptionFrom(""); reader.setGoingToFail(false); processor.setGoingToFail(false); writer.setGoingToFail(false); }