Package com.iizix.run.common
Class CommonJobs
java.lang.Object
com.iizix.run.common.CommonJobs
- All Implemented Interfaces:
- ICommonJobs
Class implementing common jobs in a non-Eclipse environment. The CommonBuilder variables can be tested for OS, etc.
- Author:
- Christopher Mindus
- Constructor SummaryConstructorsConstructorDescription- CommonJobs- (IPropProgressMonitor monitor, boolean isVerbose) Constructor.- CommonJobs- (IPropProgressMonitor monitor, IPrintAdapter printer, boolean isVerbose) Constructor.
- Method SummaryModifier and TypeMethodDescription- voidDestroys a potentially executing process.- void- downloadExtractArchive- (File jarExe, File tempDir, String url, File dest) Creates a temporary folder and downloads and extracts an archive file that contains a single directory with some name.- void- downloadFile- (String webFile, File destFile) Download a file using HTTP.- int- exec- (boolean showOutput, String echo, File dir, Map<String, - String> env, StringBuilder output, String... commands) Executes a short command, typically for testing.- void- extractArchive- (File jarExe, File archive, File dest, boolean deleteArchive) Extracts a Zip or Jar file.- Methods inherited from class java.lang.Object- clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait- Methods inherited from interface com.iizix.run.common.ICommonJobs- exec, exec
- Constructor Details- CommonJobsConstructor.- Parameters:
- monitor- The progress monitor.
- isVerbose- The verbose flag.
 
- CommonJobsConstructor.- Parameters:
- monitor- The progress monitor.
- printer- The printer for output.
- isVerbose- The verbose flag.
 
 
- Method Details- destroyProcesspublic void destroyProcess()Destroys a potentially executing process.- Specified by:
- destroyProcessin interface- ICommonJobs
 
- downloadFileDownload a file using HTTP.- Specified by:
- downloadFilein interface- ICommonJobs
- 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.
 
- extractArchivepublic void extractArchive- (File jarExe, File archive, File dest, boolean deleteArchive) throws IOException, InterruptedException Extracts a Zip or Jar file.- Specified by:
- extractArchivein interface- ICommonJobs
- 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.
 
- downloadExtractArchivepublic 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.- Specified by:
- downloadExtractArchivein interface- ICommonJobs
- 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- For failures.
- InterruptedException
 
- execpublic int exec- (boolean showOutput, String echo, File dir, Map<String, - String> env, StringBuilder output, String... commands) throws IOException, InterruptedExceptionExecutes a short command, typically for testing.- Specified by:
- execin interface- ICommonJobs
- 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.