Interface TerminalService


public interface TerminalService
  • Field Details

  • Method Details

    • initTerminalSession

      TerminalSession initTerminalSession()
      Initializes a new TerminalSession.
      Returns:
      The newly initialized TerminalSession
    • getTerminalSession

      TerminalSession getTerminalSession(String sessionId) throws SessionNotFoundException
      Returns the TerminalSession identified by the given sessionId
      Parameters:
      sessionId - The ID of the desired TerminalSession
      Returns:
      The TerminalSession
      Throws:
      SessionNotFoundException
    • closeTerminalSession

      void closeTerminalSession(String sessionId)
      Closes the TerminalSession identified by the given sessionId
      Parameters:
      sessionId - The ID of the TerminalSession
    • getObjectByQuery

      Object getObjectByQuery(Class<? extends VirtualFileSystemManagerHook> vfs, String location) throws VFSException
      Throws:
      VFSException
    • getObjectByQuery

      Object getObjectByQuery(String location) throws ObjectResolverException
      Fetches a single object by an object resolver query. Permissions are checked.
      Parameters:
      location - the object resolver query
      Returns:
      the object found
      Throws:
      ObjectResolverException - if the query is not valid or something happens during query execution
    • getObjectByQuery

      Object getObjectByQuery(String location, boolean checkRights) throws ObjectResolverException
      Fetches a single object by an object resolver query.
      Parameters:
      location - the object resolver query
      checkRights - if permissions should be checked
      Returns:
      the object found
      Throws:
      ObjectResolverException - if the query is not valid or something happens during query execution
    • getObjectByQuery

      Object getObjectByQuery(Class<? extends VirtualFileSystemManagerHook> vfsManager, String location, boolean checkRights) throws VFSException
      Throws:
      VFSException
    • getObjectsByQuery

      Collection<Object> getObjectsByQuery(String location, boolean checkRights) throws ObjectResolverException
      Fetches objects by an object resolver query.
      Parameters:
      location - the object resolver query
      checkRights - if permissions should be checked
      Returns:
      the objects found
      Throws:
      ObjectResolverException - if the query is not valid or something happens during query execution
    • getObjectsByQuery

      Collection<Object> getObjectsByQuery(String location) throws ObjectResolverException
      Fetch objects by an object resolver query. Permissions are checked.
      Parameters:
      location - the object resolver query
      Returns:
      the objects found
      Throws:
      ObjectResolverException - if the query is not valid or something happens during query execution
    • getUnscopedTerminalSession

      TerminalSession getUnscopedTerminalSession()
    • getSingleObjectOfTypeByQuery

      <T> T getSingleObjectOfTypeByQuery(Class<T> type, String query, TerminalSession session, Class<? extends Right>... rights) throws ObjectResolverException
      Throws:
      ObjectResolverException
    • convertResultSetToCommandResult

      CommandResult convertResultSetToCommandResult(ResultSet rs) throws SQLException
      Throws:
      SQLException
    • convertSimpleMapToCommandResult

      CommandResult convertSimpleMapToCommandResult(List<String> headlines, String emptyTableMessage, Map<String,Object> map)
      Creates a CommandResult that contains a table created from the given map. The table contains the map keys as the first table column and their corresponding values as the second table column.
      Parameters:
      headlines - headlines of the CommandResult. Each headline is printed in a new row. Note that these are NOT the table headers.
      emptyTableMessage - message to show if the map is empty.
      map - the map. Its keys map to the first table column of the result, their corresponding values to its second table column.
      Returns:
      a CommandResult containing the given map as a table.
    • convertSimpleMapToCommandResult

      CommandResult convertSimpleMapToCommandResult(List<String> headlines, Map<String,Object> map)
      Creates a CommandResult that contains a table created from the given map. The table contains the map keys as the first table column and their corresponding values as the second table column.
      Parameters:
      headlines - headlines of the CommandResult. Each headline is printed in a new row. Note that these are NOT the table headers.
      map - the map. Its keys map to the first table column of the result, their corresponding values to its second table column.
      Returns:
      a CommandResult containing the given map as a table.
    • convertSimpleMapToTableModel

      RSTableModel convertSimpleMapToTableModel(Map<String,Object> map)
    • getWidthForText

      int getWidthForText(String text)
      Gets the width of the given text in pixels if its rendered in the terminal
      Parameters:
      text - The text
      Returns:
      the width in pixels.
    • convertSimpleListToTableModel

      RSTableModel convertSimpleListToTableModel(String headline, List<String> list)
    • convertSimpleListToCommandResult

      CommandResult convertSimpleListToCommandResult(String headline, List<String> list)
    • convertListOfListsToCommandResult

      CommandResult convertListOfListsToCommandResult(String headline, List<List<String>> lists)
    • convertSimpleMapListToCommandResult

      CommandResult convertSimpleMapListToCommandResult(List<String> headlines, String emptyTableMessage, List<Map<String,String>> mapList, List<String> firstKeys, Map<String,String> keyToText)
      Creates a CommandResult that contains a table created from the given list of maps. The map keys map to the table headers, their corresponding values map to the table values. All maps must have the same size. The order of the headers is not defined. If the firstHeaders attribute is given, the table headers contain the given firstHeaders in first place and their order is preserved. All firstHeaders must be contained in all maps.
      Parameters:
      headlines - headlines of the CommandResult. Each headline is printed in a new row. Note that these are NOT the table headers.
      emptyTableMessage - message to shwo if the list of maps is empty.
      mapList - the list of maps.
      firstKeys - the ordered first map keys to appear in the table
      keyToDisplayText - maps the map keys to a display text
      Returns:
      a CommandResult containing the given list of maps as a table.
    • convertSimpleMapListToTableModel

      RSTableModel convertSimpleMapListToTableModel(String emptyTableMessage, List<Map<String,String>> mapList, List<String> firstKeys, Map<String,String> keyToText)
    • join

      String join(List<String> list, boolean sort)
      Joins the list with ", ". If sort is true, sorts the given list alphabetically
      Parameters:
      list - the list
      sort - if false, just joins without sorting
      Returns:
      the converted string