Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.xensource.xenapi
Class Connection

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

    public class Connection

extends 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 String` | `BINDINGS_VERSION` The version of the bindings that this class belongs to.

Constructor Summary
`Connection(String client, String username, String password)` Deprecated. Use a constructor that takes a URL as the first parameter instead.
`Connection(URL url)` Creates a connection to a particular server using a given username and password.
`Connection(URL url, 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()`
`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 String BINDINGS_VERSION

  The version of the bindings that this class belongs to.

  See Also:
    Constant Field Values

Constructor Detail

### Connection

    @Deprecated
    public Connection(String client,
                                 String username,
                                 String password)
               throws 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:
    `MalformedURLException`
    `org.apache.xmlrpc.XmlRpcException`
    `Types.BadServerResponse`
    `Types.SessionAuthenticationFailed`
    `Types.XenAPIException`

### Connection

    public Connection(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(URL url,
                      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 Throwable

  Overrides:
    `finalize` in class `Object`
  Throws:
    `Throwable`

### dispose

    public void dispose()

  Nothrow guarantee.

### getConfig

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

### getSessionReference

    public String getSessionReference()

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD