Package com.sas.lsaf.execution.session

## Interface SessionService

-     public interface SessionService

  Methods to query and manage sessions.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `deleteSession​(java.lang.String id)` | Deletes a session.
    `void` | `deleteSessions​(java.util.Set<java.lang.String> ids)` | Deletes the sessions.
    `Session` | `endSession​(java.lang.String id)` | Ends a session.
    `java.util.Set<Session>` | `getAllSessions()` | Gets a list of all of the sessions for all of the users.
    `java.util.Set<Session>` | `getCurrentUserSessions()` | Gets a list of all of the sessions for the current user.
    `java.lang.String` | `getLogFileContents​(java.lang.String id)` | Gets the log file contents for the session, if the size of the file does not exceed 5 megabytes (5,242,880 bytes).
    `java.lang.String` | `getLogFileContentsForEngine​(java.lang.String id, EngineType engineType)` | Gets the log file contents for the specified `engine` that generated the file, if the size of the file does not exceed 5 megabytes (5,242,880 bytes).
    `long` | `getLogFileSize​(java.lang.String id)` | Gets the size (in bytes) of the log file for the session.
    `long` | `getLogFileSizeForEngine​(java.lang.String id, EngineType engineType)` | Gets the size (in bytes) of the log file for the specified `engine` that generated the file.
    `java.lang.String` | `getResultsFileContents​(java.lang.String id)` | Gets the results file for the session, if the size of the file does not exceed 5 megabytes (5,242,880 bytes).
    `java.lang.String` | `getResultsFileContentsForEngine​(java.lang.String id, EngineType engineType)` | Gets the results file for the specified `engine` that generated the file, if the size of the file does not exceed 5 megabytes (5,242,880 bytes).
    `long` | `getResultsFileSize​(java.lang.String id)` | Gets the size (in bytes) of the results file for the session.
    `long` | `getResultsFileSizeForEngine​(java.lang.String id, EngineType engineType)` | Gets the size (in bytes) of the results file for the specified `engine` that generated the file.
    `Session` | `getSession​(java.lang.String id)` | Gets the session with the identifier.
    `java.util.Set<Session>` | `getSessionsByUser​(java.lang.String userId)` | Gets a list of the sessions for the user with the specified userId.
    `java.lang.String` | `saveLogFileForEngineToCurrentUserWorkspace​(java.lang.String id, EngineType engineType, java.lang.String logPath)` | Saves the log file for the specified `engine` to the current user's workspace, in the specified location.
    `java.lang.String` | `saveLogFileToCurrentUserWorkspace​(java.lang.String id, java.lang.String logPath)` | Saves the log file for the session to the current user's workspace, in the specified location.
    `java.lang.String` | `saveResultsFileForEngineToCurrentUserWorkspace​(java.lang.String id, EngineType engineType, java.lang.String resultsPath)` | Saves the results file for the specified `engine` to the current user's workspace, in the specified location.
    `java.lang.String` | `saveResultsFileToCurrentUserWorkspace​(java.lang.String id, java.lang.String resultsPath)` | Saves the results file for the session to the current user's workspace, in the specified location.
    `SessionSearchResults` | `search​(SessionQuery query)` | Searches sessions based on the specified query.

