com.xensource.xenapi
Class Task

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

public class Task
extends XenAPIObject

A long-running asynchronous task


Nested Class Summary
static class Task.Record
          Represents all the fields in a Task
 
Field Summary
protected  java.lang.String ref
          The XenAPI reference to this object.
 
Method Summary
 void addToOtherConfig(Connection c, java.lang.String key, java.lang.String value)
          Add the given key-value pair to the other_config field of the given task.
 void cancel(Connection c)
          Request that a task be cancelled.
 Task cancelAsync(Connection c)
          Request that a task be cancelled.
static Task create(Connection c, java.lang.String label, java.lang.String description)
          Create a new task object which must be manually destroyed.
 void destroy(Connection c)
          Destroy the task object
 boolean equals(java.lang.Object obj)
          If obj is a Task, compares XenAPI references for equality.
static java.util.Set<Task> getAll(Connection c)
          Return a list of all the tasks known to the system.
 java.util.Set<Types.TaskAllowedOperations> getAllowedOperations(Connection c)
          Get the allowed_operations field of the given task.
static java.util.Map<Task,Task.Record> getAllRecords(Connection c)
          Return a map of task references to task records for all tasks known to the system.
static java.util.Set<Task> getByNameLabel(Connection c, java.lang.String label)
          Get all the task instances with the given label.
static Task getByUuid(Connection c, java.lang.String uuid)
          Get a reference to the task instance with the specified UUID.
 java.util.Date getCreated(Connection c)
          Get the created field of the given task.
 java.util.Map<java.lang.String,Types.TaskAllowedOperations> getCurrentOperations(Connection c)
          Get the current_operations field of the given task.
 java.util.Set<java.lang.String> getErrorInfo(Connection c)
          Get the error_info field of the given task.
 java.util.Date getFinished(Connection c)
          Get the finished field of the given task.
 java.lang.String getNameDescription(Connection c)
          Get the name/description field of the given task.
 java.lang.String getNameLabel(Connection c)
          Get the name/label field of the given task.
 java.util.Map<java.lang.String,java.lang.String> getOtherConfig(Connection c)
          Get the other_config field of the given task.
 java.lang.Double getProgress(Connection c)
          Get the progress field of the given task.
 Task.Record getRecord(Connection c)
          Get a record containing the current state of the given task.
 Host getResidentOn(Connection c)
          Get the resident_on field of the given task.
 java.lang.String getResult(Connection c)
          Get the result field of the given task.
 Types.TaskStatusType getStatus(Connection c)
          Get the status field of the given task.
 Task getSubtaskOf(Connection c)
          Get the subtask_of field of the given task.
 java.util.Set<Task> getSubtasks(Connection c)
          Get the subtasks field of the given task.
 java.lang.String getType(Connection c)
          Get the type field of the given task.
 java.lang.String getUuid(Connection c)
          Get the uuid field of the given task.
 int hashCode()
           
 void removeFromOtherConfig(Connection c, java.lang.String key)
          Remove the given key and its corresponding value from the other_config field of the given task.
 void setOtherConfig(Connection c, java.util.Map<java.lang.String,java.lang.String> otherConfig)
          Set the other_config field of the given task.
 java.lang.String toWireString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected final java.lang.String ref
The XenAPI reference to this object.

Method Detail

toWireString

public java.lang.String toWireString()
Specified by:
toWireString in class XenAPIObject

equals

public boolean equals(java.lang.Object obj)
If obj is a Task, compares XenAPI references for equality.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getRecord

public Task.Record getRecord(Connection c)
                      throws Types.BadServerResponse,
                             Types.XenAPIException,
                             org.apache.xmlrpc.XmlRpcException
Get a record containing the current state of the given task.

Returns:
all fields from the object
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getByUuid

public static Task getByUuid(Connection c,
                             java.lang.String uuid)
                      throws Types.BadServerResponse,
                             Types.XenAPIException,
                             org.apache.xmlrpc.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
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getByNameLabel

public static java.util.Set<Task> getByNameLabel(Connection c,
                                                 java.lang.String label)
                                          throws Types.BadServerResponse,
                                                 Types.XenAPIException,
                                                 org.apache.xmlrpc.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
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getUuid

public java.lang.String getUuid(Connection c)
                         throws Types.BadServerResponse,
                                Types.XenAPIException,
                                org.apache.xmlrpc.XmlRpcException
Get the uuid field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getNameLabel

public java.lang.String getNameLabel(Connection c)
                              throws Types.BadServerResponse,
                                     Types.XenAPIException,
                                     org.apache.xmlrpc.XmlRpcException
Get the name/label field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getNameDescription

public java.lang.String getNameDescription(Connection c)
                                    throws Types.BadServerResponse,
                                           Types.XenAPIException,
                                           org.apache.xmlrpc.XmlRpcException
Get the name/description field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getAllowedOperations

public java.util.Set<Types.TaskAllowedOperations> getAllowedOperations(Connection c)
                                                                throws Types.BadServerResponse,
                                                                       Types.XenAPIException,
                                                                       org.apache.xmlrpc.XmlRpcException
Get the allowed_operations field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getCurrentOperations

public java.util.Map<java.lang.String,Types.TaskAllowedOperations> getCurrentOperations(Connection c)
                                                                                 throws Types.BadServerResponse,
                                                                                        Types.XenAPIException,
                                                                                        org.apache.xmlrpc.XmlRpcException
Get the current_operations field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getCreated

