com.xensource.xenapi
Class Subject

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

public class Subject
extends XenAPIObject

A user or group that can log in xapi


Nested Class Summary
static class Subject.Record
          Represents all the fields in a Subject
 
Field Summary
protected  String ref
          The XenAPI reference to this object.
 
Method Summary
 void addToRoles(Connection c, Role role)
          This call adds a new role to a subject
static Subject create(Connection c, Subject.Record record)
          Create a new subject instance, and return its handle.
static Task createAsync(Connection c, Subject.Record record)
          Create a new subject instance, and return its handle.
 void destroy(Connection c)
          Destroy the specified subject instance.
 Task destroyAsync(Connection c)
          Destroy the specified subject instance.
 boolean equals(Object obj)
          If obj is a Subject, compares XenAPI references for equality.
static Set<Subject> getAll(Connection c)
          Return a list of all the subjects known to the system.
static Map<Subject,Subject.Record> getAllRecords(Connection c)
          Return a map of subject references to subject records for all subjects known to the system.
static Subject getByUuid(Connection c, String uuid)
          Get a reference to the subject instance with the specified UUID.
 Map<String,String> getOtherConfig(Connection c)
          Get the other_config field of the given subject.
 Set<String> getPermissionsNameLabel(Connection c)
          This call returns a list of permission names given a subject
 Subject.Record getRecord(Connection c)
          Get a record containing the current state of the given subject.
 Set<Role> getRoles(Connection c)
          Get the roles field of the given subject.
 String getSubjectIdentifier(Connection c)
          Get the subject_identifier field of the given subject.
 String getUuid(Connection c)
          Get the uuid field of the given subject.
 int hashCode()
           
 void removeFromRoles(Connection c, Role role)
          This call removes a role from a subject
 String toWireString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ref

protected final String ref
The XenAPI reference to this object.

Method Detail

toWireString

public String toWireString()
Specified by:
toWireString in class XenAPIObject

equals

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

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getRecord

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

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

getByUuid

public static Subject getByUuid(Connection c,
                                String uuid)
                         throws Types.BadServerResponse,
                                Types.XenAPIException,
                                org.apache.xmlrpc.XmlRpcException
Get a reference to the subject 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

createAsync

public static Task createAsync(Connection c,
                               Subject.Record record)
                        throws Types.BadServerResponse,
                               Types.XenAPIException,
                               org.apache.xmlrpc.XmlRpcException
Create a new subject instance, and return its handle.

Parameters:
record - All constructor arguments
Returns:
Task
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

create

public static Subject create(Connection c,
                             Subject.Record record)
                      throws Types.BadServerResponse,
                             Types.XenAPIException,
                             org.apache.xmlrpc.XmlRpcException
Create a new subject instance, and return its handle.

Parameters:
record - All constructor arguments
Returns:
reference to the newly created object
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

destroyAsync

public Task destroyAsync(Connection c)
                  throws Types.BadServerResponse,
                         Types.XenAPIException,
                         org.apache.xmlrpc.XmlRpcException
Destroy the specified subject instance.

Returns:
Task
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 specified subject instance.

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

getUuid

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

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

getSubjectIdentifier

public String getSubjectIdentifier(Connection c)
                            throws Types.BadServerResponse,
                                   Types.XenAPIException,
                                   org.apache.xmlrpc.XmlRpcException
Get the subject_identifier field of the given subject.

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

getOtherConfig

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

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

getRoles

public Set<Role> getRoles(Connection c)
                   throws Types.BadServerResponse,
                          Types.XenAPIException,
                          org.apache.xmlrpc.XmlRpcException
Get the roles field of the given subject.

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

addToRoles

public void addToRoles(Connection c,
                       Role role)
                throws Types.BadServerResponse,
                       Types.XenAPIException,
                       org.apache.xmlrpc.XmlRpcException
This call adds a new role to a subject

Parameters:
role - The unique role reference
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

removeFromRoles

public void removeFromRoles(Connection c,
                            Role role)
                     throws Types.BadServerResponse,
                            Types.XenAPIException,
                            org.apache.xmlrpc.XmlRpcException
This call removes a role from a subject

Parameters:
role - The unique role reference in the subject's roles field
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getPermissionsNameLabel

public Set<String> getPermissionsNameLabel(Connection c)
                                    throws Types.BadServerResponse,
                                           Types.XenAPIException,
                                           org.apache.xmlrpc.XmlRpcException
This call returns a list of permission names given a subject

Returns:
a list of permission names
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getAll

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

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

getAllRecords

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

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