com.ansys.ingress.client.api

## Interface Connection

-     public interface Connection

  Connection represents a connection to an EKM server. It provides access to the managers used to perform various operations on the server. It also defines the methods used to manage persistent connections.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes this connection.
    `void` | `close(boolean force)` Closes this connection.
    `java.lang.String` | `close(boolean save, boolean force)` Closes this connection.
    `void` | `close(java.lang.String name, boolean force)` Closes the connection and saves it using the given name.
    `void` | `delete()` Deletes this connection.
    `AdministrationManager` | `getAdministrationManager()` Gets the object for this connection that provides access to administration operations.
    `DataManager` | `getDataManager()` Gets the object for this connection that provides access to data management operations.
    `ConnectionDetails` | `getDetails()`
    `JobManager` | `getJobManager()` Gets the object for this connection that provides access to job management operations.
    `java.util.Locale` | `getLocale()`
    `java.net.URI` | `getLocation()` Gets the location of the EKM server associated with this connection.
    `java.lang.String` | `getName()` Gets the name of this workspace if it has been previously saved.
    `java.lang.String` | `getPassword()` Gets the password of the user.
    `java.lang.String` | `getUsername()` Gets the EKM username associated with this connection.
    `com.ansys.ingress.commons.model.VariantFactory` | `getVariantFactory()` Get the `VariantFactory` used by this connection.
    `java.lang.String` | `getWorkspace()` Gets the current EKM workspace being used by this connection.
    `java.util.List<java.lang.String>` | `getWorkspaces()` Gets the list of EKM workspaces available to the current user.
    `boolean` | `hasSavedCredentials()` Determines if this connection has saved credentials or not.
    `boolean` | `isAdminUser()` Determines if the user associated with this connection is an admin user or not.
    `boolean` | `isLoggedIn()` Determines if the user of this connection is still logged in or not.
    `boolean` | `isOpen()` Determines if this connection is opened or not.
    `boolean` | `isSaved()` Determines if this is a saved connection or not.
    `boolean` | `isSessionValid()` Determines if the EKM session associated with this connection is still valid or not.
    `java.lang.String` | `save()` Saves this connection so that it can be opened at a later time.
    `java.lang.String` | `save(boolean saveCredentials)` Saves this connection so that it can be opened at a later time.
    `void` | `save(java.lang.String name)` Saves this connection so that it can be opened at a later time.
    `void` | `save(java.lang.String name, boolean saveCredentials)` Saves this connection so that it can be opened at a later time.
    `void` | `setWorkspace(java.lang.String workspace)` Sets the EKM workspace to be used by this connection.

