com.xensource.xenapi
Class Session

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

public class Session
extends XenAPIObject

A session


Nested Class Summary
static class Session.Record
          Represents all the fields in a Session
 
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 session.
static void changePassword(Connection c, java.lang.String oldPwd, java.lang.String newPwd)
          Change the account password; if your session is authenticated with root priviledges then the old_pwd is validated and the new_pwd is set regardless
 boolean equals(java.lang.Object obj)
          If obj is a Session, compares XenAPI references for equality.
static java.util.Set<java.lang.String> getAllSubjectIdentifiers(Connection c)
          Return a list of all the user subject-identifiers of all existing sessions
static Task getAllSubjectIdentifiersAsync(Connection c)
          Return a list of all the user subject-identifiers of all existing sessions
 java.lang.String getAuthUserName(Connection c)
          Get the auth_user_name field of the given session.
 java.lang.String getAuthUserSid(Connection c)
          Get the auth_user_sid field of the given session.
static Session getByUuid(Connection c, java.lang.String uuid)
          Get a reference to the session instance with the specified UUID.
 java.lang.Boolean getIsLocalSuperuser(Connection c)
          Get the is_local_superuser field of the given session.
 java.util.Date getLastActive(Connection c)
          Get the last_active field of the given session.
 java.util.Map<java.lang.String,java.lang.String> getOtherConfig(Connection c)
          Get the other_config field of the given session.
 Session getParent(Connection c)
          Get the parent field of the given session.
 java.lang.Boolean getPool(Connection c)
          Get the pool field of the given session.
 java.util.Set<java.lang.String> getRbacPermissions(Connection c)
          Get the rbac_permissions field of the given session.
 Session.Record getRecord(Connection c)
          Get a record containing the current state of the given session.
 Subject getSubject(Connection c)
          Get the subject field of the given session.
 java.util.Set<Task> getTasks(Connection c)
          Get the tasks field of the given session.
 Host getThisHost(Connection c)
          Get the this_host field of the given session.
 User getThisUser(Connection c)
          Get the this_user field of the given session.
 java.lang.String getUuid(Connection c)
          Get the uuid field of the given session.
 java.util.Date getValidationTime(Connection c)
          Get the validation_time field of the given session.
 int hashCode()
           
static void localLogout(Connection c)
          Log out of local session.
static Session loginWithPassword(Connection c, java.lang.String uname, java.lang.String pwd, java.lang.String version)
          Attempt to authenticate the user, returning a session reference if successful
static void logout(Connection c)
          Log out of a session
static void logoutSubjectIdentifier(Connection c, java.lang.String subjectIdentifier)
          Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function
static Task logoutSubjectIdentifierAsync(Connection c, java.lang.String subjectIdentifier)
          Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function
 void removeFromOtherConfig(Connection c, java.lang.String key)
          Remove the given key and its corresponding value from the other_config field of the given session.
 void setOtherConfig(Connection c, java.util.Map<java.lang.String,java.lang.String> otherConfig)
          Set the other_config field of the given session.
static Session slaveLocalLoginWithPassword(Connection c, java.lang.String uname, java.lang.String pwd)
          Authenticate locally against a slave in emergency mode.
 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 Session, 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 Session.Record getRecord(Connection c)
                         throws Types.BadServerResponse,
                                Types.XenAPIException,
                                org.apache.xmlrpc.XmlRpcException
Get a record containing the current state of the given session.

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

getByUuid

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

getUuid

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

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

getThisHost

public Host getThisHost(Connection c)
                 throws Types.BadServerResponse,
                        Types.XenAPIException,
                        org.apache.xmlrpc.XmlRpcException
Get the this_host field of the given session.

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

getThisUser

public User getThisUser(Connection c)
                 throws Types.BadServerResponse,
                        Types.XenAPIException,
                        org.apache.xmlrpc.XmlRpcException
Get the this_user field of the given session.

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

getLastActive

public java.util.Date getLastActive(Connection c)
                             throws Types.BadServerResponse,
                                    Types.XenAPIException,
                                    org.apache.xmlrpc.XmlRpcException
Get the last_active field of the given session.

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

getPool

public java.lang.Boolean getPool(Connection c)
                          throws Types.BadServerResponse,
                                 Types.XenAPIException,
                                 org.apache.xmlrpc.XmlRpcException
Get the pool field of the given session.

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 session.

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

getIsLocalSuperuser

public java.lang.Boolean getIsLocalSuperuser(Connection c)
                                      throws Types.BadServerResponse,
                                             Types.XenAPIException,
                                             org.apache.xmlrpc.XmlRpcException
Get the is_local_superuser field of the given session.

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

getSubject

