Class TaskStoreImpl

java.lang.Object
cz.metacentrum.perun.taskslib.service.impl.TaskStoreImpl
All Implemented Interfaces:
TaskStore

public class TaskStoreImpl extends Object implements TaskStore
Implementation of TaskStore as in-memory pool.
Author:
David Šarman, Pavel Zlámal <zlamal@cesnet.cz>
See Also:
  • Constructor Details

    • TaskStoreImpl

      public TaskStoreImpl()
  • Method Details

    • addTask

      public Task addTask(Task task) throws TaskStoreException
      Description copied from interface: TaskStore
      Add Task to TaskStore.
      Specified by:
      addTask in interface TaskStore
      Parameters:
      task - Task to be added
      Returns:
      Added Task
      Throws:
      TaskStoreException - When Task can't be added because of some kind of inconsistency
    • clear

      public void clear()
      Description copied from interface: TaskStore
      Clear all Tasks from TaskStore.
      Specified by:
      clear in interface TaskStore
    • getAllTasks

      public Collection<Task> getAllTasks()
      Description copied from interface: TaskStore
      Get all Tasks present in a TaskStore.
      Specified by:
      getAllTasks in interface TaskStore
      Returns:
      All Tasks from TaskStore
    • getSize

      public int getSize()
      Description copied from interface: TaskStore
      Get current size of TaskStore (number of Tasks stored).
      Specified by:
      getSize in interface TaskStore
      Returns:
      Number of Tasks stored in a TaskStore
    • getTask

      public Task getTask(int id)
      Description copied from interface: TaskStore
      Get Task by its ID.
      Specified by:
      getTask in interface TaskStore
      Parameters:
      id - ID of Task to get
      Returns:
      Task by its ID
    • getTask

      public Task getTask(Facility facility, Service service)
      Description copied from interface: TaskStore
      Get Task by its Facility and Service.
      Specified by:
      getTask in interface TaskStore
      Parameters:
      facility - Facility to get Task for
      service - Service to get Task for
      Returns:
      Task by its Facility and Service
    • getTasksWithStatus

      public List<Task> getTasksWithStatus(Task.TaskStatus... status)
      Description copied from interface: TaskStore
      Get all Tasks which are in any of specified statuses.
      Specified by:
      getTasksWithStatus in interface TaskStore
      Parameters:
      status - Array of expected TaskStatuses
      Returns:
      All Tasks which are in any of expected statuses.
      See Also:
    • removeTask

      public Task removeTask(int id) throws TaskStoreException
      Description copied from interface: TaskStore
      Remove Task from TaskStore by its ID.
      Specified by:
      removeTask in interface TaskStore
      Parameters:
      id - ID of Task to be removed
      Returns:
      Removed Task
      Throws:
      TaskStoreException - When Task can't be removed because of some kind of inconsistency
    • removeTask

      public Task removeTask(Task task) throws TaskStoreException
      Description copied from interface: TaskStore
      Remove Task from TaskStore
      Specified by:
      removeTask in interface TaskStore
      Parameters:
      task - Task to be removed
      Returns:
      Removed Task
      Throws:
      TaskStoreException - When Task can't be removed because of some kind of inconsistency