Interface ICommonJobs

All Known Implementing Classes:
CommonJobs

public interface ICommonJobs
Interface used for common jobs.
Author:
Christopher Mindus
  • Method Details

    • destroyProcess

      void destroyProcess()
      Destroys a potentially executing process.
    • downloadFile

      void downloadFile(String webFile, File destFile) throws IOException, InterruptedException
      Download a file using HTTP.
      Parameters:
      webFile - The web file using HTTP.
      destFile - The local file system file where to place it.
      Throws:
      IOException - For errors.
      InterruptedException - If the process is interrupted.
    • extractArchive

      void extractArchive(File jarExe, File archive, File dest, boolean deleteArchive) throws IOException, InterruptedException
      Extracts an archive file.
      Parameters:
      jarExe - The Jar executable.
      archive - The file to extract.
      dest - The directory to place the extracted files in.
      deleteArchive - Flag to delete the archive.
      Throws:
      IOException - For errors.
      InterruptedException - If the process is interrupted.
    • downloadExtractArchive

      void downloadExtractArchive(File jarExe, File tempDir, String url, File dest) throws IOException, InterruptedException
      Creates a temporary folder and downloads and extracts an archive file that contains a single directory with some name. This directory is then moved to the requested location and renamed.

      The extraction process is done using Java code and not with a Jar or other utility. Supported formats are ".zip", ".jar", ".tar", ".tar.gz".

      Parameters:
      jarExe - The Jar executable: if null, Java code will be used instead (also applies for ".tar" and ".tar.gz" file extensions.
      tempDir - The temporary directory.
      url - The archive file's URL to download.
      dest - The destination directory.
      Throws:
      IOException
      InterruptedException
    • exec

      default int exec(boolean showOutput, File dir, Map<String,String> env, StringBuilder output, String... commands) throws IOException, InterruptedException
      Executes a short command, typically for testing.
      Parameters:
      showOutput - Shows the output of the process.
      dir - Current directory for the process.
      env - The environment to use, null for default.
      output - The StringBuilder that is filled with the output from the process.
      commands - Commands to execute.
      Returns:
      The return value.
      Throws:
      IOException - For errors.
      InterruptedException - If the process is interrupted.
    • exec

      default int exec(boolean showOutput, File dir, Map<String,String> env, StringBuilder output, List<String> commands) throws IOException, InterruptedException
      Executes a short command, typically for testing.
      Parameters:
      showOutput - Shows the output of the process.
      dir - Current directory for the process.
      env - The environment to use, null for default.
      output - The StringBuilder that is filled with the output from the process.
      commands - Commands to execute.
      Returns:
      The return value.
      Throws:
      IOException - For errors.
      InterruptedException - If the process is interrupted.
    • exec

      int exec(boolean showOutput, String echo, File dir, Map<String,String> env, StringBuilder output, String... commands) throws IOException, InterruptedException
      Executes a short command, typically for testing.
      Parameters:
      showOutput - Shows the output of the process.
      echo - If non-null, what is placed in the output stream.
      dir - Current directory for the process.
      env - The environment to use, null for default.
      output - The StringBuilder that is filled with the output from the process.
      commands - Commands to execute.
      Returns:
      The return value.
      Throws:
      IOException - For errors.
      InterruptedException - If the process is interrupted.