public java.util.Date getCreated(Connection c)
                          throws Types.BadServerResponse,
                                 Types.XenAPIException,
                                 org.apache.xmlrpc.XmlRpcException
Get the created field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getFinished

public java.util.Date getFinished(Connection c)
                           throws Types.BadServerResponse,
                                  Types.XenAPIException,
                                  org.apache.xmlrpc.XmlRpcException
Get the finished field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getStatus

public Types.TaskStatusType getStatus(Connection c)
                               throws Types.BadServerResponse,
                                      Types.XenAPIException,
                                      org.apache.xmlrpc.XmlRpcException
Get the status field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getResidentOn

public Host getResidentOn(Connection c)
                   throws Types.BadServerResponse,
                          Types.XenAPIException,
                          org.apache.xmlrpc.XmlRpcException
Get the resident_on field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getProgress

public java.lang.Double getProgress(Connection c)
                             throws Types.BadServerResponse,
                                    Types.XenAPIException,
                                    org.apache.xmlrpc.XmlRpcException
Get the progress field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getType

public java.lang.String getType(Connection c)
                         throws Types.BadServerResponse,
                                Types.XenAPIException,
                                org.apache.xmlrpc.XmlRpcException
Get the type field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getResult

public java.lang.String getResult(Connection c)
                           throws Types.BadServerResponse,
                                  Types.XenAPIException,
                                  org.apache.xmlrpc.XmlRpcException
Get the result field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getErrorInfo

public java.util.Set<java.lang.String> getErrorInfo(Connection c)
                                             throws Types.BadServerResponse,
                                                    Types.XenAPIException,
                                                    org.apache.xmlrpc.XmlRpcException
Get the error_info field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getOtherConfig

public java.util.Map<java.lang.String,java.lang.String> getOtherConfig(Connection c)
                                                                throws Types.BadServerResponse,
                                                                       Types.XenAPIException,
                                                                       org.apache.xmlrpc.XmlRpcException
Get the other_config field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getSubtaskOf

public Task getSubtaskOf(Connection c)
                  throws Types.BadServerResponse,
                         Types.XenAPIException,
                         org.apache.xmlrpc.XmlRpcException
Get the subtask_of field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getSubtasks

public java.util.Set<Task> getSubtasks(Connection c)
                                throws Types.BadServerResponse,
                                       Types.XenAPIException,
                                       org.apache.xmlrpc.XmlRpcException
Get the subtasks field of the given task.

Returns:
value of the field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

setOtherConfig

public void setOtherConfig(Connection c,
                           java.util.Map<java.lang.String,java.lang.String> otherConfig)
                    throws Types.BadServerResponse,
                           Types.XenAPIException,
                           org.apache.xmlrpc.XmlRpcException
Set the other_config field of the given task.

Parameters:
otherConfig - New value to set
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

addToOtherConfig

public void addToOtherConfig(Connection c,
                             java.lang.String key,
                             java.lang.String value)
                      throws Types.BadServerResponse,
                             Types.XenAPIException,
                             org.apache.xmlrpc.XmlRpcException
Add the given key-value pair to the other_config field of the given task.

Parameters:
key - Key to add
value - Value to add
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

removeFromOtherConfig

public void removeFromOtherConfig(Connection c,
                                  java.lang.String key)
                           throws Types.BadServerResponse,
                                  Types.XenAPIException,
                                  org.apache.xmlrpc.XmlRpcException
Remove the given key and its corresponding value from the other_config field of the given task. If the key is not in that Map, then do nothing.

Parameters:
key - Key to remove
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

create

public static Task create(Connection c,
                          java.lang.String label,
                          java.lang.String description)
                   throws Types.BadServerResponse,
                          Types.XenAPIException,
                          org.apache.xmlrpc.XmlRpcException
Create a new task object which must be manually destroyed.

Parameters:
label - short label for the new task
description - longer description for the new task
Returns:
The reference of the created task object
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

destroy

public void destroy(Connection c)
             throws Types.BadServerResponse,
                    Types.XenAPIException,
                    org.apache.xmlrpc.XmlRpcException
Destroy the task object

Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

cancelAsync

public Task cancelAsync(Connection c)
                 throws Types.BadServerResponse,
                        Types.XenAPIException,
                        org.apache.xmlrpc.XmlRpcException,
                        Types.OperationNotAllowed
Request that a task be cancelled. Note that a task may fail to be cancelled and may complete or fail normally and note that, even when a task does cancel, it might take an arbitrary amount of time.

Returns:
Task
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException
Types.OperationNotAllowed

cancel

public void cancel(Connection c)
            throws Types.BadServerResponse,
                   Types.XenAPIException,
                   org.apache.xmlrpc.XmlRpcException,
                   Types.OperationNotAllowed
Request that a task be cancelled. Note that a task may fail to be cancelled and may complete or fail normally and note that, even when a task does cancel, it might take an arbitrary amount of time.

Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException
Types.OperationNotAllowed

getAll

public static java.util.Set<Task> getAll(Connection c)
                                  throws Types.BadServerResponse,
                                         Types.XenAPIException,
                                         org.apache.xmlrpc.XmlRpcException
Return a list of all the tasks known to the system.

Returns:
references to all objects
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getAllRecords

public static java.util.Map<Task,Task.Record> getAllRecords(Connection c)
                                                     throws Types.BadServerResponse,
                                                            Types.XenAPIException,
                                                            org.apache.xmlrpc.XmlRpcException
Return a map of task references to task records for all tasks known to the system.

Returns:
records of all objects
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException