Package org.springframework.cloud.task.repository.support

# Class SimpleTaskRepository

java.lang.Object
org.springframework.cloud.task.repository.support.SimpleTaskRepository

All Implemented Interfaces:
  `TaskRepository`

public class SimpleTaskRepository extends Object implements TaskRepository
Records the task execution information to the log and to TaskExecutionDao provided.

Author:
  Glenn Renfro

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `MAX_ERROR_MESSAGE_SIZE`
  Default max error message size.
  `static final int`
  `MAX_EXIT_MESSAGE_SIZE`
  Default max exit message size.
  `static final int`
  `MAX_TASK_NAME_SIZE`
  Default max task name size.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SimpleTaskRepository(org.springframework.beans.factory.FactoryBean<TaskExecutionDao> taskExecutionDaoFactoryBean)`
  `SimpleTaskRepository(org.springframework.beans.factory.FactoryBean<TaskExecutionDao> taskExecutionDaoFactoryBean, Integer maxExitMessageSize, Integer maxTaskNameSize, Integer maxErrorMessageSize)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `TaskExecution`
  `completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage)`
  Notifies the repository that a taskExecution has completed.
  `TaskExecution`
  `completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage, String errorMessage)`
  Notifies the repository that a taskExecution has completed.
  `TaskExecution`
  `createTaskExecution()`
  Creates an empty TaskExecution with just an id provided.
  `TaskExecution`
  `createTaskExecution(String name)`
  Creates an empty TaskExecution with just an id and name provided.
  `TaskExecution`
  `createTaskExecution(TaskExecution taskExecution)`
  Notifies the repository that a taskExecution needs to be created.
  `TaskExecutionDao`
  `getTaskExecutionDao()`
  Retrieves the taskExecutionDao associated with this repository.
  `void`
  `setMaxErrorMessageSize(int maxErrorMessageSize)`
  `void`
  `setMaxExitMessageSize(int maxExitMessageSize)`
  `void`
  `setMaxTaskNameSize(int maxTaskNameSize)`
  `TaskExecution`
  `startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments, String externalExecutionId)`
  Notifies the repository that a taskExecution has has started.
  `TaskExecution`
  `startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId)`
  Notifies the repository that a taskExecution has has started.
  `void`
  `updateExternalExecutionId(long executionid, String externalExecutionId)`
  Notifies the repository to update the taskExecution's externalExecutionId.

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

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

- ## Field Details

  - ### MAX_EXIT_MESSAGE_SIZE

    public static final int MAX_EXIT_MESSAGE_SIZE
    Default max exit message size.
    See Also:
      - Constant Field Values

  - ### MAX_TASK_NAME_SIZE

    public static final int MAX_TASK_NAME_SIZE
    Default max task name size.
    See Also:
      - Constant Field Values

  - ### MAX_ERROR_MESSAGE_SIZE

    public static final int MAX_ERROR_MESSAGE_SIZE
    Default max error message size.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SimpleTaskRepository

    public SimpleTaskRepository(org.springframework.beans.factory.FactoryBean<TaskExecutionDao> taskExecutionDaoFactoryBean)

  - ### SimpleTaskRepository

    public SimpleTaskRepository(org.springframework.beans.factory.FactoryBean<TaskExecutionDao> taskExecutionDaoFactoryBean, Integer maxExitMessageSize, Integer maxTaskNameSize, Integer maxErrorMessageSize)

- ## Method Details

  - ### completeTaskExecution

    public TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage)
    Description copied from interface: `TaskRepository`
    Notifies the repository that a taskExecution has completed.
    Specified by:
      `completeTaskExecution` in interface `TaskRepository`
    Parameters:
      `executionId` - to the task execution to be updated.
      `exitCode` - to be stored for this task.
      `endTime` - designated when the task completed.
      `exitMessage` - to be stored for the task.
    Returns:
      the updated `TaskExecution`

  - ### completeTaskExecution

    public TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage, String errorMessage)
    Description copied from interface: `TaskRepository`
    Notifies the repository that a taskExecution has completed.
    Specified by:
      `completeTaskExecution` in interface `TaskRepository`
    Parameters:
      `executionId` - to the task execution to be updated.
      `exitCode` - to be stored for this task execution.
      `endTime` - designated when the task completed.
      `exitMessage` - to be stored for the task execution.
      `errorMessage` - to be stored for the task execution.
    Returns:
      the updated `TaskExecution`

  - ### createTaskExecution

    public TaskExecution createTaskExecution(TaskExecution taskExecution)
    Description copied from interface: `TaskRepository`
    Notifies the repository that a taskExecution needs to be created.
    Specified by:
      `createTaskExecution` in interface `TaskRepository`
    Parameters:
      `taskExecution` - a TaskExecution instance containing the startTime, arguments and externalExecutionId that will be stored in the repository. Only the values enumerated above will be stored for this TaskExecution.
    Returns:
      the `TaskExecution` that was stored in the repository. The TaskExecution's taskExecutionId will also contain the id that was used to store the TaskExecution.

  - ### createTaskExecution

    public TaskExecution createTaskExecution(String name)
    Description copied from interface: `TaskRepository`
    Creates an empty TaskExecution with just an id and name provided. This is intended to be utilized in systems where the request of launching a task is separate from the actual start of a task (the underlying system may need to deploy the task prior to launching, etc).
    Specified by:
      `createTaskExecution` in interface `TaskRepository`
    Parameters:
      `name` - task name to be associated with the task execution.
    Returns:
      the initial `TaskExecution`

  - ### createTaskExecution

    public TaskExecution createTaskExecution()
    Description copied from interface: `TaskRepository`
    Creates an empty TaskExecution with just an id provided. This is intended to be utilized in systems where the request of launching a task is separate from the actual start of a task (the underlying system may need to deploy the task prior to launching, etc).
    Specified by:
      `createTaskExecution` in interface `TaskRepository`
    Returns:
      the initial `TaskExecution`

  - ### startTaskExecution

    public TaskExecution startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments, String externalExecutionId)
    Description copied from interface: `TaskRepository`
    Notifies the repository that a taskExecution has has started.
    Specified by:
      `startTaskExecution` in interface `TaskRepository`
    Parameters:
      `executionid` - to the task execution to be updated.
      `taskName` - the name that associated with the task execution.
      `startTime` - the time task began.
      `arguments` - list of key/value pairs that configure the task.
      `externalExecutionId` - id assigned to the task by the platform.
    Returns:
      TaskExecution created based on the parameters.

  - ### updateExternalExecutionId

    public void updateExternalExecutionId(long executionid, String externalExecutionId)
    Description copied from interface: `TaskRepository`
    Notifies the repository to update the taskExecution's externalExecutionId.
    Specified by:
      `updateExternalExecutionId` in interface `TaskRepository`
    Parameters:
      `executionid` - to the task execution to be updated.
      `externalExecutionId` - id assigned to the task by the platform.

  - ### startTaskExecution

    public TaskExecution startTaskExecution(long executionid, String taskName, Date startTime, List<String> arguments, String externalExecutionId, Long parentExecutionId)
    Description copied from interface: `TaskRepository`
    Notifies the repository that a taskExecution has has started.
    Specified by:
      `startTaskExecution` in interface `TaskRepository`
    Parameters:
      `executionid` - to the task execution to be updated.
      `taskName` - the name that associated with the task execution.
      `startTime` - the time task began.
      `arguments` - list of key/value pairs that configure the task.
      `externalExecutionId` - id assigned to the task by the platform.
      `parentExecutionId` - the parent task execution id.
    Returns:
      A TaskExecution that contains the information available at the beginning of a TaskExecution.

  - ### getTaskExecutionDao

    public TaskExecutionDao getTaskExecutionDao()
    Retrieves the taskExecutionDao associated with this repository.
    Returns:
      the taskExecutionDao

  - ### setMaxExitMessageSize

    public void setMaxExitMessageSize(int maxExitMessageSize)

  - ### setMaxTaskNameSize

    public void setMaxTaskNameSize(int maxTaskNameSize)

  - ### setMaxErrorMessageSize

    public void setMaxErrorMessageSize(int maxErrorMessageSize)