com.xensource.xenapi
Class Role

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

public class Role
extends XenAPIObject

A set of permissions associated with a subject


Nested Class Summary
static class Role.Record
          Represents all the fields in a Role
 
Field Summary
protected  String ref
          The XenAPI reference to this object.
 
Method Summary
 boolean equals(Object obj)
          If obj is a Role, compares XenAPI references for equality.
static Set<Role> getAll(Connection c)
          Return a list of all the roles known to the system.
static Map<Role,Role.Record> getAllRecords(Connection c)
          Return a map of role references to role records for all roles known to the system.
static Set<Role> getByNameLabel(Connection c, String label)
          Get all the role instances with the given label.
 Set<Role> getByPermission(Connection c)
          This call returns a list of roles given a permission
static Set<Role> getByPermissionNameLabel(Connection c, String label)
          This call returns a list of roles given a permission name
static Role getByUuid(Connection c, String uuid)
          Get a reference to the role instance with the specified UUID.
 String getNameDescription(Connection c)
          Get the name/description field of the given role.
 String getNameLabel(Connection c)
          Get the name/label field of the given role.
 Set<Role> getPermissions(Connection c)
          This call returns a list of permissions given a role
 Set<String> getPermissionsNameLabel(Connection c)
          This call returns a list of permission names given a role
 Role.Record getRecord(Connection c)
          Get a record containing the current state of the given role.
 Set<Role> getSubroles(Connection c)
          Get the subroles field of the given role.
 String getUuid(Connection c)
          Get the uuid field of the given role.
 int hashCode()
           
 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 Role, compares XenAPI references for equality.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getRecord

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

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

getByUuid

public static Role getByUuid(Connection c,
                             String uuid)
                      throws Types.BadServerResponse,
                             Types.XenAPIException,
                             org.apache.xmlrpc.XmlRpcException
Get a reference to the role 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 Set<Role> getByNameLabel(Connection c,
                                       String label)
                                throws Types.BadServerResponse,
                                       Types.XenAPIException,
                                       org.apache.xmlrpc.XmlRpcException
Get all the role 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 String getUuid(Connection c)
               throws Types.BadServerResponse,
                      Types.XenAPIException,
                      org.apache.xmlrpc.XmlRpcException
Get the uuid field of the given role.

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

getNameLabel

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

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

getNameDescription

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

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

getSubroles

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

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

getPermissions

public Set<Role> getPermissions(Connection c)
                         throws Types.BadServerResponse,
                                Types.XenAPIException,
                                org.apache.xmlrpc.XmlRpcException
This call returns a list of permissions given a role

Returns:
a list of permissions
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 role

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

getByPermission

public Set<Role> getByPermission(Connection c)
                          throws Types.BadServerResponse,
                                 Types.XenAPIException,
                                 org.apache.xmlrpc.XmlRpcException
This call returns a list of roles given a permission

Returns:
a list of references to roles
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getByPermissionNameLabel

public static Set<Role> getByPermissionNameLabel(Connection c,
                                                 String label)
                                          throws Types.BadServerResponse,
                                                 Types.XenAPIException,
                                                 org.apache.xmlrpc.XmlRpcException
This call returns a list of roles given a permission name

Parameters:
label - The short friendly name of the role
Returns:
a list of references to roles
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

getAll

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

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

getAllRecords

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

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