Class ToolConnectionFactory


  • public class ToolConnectionFactory
    extends Object
    Factory for ToolConnection instances.
    • Method Detail

      • createConnection

        public static ToolConnection createConnection​(String url,
                                                      String username,
                                                      String isolationGroup,
                                                      String password,
                                                      int timeout)
                                               throws ToolException,
                                                      LoginException
        Create a ToolConnection.
        Parameters:
        url - URL to connect to, eg. http://host:port/scheduler
        username - username to connect with
        isolationGroup - isolation group to connect to (specify GLOBAL if you are not sure).
        password - password to connect with. This will handle encrypted passwords from the Credential object.
        timeout - socket timeout (specify 0 for none).
        Returns:
        a ToolConnection instance.
        Throws:
        ToolException - if an error occurs in communication.
        LoginException - if the login fails.
      • createConnection

        public static ToolConnection createConnection​(String connectionFile,
                                                      int timeout)
                                               throws IOException,
                                                      ToolException,
                                                      LoginException
        Create a ToolConnection from a version 1 connection file, created using the command line jsecret tool.
        Parameters:
        connectionFile - the filename of the connection file.
        timeout - socket timeout (specify 0 for none).
        Returns:
        a ToolConnection instance. This must be closed after use.
        Throws:
        IOException - if the connection file cannot be opened.
        ToolException - if an error occurs in communication.
        LoginException - if the login fails.
      • createConnection

        public static ToolConnection createConnection​(String url,
                                                      String username,
                                                      String isolationGroup,
                                                      String password,
                                                      Map<String,​Object> options)
                                               throws ToolException,
                                                      LoginException
        Create a ToolConnection.
        Parameters:
        url - URL to connect to, eg. http://host:port/scheduler
        username - username to connect with
        isolationGroup - isolation group to connect to (specify GLOBAL if you are not sure).
        password - password to connect with. This will handle encrypted passwords from the Credential object.
        options - connection specific options (may be null).
        Returns:
        a ToolConnection instance.
        Throws:
        ToolException - if an error occurs in communication.
        LoginException - if the login fails.
      • createConnection

        public static ToolConnection createConnection​(InputStream connectionStream)
                                               throws IOException,
                                                      ToolException,
                                                      LoginException
        Create a ToolConnection from an input stream representing a version 1 connection file, created using the command line jsecret tool. The input stream will be closed when complete.
        Parameters:
        connectionStream - the input stream for the connection file.
        Returns:
        a ToolConnection instance. This must be closed after use.
        Throws:
        IOException - if the connection file cannot be opened.
        ToolException - if an error occurs in communication.
        LoginException - if the login fails.
      • createConnection

        public static ToolConnection createConnection​(Properties connectionProperties)
                                               throws ToolException,
                                                      LoginException
        Create a ToolConnection from a Properties object representing a version 1 connection file, created using the command line jsecret tool.
        Parameters:
        connectionProperties - a Properties object containing the connection
        Returns:
        a ToolConnection instance. This must be closed after use.
        Throws:
        ToolException - if an error occurs in communication.
        LoginException - if the login fails.
      • createConnection

        public static ToolConnection createConnection​(Map<String,​Object> connectionProperties)
                                               throws ToolException,
                                                      LoginException
        Create a ToolConnection from a Map representing a version 1 connection file, created using the command line jsecret tool.
        Parameters:
        connectionProperties - a Properties object containing the connection
        Returns:
        a ToolConnection instance. This must be closed after use.
        Throws:
        ToolException - if an error occurs in communication.
        LoginException - if the login fails.