com.xensource.xenapi
Class Session

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

public class Session
extends Object

A session


Nested Class Summary
static class Session.Record
          Represents all the fields in a Session
 
Field Summary
protected  String ref
          The XenAPI reference to this object.
 
Method Summary
static Map<Session,Session.Record> getAllRecords()
          Get all the Session Records at once, in a single XML RPC call
static Session getByUuid(String uuid)
          Get a reference to the session instance with the specified UUID.
protected static Session getInstFromRef(String ref)
           
 Long getLastActive()
          Get the last_active field of the given session.
 Session.Record getRecord()
          Get a record containing the current state of the given session.
 Host getThisHost()
          Get the this_host field of the given session.
 User getThisUser()
          Get the this_user field of the given session.
 String getUuid()
          Get the uuid field of the given session.
static Session loginWithPassword(String uname, String pwd)
          Attempt to authenticate the user, returning a session_id if successful
static void logout()
          Log out of a session
 
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 Session getInstFromRef(String ref)

getRecord

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

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

getByUuid

public static Session getByUuid(String uuid)
                         throws Types.BadServerResponse,
                                ConnectionHelper.NoConnectionOnThisThreadException,
                                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
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getUuid

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

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

getThisHost

public Host getThisHost()
                 throws Types.BadServerResponse,
                        ConnectionHelper.NoConnectionOnThisThreadException,
                        XmlRpcException
Get the this_host field of the given session.

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

getThisUser

public User getThisUser()
                 throws Types.BadServerResponse,
                        ConnectionHelper.NoConnectionOnThisThreadException,
                        XmlRpcException
Get the this_user field of the given session.

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

getLastActive

public Long getLastActive()
                   throws Types.BadServerResponse,
                          ConnectionHelper.NoConnectionOnThisThreadException,
                          XmlRpcException
Get the last_active field of the given session.

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

loginWithPassword

public static Session loginWithPassword(String uname,
                                        String pwd)
                                 throws Types.BadServerResponse,
                                        ConnectionHelper.NoConnectionOnThisThreadException,
                                        XmlRpcException
Attempt to authenticate the user, returning a session_id if successful

Parameters:
uname - Username for login.
pwd - Password for login.
Returns:
ID of newly created session
Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

logout

public static void logout()
                   throws Types.BadServerResponse,
                          ConnectionHelper.NoConnectionOnThisThreadException,
                          XmlRpcException
Log out of a session

Throws:
Types.BadServerResponse
ConnectionHelper.NoConnectionOnThisThreadException
XmlRpcException

getAllRecords

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

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