public class TaskClient extends Object
Constructor and Description |
---|
TaskClient(Connection conn)
Creates a new TaskClient for interacting with the task backend remotely.
|
Modifier and Type | Method and Description |
---|---|
static void |
addTaskAttributes(TaskScheduleInformation information,
Entry taskEntry)
Adds attributes related to scheduling contained in the provided
TaskScheduleInformation in the provided
task entry. |
void |
cancelTask(String taskId)
Changes that the state of the task in the backend to a canceled state.
|
static String |
getTaskDn(Entry taskEntry)
Uses provided task entry attributes to create a DN for the provided task entry.
|
List<TaskEntry> |
getTaskEntries()
Gets all the ds-task entries from the task root.
|
TaskEntry |
getTaskEntry(String taskId)
Gets the entry of the task associated to the provided identifier.
|
static String |
getTaskId(Entry taskEntry)
Returns the ID of the provided task entry.
|
TaskEntry |
schedule(TaskScheduleInformation information)
Schedule a task for execution by writing an entry to the task backend.
|
TaskEntry |
waitUntilTaskIsDone(String id,
PrintStream stream)
Wait until the task with the provided id is done.
|
public TaskClient(Connection conn)
conn
- for accessing the task backendpublic static String getTaskId(Entry taskEntry)
taskEntry
- The task Entry
.Entry
.IllegalArgumentException
- If the task ID cannot be retrieve from the provided Entry
.public static String getTaskDn(Entry taskEntry)
public static void addTaskAttributes(TaskScheduleInformation information, Entry taskEntry)
TaskScheduleInformation
in the provided
task entry.information
- The scheduling information to add.taskEntry
- The task Entry
to update.public TaskEntry waitUntilTaskIsDone(String id, PrintStream stream) throws LdapException, TaskClientException
The provided taskClient
is used for retrieving task information.
During the execution, tasks logs are printed on the provided stream
.
id
- A string representing the ID of the task to retrieve.stream
- The stream to use for printing task logs, may be null
.task entry
object representing the task done.LdapException
- If an error occurs while retrieving task information from the server.TaskClientException
- If there is no task with the requested ID.public TaskEntry schedule(TaskScheduleInformation information) throws LdapException, TaskClientException
information
- to be scheduledLdapException
- if there is a problem getting information out to the directoryTaskClientException
- if there is a problem with the task entrypublic List<TaskEntry> getTaskEntries() throws LdapException
LdapException
- if there is a problem getting information out to the directorypublic TaskEntry getTaskEntry(String taskId) throws LdapException, TaskClientException
taskId
- of the entry to retrieveLdapException
- if there is a problem getting information out to the directoryTaskClientException
- if there is no task with the requested idpublic void cancelTask(String taskId) throws TaskClientException, LdapException
taskId
- if the task to cancelLdapException
- if there is a problem getting information out to the directoryTaskClientException
- if there is no task with the requested id or if the task has finished and cannot be completedCopyright 2010-2022 ForgeRock AS.