- - ### Method Detail

    - #### close

          void close()

      Closes this connection.

    - #### close

          void close(boolean force)

      Closes this connection.
      Parameters:
        `force` - if the connection should be forced closed or not

    - #### close

          java.lang.String close(boolean save,
                                 boolean force)

      Closes this connection.
      Parameters:
        `save` - If the connection should be saved or not.
        `force` - if the connection should be forced closed or not
      Returns:
        Returns the name fo the connection if directed to save it.

    - #### close

          void close(java.lang.String name,
                     boolean force)

      Closes the connection and saves it using the given name.
      Parameters:
        `name` - The name for the connection
        `force` - if the connection should be forced closed or not

    - #### delete

          void delete()

      Deletes this connection. If the connection is currently open, the connection is closed.

    - #### getAdministrationManager

          AdministrationManager getAdministrationManager()
                                                  throws ConnectionException

      Gets the object for this connection that provides access to administration operations. This includes managing users and groups.
      Returns:
        Returns an AdministrationManager instance.
      Throws:
        `ConnectionException` - if the connection is not open.

    - #### getDataManager

          DataManager getDataManager()
                              throws ConnectionException

      Gets the object for this connection that provides access to data management operations. This includes C.R.U.D., version control, locking, and file transfers.
      Returns:
        Returns a DataManager instance.
      Throws:
        `ConnectionException` - if the connection is not open.

    - #### getDetails

          ConnectionDetails getDetails()

      Returns:
        Returns an object containing the details about this connection.

    - #### getJobManager

          JobManager getJobManager()
                            throws ConnectionException

      Gets the object for this connection that provides access to job management operations.
      Returns:
        Returns a JobManager instance.
      Throws:
        `ConnectionException` - if the connection is not open.

    - #### getLocale

          java.util.Locale getLocale()

      Returns:
        Returns the locale being used by this connection.

    - #### getLocation

          java.net.URI getLocation()

      Gets the location of the EKM server associated with this connection.
      Returns:
        Returns the EKM server's location.

    - #### getName

          java.lang.String getName()

      Gets the name of this workspace if it has been previously saved.
      Returns:
        Returns the name of this connection if it has been saved. Otherwise, it will return null.

    - #### getPassword

          java.lang.String getPassword()

      Gets the password of the user.
      Returns:
        Returns the password.

    - #### getUsername

          java.lang.String getUsername()

      Gets the EKM username associated with this connection.
      Returns:
        Returns the username.

    - #### getVariantFactory

          com.ansys.ingress.commons.model.VariantFactory getVariantFactory()

      Get the `VariantFactory` used by this connection.
      Returns:
        Returns the `VariantFactory`.

    - #### getWorkspace

          java.lang.String getWorkspace()

      Gets the current EKM workspace being used by this connection.
      Returns:
        Returns the EKM workspace.

    - #### getWorkspaces

          java.util.List<java.lang.String> getWorkspaces()
                                                  throws ConnectionException

      Gets the list of EKM workspaces available to the current user.
      Returns:
        Returns the list of available EKM workspaces.
      Throws:
        `ConnectionException` - if the connection is not open.

    - #### hasSavedCredentials

          boolean hasSavedCredentials()

      Determines if this connection has saved credentials or not.
      Returns:
        Returns true if the connection has saved credentials.

    - #### isAdminUser

          boolean isAdminUser()

      Determines if the user associated with this connection is an admin user or not.
      Returns:
        Returns true if the user is an admin user.

    - #### isLoggedIn

          boolean isLoggedIn()

      Determines if the user of this connection is still logged in or not.
      Returns:
        Returns true if the user is logged in.

    - #### isOpen

          boolean isOpen()

      Determines if this connection is opened or not.
      Returns:
        Returns true if the connection is open.

    - #### isSaved

          boolean isSaved()

      Determines if this is a saved connection or not.
      Returns:
        Returns true if this connection has been previously saved.

    - #### isSessionValid

          boolean isSessionValid()

      Determines if the EKM session associated with this connection is still valid or not.
      Returns:
        Returns true if the session is valid.

    - #### save

          java.lang.String save()

      Saves this connection so that it can be opened at a later time. The workspace currently used by the connection is the one that will be used the next time the connection is opened. If this connection was not previously saved, a name is generated for the connection. The format of the generated name is workspace@hostname[n] where workspace is the EKM workspace currently being used, hostname is the EKM server, and n is a unique number (e.g. Default@localhost1).
      Returns:
        Returns the name of the saved connection.

    - #### save

          java.lang.String save(boolean saveCredentials)

      Saves this connection so that it can be opened at a later time. The workspace currently used by the connection is the one that will be used the next time the connection is opened. If this connection was not previously saved, a name is generated for the connection. The format of the generated name is workspace@hostname[n] where workspace is the EKM workspace currently being used, hostname is the EKM server, and n is a unique number (e.g. Default@localhost1). If saving credentials, the credentials used to open the connection are stored in an encrypted format on the local machine.
      Parameters:
        `saveCredentials` - Whether credentials should be saved or not
      Returns:
        Returns the name of the saved connection.

    - #### save

          void save(java.lang.String name)

      Saves this connection so that it can be opened at a later time. The workspace currently used by the connection is the one that will be used the next time the connection is opened.
      Parameters:
        `name` - The name of the connection

    - #### save

          void save(java.lang.String name,
                    boolean saveCredentials)

      Saves this connection so that it can be opened at a later time. The workspace currently used by the connection is the one that will be used the next time the connection is opened. If saving credentials, the credentials used to open the connection are stored in an encrypted format on the local machine.
      Parameters:
        `name` - The name of the connection
        `saveCredentials` - Whether credentials should be saved or not

    - #### setWorkspace

          void setWorkspace(java.lang.String workspace)
                     throws ConnectionException,
                            EkmException

      Sets the EKM workspace to be used by this connection.
      Parameters:
        `workspace` - The EKM workspace to use.
      Throws:
        `ConnectionException` - if the connection is not open.
        `EkmException` - if the user does not have access to the given workspace.