Package org.springframework.cloud.task.configuration

# Class DefaultTaskConfigurer

java.lang.Object
org.springframework.cloud.task.configuration.DefaultTaskConfigurer

All Implemented Interfaces:
  `TaskConfigurer`

Direct Known Subclasses:
  `CustomTaskConfigurer`

public class DefaultTaskConfigurer extends Object implements TaskConfigurer
Default implementation of the TaskConfigurer interface. If no `TaskConfigurer` implementation is present, then this configuration will be used. The following defaults will be used:

- `SimpleTaskRepository` is the default `TaskRepository` returned. If a data source is present then a data will be stored in the database `JdbcTaskExecutionDao` else it will be stored in a map `MapTaskExecutionDao`.

Author:
  Glenn Renfro, Michael Minella

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultTaskConfigurer()`
  `DefaultTaskConfigurer(String tablePrefix)`
  Initializes the DefaultTaskConfigurer.
  `DefaultTaskConfigurer(DataSource dataSource)`
  Initializes the DefaultTaskConfigurer and sets the default table prefix to `TaskProperties.DEFAULT_TABLE_PREFIX`.
  `DefaultTaskConfigurer(DataSource dataSource, String tablePrefix, org.springframework.context.ApplicationContext context)`
  Initializes the DefaultTaskConfigurer.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DataSource`
  `getTaskDataSource()`
  Retrieves the `DataSource` that will be used for task operations.
  `TaskExplorer`
  `getTaskExplorer()`
  Create a `TaskExplorer` for the task.
  `TaskRepository`
  `getTaskRepository()`
  Create a `TaskRepository` for the Task.
  `org.springframework.transaction.PlatformTransactionManager`
  `getTransactionManager()`
  Create a `PlatformTransactionManager` for use with the `TaskRepository`.

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

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

- ## Constructor Details

  - ### DefaultTaskConfigurer

    public DefaultTaskConfigurer()

  - ### DefaultTaskConfigurer

    public DefaultTaskConfigurer(DataSource dataSource)
    Initializes the DefaultTaskConfigurer and sets the default table prefix to `TaskProperties.DEFAULT_TABLE_PREFIX`.
    Parameters:
      `dataSource` - references the `DataSource` to be used as the Task repository. If none is provided, a Map will be used (not recommended for production use).

  - ### DefaultTaskConfigurer

    public DefaultTaskConfigurer(String tablePrefix)
    Initializes the DefaultTaskConfigurer.
    Parameters:
      `tablePrefix` - the prefix to apply to the task table names used by task infrastructure.

  - ### DefaultTaskConfigurer

    public DefaultTaskConfigurer(DataSource dataSource, String tablePrefix, org.springframework.context.ApplicationContext context)
    Initializes the DefaultTaskConfigurer.
    Parameters:
      `dataSource` - references the `DataSource` to be used as the Task repository. If none is provided, a Map will be used (not recommended for production use).
      `tablePrefix` - the prefix to apply to the task table names used by task infrastructure.
      `context` - the context to be used.

- ## Method Details

  - ### getTaskRepository

    public TaskRepository getTaskRepository()
    Description copied from interface: `TaskConfigurer`
    Create a `TaskRepository` for the Task.
    Specified by:
      `getTaskRepository` in interface `TaskConfigurer`
    Returns:
      A TaskRepository

  - ### getTaskExplorer

    public TaskExplorer getTaskExplorer()
    Description copied from interface: `TaskConfigurer`
    Create a `TaskExplorer` for the task.
    Specified by:
      `getTaskExplorer` in interface `TaskConfigurer`
    Returns:
      a `TaskExplorer`

  - ### getTaskDataSource

    public DataSource getTaskDataSource()
    Description copied from interface: `TaskConfigurer`
    Retrieves the `DataSource` that will be used for task operations. If a DataSource is not being used for the implemented TaskConfigurer this method will return null.
    Specified by:
      `getTaskDataSource` in interface `TaskConfigurer`
    Returns:
      `DataSource` that will be used for task operations.

  - ### getTransactionManager

    public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
    Description copied from interface: `TaskConfigurer`
    Create a `PlatformTransactionManager` for use with the `TaskRepository`.
    Specified by:
      `getTransactionManager` in interface `TaskConfigurer`
    Returns:
      A `PlatformTransactionManager`