RESOLVED - issue BATCH-1137: Move classifier to separate package?
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
/**
|
||||
* Interface for a classifier. At its simplest a {@link Classifier} is just a
|
||||
@@ -13,8 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import org.springframework.batch.support.MethodInvoker;
|
||||
import org.springframework.batch.support.MethodInvokerUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
/**
|
||||
* Base class for {@link Classifier} implementations. Provides default behaviour
|
||||
@@ -39,7 +39,7 @@ public class ClassifierSupport<C, T> implements Classifier<C, T> {
|
||||
* Always returns the default value. This is the main extension point for
|
||||
* subclasses, so it must be able to classify null.
|
||||
*
|
||||
* @see org.springframework.batch.support.Classifier#classify(Object)
|
||||
* @see org.springframework.batch.classify.Classifier#classify(Object)
|
||||
*/
|
||||
public T classify(C throwable) {
|
||||
return defaultValue;
|
||||
@@ -13,11 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.batch.support.PatternMatcher;
|
||||
|
||||
/**
|
||||
* A {@link Classifier} that maps from String patterns with wildcards to a set
|
||||
* of values of a given type. An input String is matched with the most specific
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
@@ -21,9 +21,9 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.batch.classify.Classifier;
|
||||
import org.springframework.batch.classify.ClassifierSupport;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.support.Classifier;
|
||||
import org.springframework.batch.support.ClassifierSupport;
|
||||
|
||||
/**
|
||||
* Calls one of a collection of ItemWriters for each item, based on a router
|
||||
|
||||
@@ -18,10 +18,10 @@ package org.springframework.batch.repeat.exception;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.classify.Classifier;
|
||||
import org.springframework.batch.classify.ClassifierSupport;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatException;
|
||||
import org.springframework.batch.support.Classifier;
|
||||
import org.springframework.batch.support.ClassifierSupport;
|
||||
|
||||
/**
|
||||
* Implementation of {@link ExceptionHandler} based on an {@link Classifier}.
|
||||
|
||||
@@ -22,10 +22,10 @@ import java.util.Map.Entry;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.classify.Classifier;
|
||||
import org.springframework.batch.classify.SubclassClassifier;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.context.RepeatContextCounter;
|
||||
import org.springframework.batch.support.Classifier;
|
||||
import org.springframework.batch.support.SubclassClassifier;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,12 +19,12 @@ package org.springframework.batch.retry.policy;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.batch.classify.Classifier;
|
||||
import org.springframework.batch.classify.ClassifierSupport;
|
||||
import org.springframework.batch.classify.SubclassClassifier;
|
||||
import org.springframework.batch.retry.RetryContext;
|
||||
import org.springframework.batch.retry.RetryPolicy;
|
||||
import org.springframework.batch.retry.context.RetryContextSupport;
|
||||
import org.springframework.batch.support.Classifier;
|
||||
import org.springframework.batch.support.ClassifierSupport;
|
||||
import org.springframework.batch.support.SubclassClassifier;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,10 +19,10 @@ package org.springframework.batch.retry.policy;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.springframework.batch.classify.BinaryExceptionClassifier;
|
||||
import org.springframework.batch.retry.RetryContext;
|
||||
import org.springframework.batch.retry.RetryPolicy;
|
||||
import org.springframework.batch.retry.context.RetryContextSupport;
|
||||
import org.springframework.batch.support.BinaryExceptionClassifier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package org.springframework.batch.retry.support;
|
||||
|
||||
import org.springframework.batch.classify.Classifier;
|
||||
import org.springframework.batch.retry.RecoveryCallback;
|
||||
import org.springframework.batch.retry.RetryCallback;
|
||||
import org.springframework.batch.retry.RetryOperations;
|
||||
import org.springframework.batch.retry.RetryState;
|
||||
import org.springframework.batch.support.Classifier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@@ -23,6 +23,8 @@ import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.classify.BackToBackPatternClassifier;
|
||||
import org.springframework.batch.classify.PatternMatchingClassifier;
|
||||
import org.springframework.batch.support.annotation.Classifier;
|
||||
|
||||
/**
|
||||
@@ -14,9 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import org.springframework.batch.classify.BinaryExceptionClassifier;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class BinaryExceptionClassifierTests extends TestCase {
|
||||
@@ -13,11 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.classify.ClassifierAdapter;
|
||||
import org.springframework.batch.support.annotation.Classifier;
|
||||
|
||||
/**
|
||||
@@ -82,7 +83,7 @@ public class ClassifierAdapterTests {
|
||||
@Test
|
||||
public void testClassifierAdapterClassifier() {
|
||||
adapter = new ClassifierAdapter<String, Integer>(
|
||||
new org.springframework.batch.support.Classifier<String, Integer>() {
|
||||
new org.springframework.batch.classify.Classifier<String, Integer>() {
|
||||
public Integer classify(String classifiable) {
|
||||
return Integer.valueOf(classifiable);
|
||||
}
|
||||
@@ -116,7 +117,7 @@ public class ClassifierAdapterTests {
|
||||
|
||||
@Test
|
||||
public void testClassifyWithClassifier() {
|
||||
adapter.setDelegate(new org.springframework.batch.support.Classifier<String, Integer>() {
|
||||
adapter.setDelegate(new org.springframework.batch.classify.Classifier<String, Integer>() {
|
||||
public Integer classify(String classifiable) {
|
||||
return Integer.valueOf(classifiable);
|
||||
}
|
||||
@@ -14,7 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import org.springframework.batch.classify.ClassifierSupport;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.classify.PatternMatchingClassifier;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.support;
|
||||
package org.springframework.batch.classify;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
@@ -23,6 +23,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.classify.SubclassClassifier;
|
||||
|
||||
public class SubclassExceptionClassifierTests {
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.classify.PatternMatchingClassifier;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.support.PatternMatchingClassifier;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -23,9 +23,9 @@ import junit.framework.TestCase;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.SimpleLayout;
|
||||
import org.apache.log4j.WriterAppender;
|
||||
import org.springframework.batch.classify.ClassifierSupport;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.exception.LogOrRethrowExceptionHandler.Level;
|
||||
import org.springframework.batch.support.ClassifierSupport;
|
||||
|
||||
public class LogOrRethrowExceptionHandlerTests extends TestCase {
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.springframework.batch.classify.Classifier;
|
||||
import org.springframework.batch.retry.RetryContext;
|
||||
import org.springframework.batch.retry.RetryPolicy;
|
||||
import org.springframework.batch.support.Classifier;
|
||||
|
||||
public class ExceptionClassifierRetryPolicyTests extends TestCase {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.support.Classifier;
|
||||
import org.springframework.batch.classify.Classifier;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -30,7 +30,7 @@ public class DefaultRetryStateTests {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.retry.support.DefaultRetryState#DefaultRetryState(java.lang.Object, boolean, org.springframework.batch.support.Classifier)}.
|
||||
* {@link org.springframework.batch.retry.support.DefaultRetryState#DefaultRetryState(java.lang.Object, boolean, org.springframework.batch.classify.Classifier)}.
|
||||
*/
|
||||
@Test
|
||||
public void testDefaultRetryStateObjectBooleanClassifierOfQsuperThrowableBoolean() {
|
||||
@@ -46,7 +46,7 @@ public class DefaultRetryStateTests {
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.springframework.batch.retry.support.DefaultRetryState#DefaultRetryState(java.lang.Object, org.springframework.batch.support.Classifier)}.
|
||||
* {@link org.springframework.batch.retry.support.DefaultRetryState#DefaultRetryState(java.lang.Object, org.springframework.batch.classify.Classifier)}.
|
||||
*/
|
||||
@Test
|
||||
public void testDefaultRetryStateObjectClassifierOfQsuperThrowableBoolean() {
|
||||
|
||||
@@ -27,6 +27,7 @@ import static org.easymock.EasyMock.*;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.classify.BinaryExceptionClassifier;
|
||||
import org.springframework.batch.retry.ExhaustedRetryException;
|
||||
import org.springframework.batch.retry.RecoveryCallback;
|
||||
import org.springframework.batch.retry.RetryCallback;
|
||||
@@ -37,7 +38,6 @@ import org.springframework.batch.retry.backoff.BackOffPolicy;
|
||||
import org.springframework.batch.retry.backoff.StatelessBackOffPolicy;
|
||||
import org.springframework.batch.retry.policy.NeverRetryPolicy;
|
||||
import org.springframework.batch.retry.policy.SimpleRetryPolicy;
|
||||
import org.springframework.batch.support.BinaryExceptionClassifier;
|
||||
|
||||
/**
|
||||
* @author Rob Harrop
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.classify.BinaryExceptionClassifier;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.context.RepeatContextSupport;
|
||||
import org.springframework.batch.repeat.support.RepeatSynchronizationManager;
|
||||
@@ -40,7 +41,6 @@ import org.springframework.batch.retry.RetryPolicy;
|
||||
import org.springframework.batch.retry.policy.MapRetryContextCache;
|
||||
import org.springframework.batch.retry.policy.NeverRetryPolicy;
|
||||
import org.springframework.batch.retry.policy.SimpleRetryPolicy;
|
||||
import org.springframework.batch.support.BinaryExceptionClassifier;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
|
||||
public class StatefulRecoveryRetryTests {
|
||||
|
||||
Reference in New Issue
Block a user