org.opends.server.tools.tasks
Class TaskClient

java.lang.Object
  extended by org.opends.server.tools.tasks.TaskClient

public class TaskClient
extends java.lang.Object

Helper class for interacting with the task backend on behalf of utilities that are capable of being scheduled.


Field Summary
protected  LDAPConnection connection
          Connection through which task scheduling will take place.
 
Constructor Summary
TaskClient(LDAPConnection conn)
          Creates a new TaskClient for interacting with the task backend remotely.
 
Method Summary
 TaskEntry cancelTask(java.lang.String id)
          Changes that the state of the task in the backend to a canceled state.
 java.util.List<TaskEntry> getTaskEntries()
          Gets all the ds-task entries from the task root.
 TaskEntry getTaskEntry(java.lang.String id)
          Gets the entry of the task whose ID is id from the directory.
 TaskEntry schedule(TaskScheduleInformation information)
          Schedule a task for execution by writing an entry to the task backend.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected LDAPConnection connection
Connection through which task scheduling will take place.

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

schedule

public TaskEntry schedule(TaskScheduleInformation information)
                   throws LDAPException,
                          java.io.IOException,
                          ASN1Exception,
                          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:
java.io.IOException - if there is a stream communication problem
LDAPException - if there is a problem getting information out to the directory
ASN1Exception - if there is a problem with the encoding
TaskClientException - if there is a problem with the task entry

getTaskEntries

public java.util.List<TaskEntry> getTaskEntries()
                                         throws LDAPException,
                                                java.io.IOException,
                                                ASN1Exception
Gets all the ds-task entries from the task root.

Returns:
list of entries from the task root
Throws:
java.io.IOException - if there is a stream communication problem
LDAPException - if there is a problem getting information out to the directory
ASN1Exception - if there is a problem with the encoding

getTaskEntry

public TaskEntry getTaskEntry(java.lang.String id)
                       throws LDAPException,
                              java.io.IOException,
                              ASN1Exception,
                              TaskClientException
Gets the entry of the task whose ID is id from the directory.

Parameters:
id - of the entry to retrieve
Returns:
Entry for the task
Throws:
java.io.IOException - if there is a stream communication problem
LDAPException - if there is a problem getting information out to the directory
ASN1Exception - if there is a problem with the encoding
TaskClientException - if there is no task with the requested id

cancelTask

public TaskEntry cancelTask(java.lang.String id)
                     throws TaskClientException,
                            java.io.IOException,
                            ASN1Exception,
                            LDAPException
Changes that the state of the task in the backend to a canceled state.

Parameters:
id - if the task to cancel
Returns:
Entry of the task before the modification
Throws:
java.io.IOException - if there is a stream communication problem
LDAPException - if there is a problem getting information out to the directory
ASN1Exception - if there is a problem with the encoding
TaskClientException - if there is no task with the requested id