org.springframework.batch.core.partition.support

## Class MultiResourcePartitioner

- java.lang.Object
- - org.springframework.batch.core.partition.support.MultiResourcePartitioner

- All Implemented Interfaces:
    Partitioner

      public class MultiResourcePartitioner
      extends java.lang.Object
      implements Partitioner

  Implementation of `Partitioner` that locates multiple resources and associates their file names with execution context keys. Creates an `ExecutionContext` per resource, and labels them as `{partition0, partition1, ..., partitionN}`. The grid size is ignored.
  Since:
    2.0
  Author:
    Dave Syer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MultiResourcePartitioner()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map<java.lang.String,ExecutionContext>` | `partition(int gridSize)` Assign the filename of each of the injected resources to an `ExecutionContext`.
    `void` | `setKeyName(java.lang.String keyName)` The name of the key for the file name in each `ExecutionContext`.
    `void` | `setResources(org.springframework.core.io.Resource[] resources)` The resources to assign to each partition.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MultiResourcePartitioner

          public MultiResourcePartitioner()

  - ### Method Detail

    - #### setResources

          public void setResources(org.springframework.core.io.Resource[] resources)

      The resources to assign to each partition. In Spring configuration you can use a pattern to select multiple resources.
      Parameters:
        `resources` - the resources to use

    - #### setKeyName

          public void setKeyName(java.lang.String keyName)

      The name of the key for the file name in each `ExecutionContext`. Defaults to "fileName".
      Parameters:
        `keyName` - the value of the key

    - #### partition

          public java.util.Map<java.lang.String,ExecutionContext> partition(int gridSize)

      Assign the filename of each of the injected resources to an `ExecutionContext`.
      Specified by:
        `partition` in interface `Partitioner`
      Parameters:
        `gridSize` - the size of the map to return
      Returns:
        a map from identifier to input parameters
      See Also:
        `Partitioner.partition(int)`