Package org.springframework.cloud.task.batch.partition

# Class SimpleEnvironmentVariablesProvider

java.lang.Object
org.springframework.cloud.task.batch.partition.SimpleEnvironmentVariablesProvider

All Implemented Interfaces:
  `EnvironmentVariablesProvider`

public class SimpleEnvironmentVariablesProvider extends Object implements EnvironmentVariablesProvider
Copies all existing environment variables as made available in the `Environment` only if includeCurrentEnvironment is set to true (default). The `environmentProperties` option provides the ability to override any specific values on an as needed basis.

Since:
  1.0.2
Author:
  Michael Minella

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimpleEnvironmentVariablesProvider(org.springframework.core.env.Environment environment)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Map<String,String>`
  `getEnvironmentVariables(org.springframework.batch.item.ExecutionContext executionContext)`
  Provides a `Map` of Strings to be used as environment variables.
  `void`
  `setEnvironmentProperties(Map<String,String> environmentProperties)`
  `void`
  `setIncludeCurrentEnvironment(boolean includeCurrentEnvironment)`
  Establishes if current environment variables will be included as a part of the provider.

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

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

- ## Constructor Details

  - ### SimpleEnvironmentVariablesProvider

    public SimpleEnvironmentVariablesProvider(org.springframework.core.env.Environment environment)
    Parameters:
      `environment` - The `Environment` for this context

- ## Method Details

  - ### setEnvironmentProperties

    public void setEnvironmentProperties(Map<String,String> environmentProperties)
    Parameters:
      `environmentProperties` - a `Map` of properties used to override any values configured in the current `Environment`

  - ### setIncludeCurrentEnvironment

    public void setIncludeCurrentEnvironment(boolean includeCurrentEnvironment)
    Establishes if current environment variables will be included as a part of the provider.
    Parameters:
      `includeCurrentEnvironment` - true(default) include local environment properties. False do not include current environment properties.

  - ### getEnvironmentVariables

    public Map<String,String> getEnvironmentVariables(org.springframework.batch.item.ExecutionContext executionContext)
    Description copied from interface: `EnvironmentVariablesProvider`
    Provides a `Map` of Strings to be used as environment variables. This method will be called for each worker step. For example, if there are 5 partitions, this method will be called 5 times.
    Specified by:
      `getEnvironmentVariables` in interface `EnvironmentVariablesProvider`
    Parameters:
      `executionContext` - the `ExecutionContext` associated with the worker's step
    Returns:
      A `Map` of values to be used as environment variables