public Subject getSubject(Connection c)
                   throws Types.BadServerResponse,
                          Types.XenAPIException,
                          org.apache.xmlrpc.XmlRpcException
Get the subject field of the given session.

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

getValidationTime

public java.util.Date getValidationTime(Connection c)
                                 throws Types.BadServerResponse,
                                        Types.XenAPIException,
                                        org.apache.xmlrpc.XmlRpcException
Get the validation_time field of the given session.

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

getAuthUserSid

public java.lang.String getAuthUserSid(Connection c)
                                throws Types.BadServerResponse,
                                       Types.XenAPIException,
                                       org.apache.xmlrpc.XmlRpcException
Get the auth_user_sid field of the given session.

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

getAuthUserName

public java.lang.String getAuthUserName(Connection c)
                                 throws Types.BadServerResponse,
                                        Types.XenAPIException,
                                        org.apache.xmlrpc.XmlRpcException
Get the auth_user_name field of the given session.

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

getRbacPermissions

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

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

getTasks

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

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

getParent

public Session getParent(Connection c)
                  throws Types.BadServerResponse,
                         Types.XenAPIException,
                         org.apache.xmlrpc.XmlRpcException
Get the parent field of the given session.

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 session.

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 session.

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 session. 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

loginWithPassword

public static Session loginWithPassword(Connection c,
                                        java.lang.String uname,
                                        java.lang.String pwd,
                                        java.lang.String version)
                                 throws Types.BadServerResponse,
                                        Types.XenAPIException,
                                        org.apache.xmlrpc.XmlRpcException,
                                        Types.SessionAuthenticationFailed
Attempt to authenticate the user, returning a session reference if successful

Parameters:
uname - Username for login.
pwd - Password for login.
version - Client API version.
Returns:
reference of newly created session
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException
Types.SessionAuthenticationFailed

logout

public static void logout(Connection c)
                   throws Types.BadServerResponse,
                          Types.XenAPIException,
                          org.apache.xmlrpc.XmlRpcException
Log out of a session

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

changePassword

public static void changePassword(Connection c,
                                  java.lang.String oldPwd,
                                  java.lang.String newPwd)
                           throws Types.BadServerResponse,
                                  Types.XenAPIException,
                                  org.apache.xmlrpc.XmlRpcException
Change the account password; if your session is authenticated with root priviledges then the old_pwd is validated and the new_pwd is set regardless

Parameters:
oldPwd - Old password for account
newPwd - New password for account
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

slaveLocalLoginWithPassword

public static Session slaveLocalLoginWithPassword(Connection c,
                                                  java.lang.String uname,
                                                  java.lang.String pwd)
                                           throws Types.BadServerResponse,
                                                  Types.XenAPIException,
                                                  org.apache.xmlrpc.XmlRpcException
Authenticate locally against a slave in emergency mode. Note the resulting sessions are only good for use on this host.

Parameters:
uname - Username for login.
pwd - Password for login.
Returns:
ID of newly created session
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

localLogout

public static void localLogout(Connection c)
                        throws Types.BadServerResponse,
                               Types.XenAPIException,
                               org.apache.xmlrpc.XmlRpcException
Log out of local session.

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

getAllSubjectIdentifiersAsync

public static Task getAllSubjectIdentifiersAsync(Connection c)
                                          throws Types.BadServerResponse,
                                                 Types.XenAPIException,
                                                 org.apache.xmlrpc.XmlRpcException
Return a list of all the user subject-identifiers of all existing sessions

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

getAllSubjectIdentifiers

public static java.util.Set<java.lang.String> getAllSubjectIdentifiers(Connection c)
                                                                throws Types.BadServerResponse,
                                                                       Types.XenAPIException,
                                                                       org.apache.xmlrpc.XmlRpcException
Return a list of all the user subject-identifiers of all existing sessions

Returns:
The list of user subject-identifiers of all existing sessions
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

logoutSubjectIdentifierAsync

public static Task logoutSubjectIdentifierAsync(Connection c,
                                                java.lang.String subjectIdentifier)
                                         throws Types.BadServerResponse,
                                                Types.XenAPIException,
                                                org.apache.xmlrpc.XmlRpcException
Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function

Parameters:
subjectIdentifier - User subject-identifier of the sessions to be destroyed
Returns:
Task
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException

logoutSubjectIdentifier

public static void logoutSubjectIdentifier(Connection c,
                                           java.lang.String subjectIdentifier)
                                    throws Types.BadServerResponse,
                                           Types.XenAPIException,
                                           org.apache.xmlrpc.XmlRpcException
Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function

Parameters:
subjectIdentifier - User subject-identifier of the sessions to be destroyed
Throws:
Types.BadServerResponse
Types.XenAPIException
org.apache.xmlrpc.XmlRpcException