001/* 002 * Copyright 2006-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.springframework.batch.core.listener; 017 018import java.util.List; 019 020import org.springframework.batch.core.ChunkListener; 021import org.springframework.batch.core.ExitStatus; 022import org.springframework.batch.core.ItemProcessListener; 023import org.springframework.batch.core.ItemReadListener; 024import org.springframework.batch.core.ItemWriteListener; 025import org.springframework.batch.core.SkipListener; 026import org.springframework.batch.core.StepExecution; 027import org.springframework.batch.core.StepExecutionListener; 028import org.springframework.batch.core.StepListener; 029import org.springframework.batch.core.scope.context.ChunkContext; 030import org.springframework.lang.Nullable; 031 032/** 033 * Basic no-op implementations of all {@link StepListener} interfaces. 034 * 035 * @author Lucas Ward 036 * @author Robert Kasanicky 037 * @author Mahmoud Ben Hassine 038 */ 039public class StepListenerSupport<T,S> implements StepExecutionListener, ChunkListener, 040ItemReadListener<T>, ItemProcessListener<T,S>, ItemWriteListener<S>, SkipListener<T, S> { 041 042 /* (non-Javadoc) 043 * @see org.springframework.batch.core.StepExecutionListener#afterStep(org.springframework.batch.core.StepExecution) 044 */ 045 @Override 046 public ExitStatus afterStep(StepExecution stepExecution) { 047 return null; 048 } 049 050 /* (non-Javadoc) 051 * @see org.springframework.batch.core.StepExecutionListener#beforeStep(org.springframework.batch.core.StepExecution) 052 */ 053 @Override 054 public void beforeStep(StepExecution stepExecution) { 055 } 056 057 /* (non-Javadoc) 058 * @see org.springframework.batch.core.domain.ChunkListener#afterChunk(ChunkContext context) 059 */ 060 @Override 061 public void afterChunk(ChunkContext context) { 062 } 063 064 /* (non-Javadoc) 065 * @see org.springframework.batch.core.domain.ChunkListener#beforeChunk(ChunkContext context) 066 */ 067 @Override 068 public void beforeChunk(ChunkContext context) { 069 } 070 071 /* (non-Javadoc) 072 * @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object) 073 */ 074 @Override 075 public void afterRead(T item) { 076 } 077 078 /* (non-Javadoc) 079 * @see org.springframework.batch.core.domain.ItemReadListener#beforeRead() 080 */ 081 @Override 082 public void beforeRead() { 083 } 084 085 /* (non-Javadoc) 086 * @see org.springframework.batch.core.domain.ItemReadListener#onReadError(java.lang.Exception) 087 */ 088 @Override 089 public void onReadError(Exception ex) { 090 } 091 092 /* (non-Javadoc) 093 * @see org.springframework.batch.core.ItemWriteListener#afterWrite(java.util.List) 094 */ 095 @Override 096 public void afterWrite(List<? extends S> items) { 097 } 098 099 /* (non-Javadoc) 100 * @see org.springframework.batch.core.ItemWriteListener#beforeWrite(java.util.List) 101 */ 102 @Override 103 public void beforeWrite(List<? extends S> items) { 104 } 105 106 /* (non-Javadoc) 107 * @see org.springframework.batch.core.ItemWriteListener#onWriteError(java.lang.Exception, java.util.List) 108 */ 109 @Override 110 public void onWriteError(Exception exception, List<? extends S> items) { 111 } 112 113 /* (non-Javadoc) 114 * @see org.springframework.batch.core.ItemProcessListener#afterProcess(java.lang.Object, java.lang.Object) 115 */ 116 @Override 117 public void afterProcess(T item, @Nullable S result) { 118 } 119 120 /* (non-Javadoc) 121 * @see org.springframework.batch.core.ItemProcessListener#beforeProcess(java.lang.Object) 122 */ 123 @Override 124 public void beforeProcess(T item) { 125 } 126 127 /* (non-Javadoc) 128 * @see org.springframework.batch.core.ItemProcessListener#onProcessError(java.lang.Object, java.lang.Exception) 129 */ 130 @Override 131 public void onProcessError(T item, Exception e) { 132 } 133 134 /* (non-Javadoc) 135 * @see org.springframework.batch.core.SkipListener#onSkipInProcess(java.lang.Object, java.lang.Throwable) 136 */ 137 @Override 138 public void onSkipInProcess(T item, Throwable t) { 139 } 140 141 /* (non-Javadoc) 142 * @see org.springframework.batch.core.SkipListener#onSkipInRead(java.lang.Throwable) 143 */ 144 @Override 145 public void onSkipInRead(Throwable t) { 146 } 147 148 /* (non-Javadoc) 149 * @see org.springframework.batch.core.SkipListener#onSkipInWrite(java.lang.Object, java.lang.Throwable) 150 */ 151 @Override 152 public void onSkipInWrite(S item, Throwable t) { 153 } 154 155 @Override 156 public void afterChunkError(ChunkContext context) { 157 } 158 159}