Package org.wso2.carbon.ntask.core.impl
Class FileBasedTaskRepository
- java.lang.Object
-
- org.wso2.carbon.ntask.core.impl.FileBasedTaskRepository
-
- All Implemented Interfaces:
TaskRepository
public class FileBasedTaskRepository extends Object implements TaskRepository
Files based task repository implementation.
-
-
Constructor Summary
Constructors Constructor Description FileBasedTaskRepository(int tenantId, String taskType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTask(TaskInfo taskInfo)
Adds given task information to the repository.boolean
deleteTask(String taskName)
Deletes existing task information from the repository.List<TaskInfo>
getAllTasks()
Returns all the task information data in the repository.static List<TaskManagerId>
getAllTenantTaskManagersForType(String taskType)
TaskInfo
getTask(String taskName)
Returns task information of a given task nameString
getTaskMetadataProp(String taskName, String key)
Returns the task metadata property value, if the task does not exist, this will return null.String
getTasksType()
Returns the type of the tasks represented by this task manager.int
getTenantId()
Returns the tenant domain of the tasks represented by this task manager.void
setTaskMetadataProp(String taskName, String key, String value)
Sets a task metadata property to a given task name with a given property key.
-
-
-
Constructor Detail
-
FileBasedTaskRepository
public FileBasedTaskRepository(int tenantId, String taskType)
-
-
Method Detail
-
getAllTasks
public List<TaskInfo> getAllTasks() throws org.wso2.carbon.ntask.common.TaskException
Description copied from interface:TaskRepository
Returns all the task information data in the repository.- Specified by:
getAllTasks
in interfaceTaskRepository
- Returns:
- A list of TaskInfo objects
- Throws:
org.wso2.carbon.ntask.common.TaskException
-
getTask
public TaskInfo getTask(String taskName) throws org.wso2.carbon.ntask.common.TaskException
Description copied from interface:TaskRepository
Returns task information of a given task name- Specified by:
getTask
in interfaceTaskRepository
- Parameters:
taskName
- The task name- Returns:
- The task information object
- Throws:
org.wso2.carbon.ntask.common.TaskException
- if the task cannot be found
-
getAllTenantTaskManagersForType
public static List<TaskManagerId> getAllTenantTaskManagersForType(String taskType) throws org.wso2.carbon.ntask.common.TaskException
- Throws:
org.wso2.carbon.ntask.common.TaskException
-
addTask
public void addTask(TaskInfo taskInfo) throws org.wso2.carbon.ntask.common.TaskException
Description copied from interface:TaskRepository
Adds given task information to the repository.- Specified by:
addTask
in interfaceTaskRepository
- Parameters:
taskInfo
- The task information object- Throws:
org.wso2.carbon.ntask.common.TaskException
-
deleteTask
public boolean deleteTask(String taskName) throws org.wso2.carbon.ntask.common.TaskException
Description copied from interface:TaskRepository
Deletes existing task information from the repository.- Specified by:
deleteTask
in interfaceTaskRepository
- Parameters:
taskName
- The task name- Returns:
- true if the task was found and deleted
- Throws:
org.wso2.carbon.ntask.common.TaskException
-
getTasksType
public String getTasksType()
Description copied from interface:TaskRepository
Returns the type of the tasks represented by this task manager.- Specified by:
getTasksType
in interfaceTaskRepository
- Returns:
- The type of the tasks
-
getTenantId
public int getTenantId()
Description copied from interface:TaskRepository
Returns the tenant domain of the tasks represented by this task manager.- Specified by:
getTenantId
in interfaceTaskRepository
- Returns:
- The tenant domain of the tasks
-
setTaskMetadataProp
public void setTaskMetadataProp(String taskName, String key, String value) throws org.wso2.carbon.ntask.common.TaskException
Description copied from interface:TaskRepository
Sets a task metadata property to a given task name with a given property key.- Specified by:
setTaskMetadataProp
in interfaceTaskRepository
- Parameters:
taskName
- The name of the task the metadata property to be assigned tokey
- The key of the metadata propertyvalue
- The value of the metadata property- Throws:
org.wso2.carbon.ntask.common.TaskException
-
getTaskMetadataProp
public String getTaskMetadataProp(String taskName, String key) throws org.wso2.carbon.ntask.common.TaskException
Description copied from interface:TaskRepository
Returns the task metadata property value, if the task does not exist, this will return null.- Specified by:
getTaskMetadataProp
in interfaceTaskRepository
- Parameters:
taskName
- The name of the task to retrieve the metadata property fromkey
- The key of the metadata propery- Returns:
- The metadata property value
- Throws:
org.wso2.carbon.ntask.common.TaskException
-
-