- - ### Method Detail

    - #### deleteSession

          void deleteSession​(java.lang.String id)
                      throws SessionNotFoundException,
                             SessionException

      Deletes a session. If a session has a `SessionType` of `PUBLISHED_JOB`, the transient workspace associated with the session is also be deleted.
      Parameters:
        `id` - The identifier of the session.
      Throws:
        `SessionNotFoundException` - Thrown when the session with the identifier does not exist.
        `SessionException` - Thrown when there is an issue when deleting the session.

    - #### endSession

          Session endSession​(java.lang.String id)
                      throws SessionNotFoundException,
                             SessionException

      Ends a session.
      Parameters:
        `id` - The identifier of the session.
      Returns:
        The session that ended.
      Throws:
        `SessionNotFoundException` - Thrown when the session with the identifier does not exist.
        `SessionException` - Thrown if there is an issue when ending the session.

    - #### deleteSessions

          void deleteSessions​(java.util.Set<java.lang.String> ids)

      Deletes the sessions. If a session has a `SessionType` of `PUBLISHED_JOB`, the transient workspace associated with the session is also be deleted.
      Parameters:
        `ids` - The sessions.

    - #### getAllSessions

          java.util.Set<Session> getAllSessions()

      Gets a list of all of the sessions for all of the users. This method requires the Manage All Sessions privilege.
      Returns:
        A list of all of the sessions for all of the users.

    - #### getCurrentUserSessions

          java.util.Set<Session> getCurrentUserSessions()

      Gets a list of all of the sessions for the current user.
      Returns:
        a list of all of the sessions for the current user.

    - #### getSession

          Session getSession​(java.lang.String id)
                      throws SessionNotFoundException

      Gets the session with the identifier.
      Parameters:
        `id` - The identifier that represents the session.
      Returns:
        The session.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.

    - #### getLogFileContents

          java.lang.String getLogFileContents​(java.lang.String id)
                                       throws SessionNotFoundException,
                                              SessionException

      Gets the log file contents for the session, if the size of the file does not exceed 5 megabytes (5,242,880 bytes). If the file size exceeds the maximum , an IllegalArgumentException is thrown.

      If the session is `COMPOSITE`, use `getLogFileContentsForEngine(String, EngineType)`.

      Note: Logs for `INTERACTIVE` sessions return cumulative logs for all submissions completed within the session.

      Parameters:
        `id` - The identifier of the session.
      Returns:
        The contents of the log file for the session.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when getting the contents of the log file.

    - #### getLogFileContentsForEngine

          java.lang.String getLogFileContentsForEngine​(java.lang.String id,
                                                       EngineType engineType)
                                                throws SessionNotFoundException,
                                                       SessionException

      Gets the log file contents for the specified `engine` that generated the file, if the size of the file does not exceed 5 megabytes (5,242,880 bytes). If the file size exceeds the maximum , an IllegalArgumentException is thrown.
      Parameters:
        `id` - The identifier of the session.
        `engineType` - The type of session engine that generated the file.
      Returns:
        The contents of the log file for the session.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when getting the contents of the log file.

    - #### getLogFileSize

          long getLogFileSize​(java.lang.String id)
                       throws SessionNotFoundException,
                              SessionException

      Gets the size (in bytes) of the log file for the session. If the session is `COMPOSITE`, use `getLogFileSizeForEngine(String, EngineType)`.
      Parameters:
        `id` - The identifier of the session.
      Returns:
        The log file size (in bytes).
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when getting the size of the log file.

    - #### getLogFileSizeForEngine

          long getLogFileSizeForEngine​(java.lang.String id,
                                       EngineType engineType)
                                throws SessionNotFoundException,
                                       SessionException

      Gets the size (in bytes) of the log file for the specified `engine` that generated the file.
      Parameters:
        `id` - The identifier of the session.
        `engineType` - The type of session engine that generated the file.
      Returns:
        The log file size (in bytes).
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when getting the size of the log file.

    - #### getResultsFileContents

          java.lang.String getResultsFileContents​(java.lang.String id)
                                           throws SessionNotFoundException,
                                                  SessionException

      Gets the results file for the session, if the size of the file does not exceed 5 megabytes (5,242,880 bytes). If the file size exceeds the maximum, an IllegalArgumentException is thrown.

      If the session is `COMPOSITE`, use `getResultsFileContentsForEngine(String, EngineType)`.

      Parameters:
        `id` - The identifier of The session.
      Returns:
        The contents of the results file.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when getting the contents of the results file.

    - #### getResultsFileContentsForEngine

          java.lang.String getResultsFileContentsForEngine​(java.lang.String id,
                                                           EngineType engineType)
                                                    throws SessionNotFoundException,
                                                           SessionException

      Gets the results file for the specified `engine` that generated the file, if the size of the file does not exceed 5 megabytes (5,242,880 bytes). If the file size exceeds the maximum, an IllegalArgumentException is thrown.
      Parameters:
        `id` - The identifier of the session.
        `engineType` - The type of session engine that generated the file.
      Returns:
        The contents of the results file.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when getting the contents of the results file.

    - #### getResultsFileSize

          long getResultsFileSize​(java.lang.String id)
                           throws SessionNotFoundException,
                                  SessionException

      Gets the size (in bytes) of the results file for the session. If the session is `COMPOSITE`, use `getResultsFileSizeForEngine(String, EngineType)`.
      Parameters:
        `id` - The identifier of the session.
      Returns:
        The results file size (in bytes).
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when getting the size of the results file.

    - #### getResultsFileSizeForEngine

          long getResultsFileSizeForEngine​(java.lang.String id,
                                           EngineType engineType)
                                    throws SessionNotFoundException,
                                           SessionException

      Gets the size (in bytes) of the results file for the specified `engine` that generated the file.
      Parameters:
        `id` - The identifier of the session.
        `engineType` - The type of session engine that generated the file.
      Returns:
        The results file size (in bytes).
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when saving the contents of the results file.

    - #### getSessionsByUser

          java.util.Set<Session> getSessionsByUser​(java.lang.String userId)

      Gets a list of the sessions for the user with the specified userId.
      Parameters:
        `userId` - The userId of the user who started the session.
      Returns:
        A list of sessions for the user.

    - #### saveLogFileToCurrentUserWorkspace

          java.lang.String saveLogFileToCurrentUserWorkspace​(java.lang.String id,
                                                             java.lang.String logPath)
                                                      throws SessionNotFoundException,
                                                             SessionException

      Saves the log file for the session to the current user's workspace, in the specified location. If the session is `COMPOSITE`, use `saveLogFileForEngineToCurrentUserWorkspace(String, EngineType, String)`.
      Parameters:
        `id` - The identifier of the session.
        `logPath` - The full path of destination log file.
      Returns:
        The path of the log file to save in the current user's workspace.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when saving the contents of the log file.

    - #### saveLogFileForEngineToCurrentUserWorkspace

          java.lang.String saveLogFileForEngineToCurrentUserWorkspace​(java.lang.String id,
                                                                      EngineType engineType,
                                                                      java.lang.String logPath)
                                                               throws SessionNotFoundException,
                                                                      SessionException

      Saves the log file for the specified `engine` to the current user's workspace, in the specified location.
      Parameters:
        `id` - The identifier of the session.
        `engineType` - The type of session engine that generated the file.
        `logPath` - The full path of destination log file.
      Returns:
        The path of the log file to save in the current user's workspace.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when saving the contents of the log file.

    - #### saveResultsFileToCurrentUserWorkspace

          java.lang.String saveResultsFileToCurrentUserWorkspace​(java.lang.String id,
                                                                 java.lang.String resultsPath)
                                                          throws SessionNotFoundException,
                                                                 SessionException

      Saves the results file for the session to the current user's workspace, in the specified location. If the session is `COMPOSITE`, use `saveResultsFileForEngineToCurrentUserWorkspace(String, EngineType, String)`.
      Parameters:
        `id` - The identifier of the session.
        `resultsPath` - The full path of results file.
      Returns:
        The path of the results file to save in the current user's workspace.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when saving the contents of the results file.

    - #### saveResultsFileForEngineToCurrentUserWorkspace

          java.lang.String saveResultsFileForEngineToCurrentUserWorkspace​(java.lang.String id,
                                                                          EngineType engineType,
                                                                          java.lang.String resultsPath)
                                                                   throws SessionNotFoundException,
                                                                          SessionException

      Saves the results file for the specified `engine` to the current user's workspace, in the specified location.
      Parameters:
        `id` - The identifier of the session.
        `engineType` - The type of system that generated the file.
        `resultsPath` - The full path of results file.
      Returns:
        The path of the results file to save in the current user's workspace.
      Throws:
        `SessionNotFoundException` - Thrown when the session does not exist.
        `SessionException` - Thrown when there is an issue when saving the contents of the results file.

    - #### search

          SessionSearchResults search​(SessionQuery query)
                               throws SessionSearchException

      Searches sessions based on the specified query.
      Parameters:
        `query` - The criteria to query sessions.
      Returns:
        The results of a sessions search executed on the server.
      Throws:
        `SessionSearchException` - Thrown when there is an issue when searching sessions.