001/* 002 * Copyright 2006-2007 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 */ 016 017package org.springframework.batch.core.partition.support; 018 019import java.util.Map; 020 021import org.springframework.batch.item.ExecutionContext; 022 023/** 024 * Central strategy interface for creating input parameters for a partitioned 025 * step in the form of {@link ExecutionContext} instances. The usual aim is to 026 * create a set of distinct input values, e.g. a set of non-overlapping primary 027 * key ranges, or a set of unique filenames. 028 * 029 * @author Dave Syer 030 * @since 2.0 031 */ 032public interface Partitioner { 033 034 /** 035 * Create a set of distinct {@link ExecutionContext} instances together with 036 * a unique identifier for each one. The identifiers should be short, 037 * mnemonic values, and only have to be unique within the return value (e.g. 038 * use an incrementer). 039 * 040 * @param gridSize the size of the map to return 041 * @return a map from identifier to input parameters 042 */ 043 Map<String, ExecutionContext> partition(int gridSize); 044 045}