public class MetadataTaskStorage extends Object implements TaskStorage
| Constructor and Description | 
|---|
MetadataTaskStorage(MetadataStorageConnector metadataStorageConnector,
                   TaskStorageConfig config,
                   MetadataStorageActionHandlerFactory factory)  | 
| Modifier and Type | Method and Description | 
|---|---|
<T> void | 
addAuditLog(Task task,
           TaskAction<T> taskAction)
Add an action taken by a task to the audit log. 
 | 
void | 
addLock(String taskid,
       TaskLock taskLock)
Persists lock state in the storage facility. 
 | 
List<Task> | 
getActiveTasks()
Returns a list of currently running or pending tasks as stored in the storage facility. 
 | 
List<TaskAction> | 
getAuditLogs(String taskId)
Returns all actions taken by a task. 
 | 
Pair<org.joda.time.DateTime,String> | 
getCreatedDateTimeAndDataSource(String taskId)  | 
List<TaskLock> | 
getLocks(String taskid)
Returns a list of locks for a particular task. 
 | 
List<TaskStatus> | 
getRecentlyFinishedTaskStatuses(Integer maxTaskStatuses)
Returns up to  
maxTaskStatuses statuses of recently finished tasks as stored in the storage facility. | 
com.google.common.base.Optional<TaskStatus> | 
getStatus(String taskId)
Returns task status as stored in the storage facility. 
 | 
com.google.common.base.Optional<Task> | 
getTask(String taskId)
Returns task as stored in the storage facility. 
 | 
void | 
insert(Task task,
      TaskStatus status)
Adds a task to the storage facility with a particular status. 
 | 
void | 
removeLock(String taskid,
          TaskLock taskLockToRemove)
Removes lock state from the storage facility. 
 | 
void | 
replaceLock(String taskid,
           TaskLock oldLock,
           TaskLock newLock)
Replace the old lock with the new lock. 
 | 
void | 
setStatus(TaskStatus status)
Persists task status in the storage facility. 
 | 
void | 
start()  | 
void | 
stop()  | 
@Inject public MetadataTaskStorage(MetadataStorageConnector metadataStorageConnector, TaskStorageConfig config, MetadataStorageActionHandlerFactory factory)
public void start()
public void stop()
public void insert(Task task, TaskStatus status) throws EntryExistsException
TaskStorageinsert in interface TaskStoragetask - task to addstatus - task statusEntryExistsException - if the task ID already existspublic void setStatus(TaskStatus status)
TaskStoragesetStatus in interface TaskStoragestatus - task statuspublic com.google.common.base.Optional<Task> getTask(String taskId)
TaskStorageTaskStorage.getStatus(java.lang.String).  Expect that in the future.getTask in interface TaskStoragetaskId - task IDpublic com.google.common.base.Optional<TaskStatus> getStatus(String taskId)
TaskStoragegetStatus in interface TaskStoragetaskId - task IDpublic List<Task> getActiveTasks()
TaskStoragegetActiveTasks in interface TaskStoragepublic List<TaskStatus> getRecentlyFinishedTaskStatuses(@Nullable Integer maxTaskStatuses)
TaskStoragemaxTaskStatuses statuses of recently finished tasks as stored in the storage facility. No
 particular order is guaranteed, but implementations are encouraged to return tasks in descending order of creation.
 No particular standard of "recent" is guaranteed, and in fact, this method is permitted to simply return nothing.getRecentlyFinishedTaskStatuses in interface TaskStorage@Nullable public Pair<org.joda.time.DateTime,String> getCreatedDateTimeAndDataSource(String taskId)
getCreatedDateTimeAndDataSource in interface TaskStoragepublic void addLock(String taskid, TaskLock taskLock)
TaskStorageaddLock in interface TaskStoragetaskid - task IDtaskLock - lock statepublic void replaceLock(String taskid, TaskLock oldLock, TaskLock newLock)
TaskStoragereplaceLock in interface TaskStoragetaskid - an id of the task holding the old lock and new lockoldLock - old locknewLock - new lockpublic void removeLock(String taskid, TaskLock taskLockToRemove)
TaskStorageremoveLock in interface TaskStoragetaskid - task IDtaskLockToRemove - lock statepublic List<TaskLock> getLocks(String taskid)
TaskStoragegetLocks in interface TaskStoragetaskid - task IDpublic <T> void addAuditLog(Task task, TaskAction<T> taskAction)
TaskStorageaddAuditLog in interface TaskStorageT - task action return typetask - task to record action fortaskAction - task action to recordpublic List<TaskAction> getAuditLogs(String taskId)
TaskStoragegetAuditLogs in interface TaskStoragetaskId - task IDCopyright © 2011–2018. All rights reserved.