com.xensource.xenapi
Class Task

java.lang.Object
  extended by com.xensource.xenapi.Task

public class Task
extends Object

A long-running asynchronous task


Nested Class Summary
static class Task.Record
          Represents all the fields in a Task
 
Field Summary
protected  String ref
          The XenAPI reference to this object.
 
Method Summary
 void cancel()
          Cancel this task.
static Set<Task> getAll()
          Return a list of all the tasks known to the system.
static Map<Task,Task.Record> getAllRecords()
          Get all the Task Records at once, in a single XML RPC call
static Set<Task> getByNameLabel(String label)
          Get all the task instances with the given label.
static Task getByUuid(String uuid)
          Get a reference to the task instance with the specified UUID.
 Set<String> getErrorInfo()
          Get the error_info field of the given task.
protected static Task getInstFromRef(String ref)
           
 String getNameDescription()
          Get the name/description field of the given task.
 String getNameLabel()
          Get the name/label field of the given task.
 Double getProgress()
          Get the progress field of the given task.
 Task.Record getRecord()
          Get a record containing the current state of the given task.
 Host getResidentOn()
          Get the resident_on field of the given task.
 String getResult()
          Get the result field of the given task.
 Session getSession()
          Get the session field of the given task.
 com.xensource.xenapi.Types.TaskStatusType getStatus()
          Get the status field of the given task.
 String getType()
          Get the type field of the given task.
 String getUuid()
          Get the uuid field of the given task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected final String ref
The XenAPI reference to this object.

Method Detail

getInstFromRef

protected static Task getInstFromRef(String ref)

getRecord

public Task.Record getRecord()
                      throws Types.BadServerResponse,
                             ConnectionHelper.NoConnectionOnThisThreadException,
                             XmlRpcException
Get a record containing the current state of the given task.

Returns:
all fields from the object
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getByUuid

public static Task getByUuid(String uuid)
                      throws Types.BadServerResponse,
                             ConnectionHelper.NoConnectionOnThisThreadException,
                             XmlRpcException
Get a reference to the task instance with the specified UUID.

Parameters:
uuid - UUID of object to return
Returns:
reference to the object
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getByNameLabel

public static Set<Task> getByNameLabel(String label)
                                throws Types.BadServerResponse,
                                       ConnectionHelper.NoConnectionOnThisThreadException,
                                       XmlRpcException
Get all the task instances with the given label.

Parameters:
label - label of object to return
Returns:
references to objects with matching names
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getUuid

public String getUuid()
               throws Types.BadServerResponse,
                      ConnectionHelper.NoConnectionOnThisThreadException,
                      XmlRpcException
Get the uuid field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getNameLabel

public String getNameLabel()
                    throws Types.BadServerResponse,
                           ConnectionHelper.NoConnectionOnThisThreadException,
                           XmlRpcException
Get the name/label field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getNameDescription

public String getNameDescription()
                          throws Types.BadServerResponse,
                                 ConnectionHelper.NoConnectionOnThisThreadException,
                                 XmlRpcException
Get the name/description field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getStatus

public com.xensource.xenapi.Types.TaskStatusType getStatus()
                                                    throws Types.BadServerResponse,
                                                           ConnectionHelper.NoConnectionOnThisThreadException,
                                                           XmlRpcException
Get the status field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getSession

public Session getSession()
                   throws Types.BadServerResponse,
                          ConnectionHelper.NoConnectionOnThisThreadException,
                          XmlRpcException
Get the session field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getResidentOn

public Host getResidentOn()
                   throws Types.BadServerResponse,
                          ConnectionHelper.NoConnectionOnThisThreadException,
                          XmlRpcException
Get the resident_on field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getProgress

public Double getProgress()
                   throws Types.BadServerResponse,
                          ConnectionHelper.NoConnectionOnThisThreadException,
                          XmlRpcException
Get the progress field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getType

public String getType()
               throws Types.BadServerResponse,
                      ConnectionHelper.NoConnectionOnThisThreadException,
                      XmlRpcException
Get the type field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getResult

public String getResult()
                 throws Types.BadServerResponse,
                        ConnectionHelper.NoConnectionOnThisThreadException,
                        XmlRpcException
Get the result field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getErrorInfo

public Set<String> getErrorInfo()
                         throws Types.BadServerResponse,
                                ConnectionHelper.NoConnectionOnThisThreadException,
                                XmlRpcException
Get the error_info field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

cancel

public void cancel()
            throws Types.BadServerResponse,
                   ConnectionHelper.NoConnectionOnThisThreadException,
                   XmlRpcException,
                   Types.OperationNotAllowed
Cancel this task. If task.allowed_operations does not contain Cancel, then this will fail with OPERATION_NOT_ALLOWED. The task will show the status 'cancelling', and you should continue to check its status until it shows 'cancelled'. There is no guarantee as to the time within which this task will be cancelled.

Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException
Types.OperationNotAllowed

getAll

public static Set<Task> getAll()
                        throws Types.BadServerResponse,
                               ConnectionHelper.NoConnectionOnThisThreadException,
                               XmlRpcException
Return a list of all the tasks known to the system.

Returns:
references to all objects
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getAllRecords

public static Map<Task,Task.Record> getAllRecords()
                                           throws Types.BadServerResponse,
                                                  ConnectionHelper.NoConnectionOnThisThreadException,
                                                  XmlRpcException
Get all the Task Records at once, in a single XML RPC call

Returns:
A map from Task to Task.Record
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException