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

    Fields
    Modifier and Type
    Field
    Description
    protected static final int
    Default connection timeout for xml-rpc calls in seconds
    protected static final int
    Default reply timeout for xml-rpc calls in seconds
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a connection to a particular server using a given url.
    Connection(URL url, int replyTimeout, int connTimeout)
    Creates a connection to a particular server using a given url.
    Connection(URL url, String sessionReference)
    Creates a connection to a particular server using a given url.
    Connection(URL url, String sessionReference, int replyTimeout, int connTimeout)
    Creates a connection to a particular server using a given url.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Map
    dispatch(String method_call, Object[] method_params)
    The (auto-generated parts of) the bindings dispatch XMLRPC calls on this Connection's client through this method.
    Updated when Session.login_with_password() is called.
    org.apache.xmlrpc.client.XmlRpcClientConfigImpl
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_REPLY_TIMEOUT

      protected static final int DEFAULT_REPLY_TIMEOUT
      Default reply timeout for xml-rpc calls in seconds
      See Also:
    • DEFAULT_CONNECTION_TIMEOUT

      protected static final int DEFAULT_CONNECTION_TIMEOUT
      Default connection timeout for xml-rpc calls in seconds
      See Also:
  • Constructor Details

    • Connection

      public Connection(URL url)
      Creates a connection to a particular server using a given url. 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. This constructor uses the default values of the reply and connection timeouts for the xmlrpc calls (600 seconds and 5 seconds respectively).
      Parameters:
      url - The URL of the server to connect to
    • Connection

      public Connection(URL url, int replyTimeout, int connTimeout)
      Creates a connection to a particular server using a given url. 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.
      Parameters:
      url - The URL of the server to connect to
      replyTimeout - The reply timeout for xml-rpc calls in seconds
      connTimeout - The connection timeout for xml-rpc calls in seconds
    • Connection

      public Connection(URL url, String sessionReference)
      Creates a connection to a particular server using a given url. This object can then be passed in to any other API calls. This constructor uses the default values of the reply and connection timeouts for the xmlrpc calls (600 seconds and 5 seconds respectively).
      Parameters:
      url - The URL of the server to connect to
      sessionReference - 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.
    • Connection

      public Connection(URL url, String sessionReference, int replyTimeout, int connTimeout)
      Creates a connection to a particular server using a given url. This object can then be passed in to any other API calls.
      Parameters:
      url - The URL of the server to connect to
      sessionReference - 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.
      replyTimeout - The reply timeout for xml-rpc calls in seconds
      connTimeout - The connection timeout for xml-rpc calls in seconds
  • Method Details

    • getAPIVersion

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

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

      public String getSessionReference()
    • dispatch

      protected Map dispatch(String method_call, Object[] method_params) throws org.apache.xmlrpc.XmlRpcException, Types.XenAPIException
      The (auto-generated parts of) the bindings dispatch XMLRPC calls on this Connection's client through this method.
      Throws:
      org.apache.xmlrpc.XmlRpcException
      Types.XenAPIException