Package org.opends.server.tools.tasks
Class TaskClient
- java.lang.Object
-
- org.opends.server.tools.tasks.TaskClient
-
public class TaskClient extends Object
Helper class for interacting with the task backend on behalf of utilities that are capable of being scheduled.
-
-
Constructor Summary
Constructors Constructor Description TaskClient(LDAPConnection conn)Creates a new TaskClient for interacting with the task backend remotely.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelTask(String id)Changes that the state of the task in the backend to a canceled state.static ArrayList<RawAttribute>getTaskAttributes(TaskScheduleInformation information)This is a commodity method that returns the common attributes (those related to scheduling) of a task entry for a givenTaskScheduleInformationobject.static StringgetTaskDN(List<RawAttribute> taskAttributes)Returns the DN of the task entry for a given list of task attributes.List<TaskEntry>getTaskEntries()Gets all the ds-task entries from the task root.TaskEntrygetTaskEntry(String id)Gets the entry of the task whose ID isidfrom the directory.static StringgetTaskID(List<RawAttribute> taskAttributes)Returns the ID of the task entry for a given list of task attributes.TaskEntryschedule(TaskScheduleInformation information)Schedule a task for execution by writing an entry to the task backend.
-
-
-
Constructor Detail
-
TaskClient
public TaskClient(LDAPConnection conn)
Creates a new TaskClient for interacting with the task backend remotely.- Parameters:
conn- for accessing the task backend
-
-
Method Detail
-
getTaskID
public static String getTaskID(List<RawAttribute> taskAttributes)
Returns the ID of the task entry for a given list of task attributes.- Parameters:
taskAttributes- the task attributes.- Returns:
- the ID of the task entry for a given list of task attributes.
-
getTaskDN
public static String getTaskDN(List<RawAttribute> taskAttributes)
Returns the DN of the task entry for a given list of task attributes.- Parameters:
taskAttributes- the task attributes.- Returns:
- the DN of the task entry for a given list of task attributes.
-
getTaskAttributes
public static ArrayList<RawAttribute> getTaskAttributes(TaskScheduleInformation information)
This is a commodity method that returns the common attributes (those related to scheduling) of a task entry for a givenTaskScheduleInformationobject.- Parameters:
information- the scheduling information.- Returns:
- the schedule attributes of the task entry.
-
schedule
public TaskEntry schedule(TaskScheduleInformation information) throws LDAPException, IOException, DecodeException, TaskClientException
Schedule a task for execution by writing an entry to the task backend.- Parameters:
information- to be scheduled- Returns:
- String task ID assigned the new task
- Throws:
IOException- if there is a stream communication problemLDAPException- if there is a problem getting information out to the directoryDecodeException- if there is a problem with the encodingTaskClientException- if there is a problem with the task entry
-
getTaskEntries
public List<TaskEntry> getTaskEntries() throws LDAPException, IOException, DecodeException
Gets all the ds-task entries from the task root.- Returns:
- list of entries from the task root
- Throws:
IOException- if there is a stream communication problemLDAPException- if there is a problem getting information out to the directoryDecodeException- if there is a problem with the encoding
-
getTaskEntry
public TaskEntry getTaskEntry(String id) throws LDAPException, IOException, DecodeException, TaskClientException
Gets the entry of the task whose ID isidfrom the directory.- Parameters:
id- of the entry to retrieve- Returns:
- Entry for the task
- Throws:
IOException- if there is a stream communication problemLDAPException- if there is a problem getting information out to the directoryDecodeException- if there is a problem with the encodingTaskClientException- if there is no task with the requested id
-
cancelTask
public void cancelTask(String id) throws TaskClientException, IOException, DecodeException, LDAPException
Changes that the state of the task in the backend to a canceled state.- Parameters:
id- if the task to cancel- Throws:
IOException- if there is a stream communication problemLDAPException- if there is a problem getting information out to the directoryDecodeException- if there is a problem with the encodingTaskClientException- if there is no task with the requested id
-
-