Class TerminalService

java.lang.Object
io.github.eggy03.dmidecode.terminal.TerminalService

public class TerminalService extends Object
A service class that provides a way to launch a terminal session

for internal use

Since:
0.1.0
  • Field Details

    • log

      private static final org.slf4j.Logger log
  • Constructor Details

    • TerminalService

      public TerminalService()
  • Method Details

    • executeCommand

      public @NonNull TerminalResult executeCommand(@NonNull DMIType dmiType, long timeoutSeconds)
      Launches a standalone PowerShell session, executes DMIType.getCommand() and returns the result
      Parameters:
      dmiType - The non-null enum value containing the command which shall be executed
      timeoutSeconds - The non-null, positive value of time in seconds after which the session will be force stopped.
      Returns:
      The result of the query executed, wrapped in TerminalResult
      Since:
      0.3.0
    • execute

      @NonNull TerminalResult execute(@NonNull String command, long timeoutSeconds)
      Launches a standalone Terminal session and executes commands and returns the result
      Parameters:
      command - The command to be executed in the Terminal, must not be null
      timeoutSeconds - Time in seconds after which the session will be force stopped, must not be null.
      Returns:
      The result of the command executed, wrapped in TerminalResult
      Throws:
      IllegalArgumentException - if timeout is in negative.
      Since:
      0.1.0