com.xensource.xenapi
Class Connection

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

public class Connection
extends java.lang.Object

Represents a connection to a XenServer. Creating a new instance of this class initialises a new XmlRpcClient that is then used by all method calls: each method call in xenapi takes a Connection as a parameter, composes an XMLRPC method call, and dispatches it on the Connection's client via the dispatch method.


Field Summary
static java.lang.String BINDINGS_VERSION
          The version of the bindings that this class belongs to.
 java.lang.Boolean rioConnection
          Deprecated. Use getAPIVersion() instead.
 
Constructor Summary
Connection(java.lang.String client, java.lang.String username, java.lang.String password)
          Deprecated. Use a constructor that takes a URL as the first parameter instead.
Connection(java.net.URL url)
          Creates a connection to a particular server using a given username and password.
Connection(java.net.URL url, java.lang.String sessionReference)
          Creates a connection to a particular server using a given username and password.
 
Method Summary
 void dispose()
          Nothrow guarantee.
protected  void finalize()
           
 APIVersion getAPIVersion()
          Updated when Session.login_with_password() is called.
 org.apache.xmlrpc.client.XmlRpcClientConfigImpl getConfig()
           
 java.lang.String getSessionReference()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BINDINGS_VERSION

public static final java.lang.String BINDINGS_VERSION
The version of the bindings that this class belongs to.

See Also:
Constant Field Values

rioConnection

@Deprecated
public java.lang.Boolean rioConnection
Deprecated. Use getAPIVersion() instead.
true if the connection is to the Rio edition of XenServer. Certain function calls are not allowed.

Constructor Detail

Connection

@Deprecated
public Connection(java.lang.String client,
                             java.lang.String username,
                             java.lang.String password)
           throws java.net.MalformedURLException,
                  org.apache.xmlrpc.XmlRpcException,
                  Types.BadServerResponse,
                  Types.SessionAuthenticationFailed,
                  Types.XenAPIException
Deprecated. Use a constructor that takes a URL as the first parameter instead.

Creates a connection to a particular server using a given username and password. This object can then be passed in to any other API calls. This constructor calls Session.loginWithPassword, passing itself as the first parameter. When this constructor is used, a call to dispose() (also called in the Connection's finalizer) will attempt a Session.logout on this connection.

Throws:
java.net.MalformedURLException
org.apache.xmlrpc.XmlRpcException
Types.BadServerResponse
Types.SessionAuthenticationFailed
Types.XenAPIException

Connection

public Connection(java.net.URL url)
Creates a connection to a particular server using a given username and password. This object can then be passed in to any other API calls. Note this constructor does NOT call Session.loginWithPassword; the programmer is responsible for calling it, passing the Connection as a parameter. No attempt to connect to the server is made until login is called. When this constructor is used, a call to dispose() will do nothing. The programmer is responsible for manually logging out the Session.


Connection

public Connection(java.net.URL url,
                  java.lang.String sessionReference)
Creates a connection to a particular server using a given username and password. This object can then be passed in to any other API calls. The additional sessionReference parameter must be a reference to a logged-in Session. Any method calls on this Connection will use it. This constructor does not call Session.loginWithPassword, and dispose() on the resulting Connection object does not call Session.logout. The programmer is responsible for ensuring the Session is logged in and out correctly.

Method Detail

getAPIVersion

public APIVersion getAPIVersion()
Updated when Session.login_with_password() is called.


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

dispose

public void dispose()
Nothrow guarantee.


getConfig

public org.apache.xmlrpc.client.XmlRpcClientConfigImpl getConfig()

getSessionReference

public java.lang.String getSessionReference()