agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/managers/launchers/AbstractJobLauncher.java
/**
     * Unzips a public {@link Software} deployment archive and ensures the contents corresponding to the
     * {@link Software#getExecutablePath()} are rooted at the tempAppDir.
     *
     * @throws SoftwareUnavailableException if the archive cannot be unzipped
     */
Unzips a public  Software deployment archive and ensures the contents corresponding to the
Software#getExecutablePath() are rooted at the tempAppDir.

@throws SoftwareUnavailableException if the archive cannot be unzipped
Unzips a public Software deployment archive and ensures the contents corresponding to the Software#getExecutablePath () are rooted at the tempAppDir . @throws SoftwareUnavailableException if the archive cannot be unzipped
protected void unzipPublicSoftwareArchive() throws IOException, SoftwareUnavailableException {
        File zippedFile = new File(getTempAppDir(), FilenameUtils.getName(getSoftware().getDeploymentPath()));
        File[] unzippedFiles = null;
        String checksum = MD5Checksum.getMD5Checksum(zippedFile);
        if (StringUtils.isBlank(getSoftware().getChecksum()) ||
                StringUtils.equals(checksum, getSoftware().getChecksum())) {
            try {
                ZipUtil.unzip(zippedFile, getTempAppDir());
                unzippedFiles = getTempAppDir().listFiles();
                if (unzippedFiles != null && unzippedFiles.length > 1) {
                    FileUtils.deleteQuietly(zippedFile);
                } else {
                    throw new SoftwareUnavailableException("Failed to unpack the application bundle.");
                }
            } catch (IOException e) {
                throw new SoftwareUnavailableException("Failed to unzip the application bundle.", e);
            }
        } else {
            notifyOfSoftwareChecksumChangeEvent(getSoftware(), checksum);
            throw new SoftwareUnavailableException("Public app bundle for " + getSoftware().getUniqueName() +
                    " has changed. Please verify this app and try again.");
        }
        boolean foundDeploymentPath = false;
        if (!Files.exists(getTempAppDir().toPath().resolve(getSoftware().getExecutablePath()))) {
            for (File unzippedFileItem : unzippedFiles) {
                if (unzippedFileItem.isDirectory()) {
                    if (Files.exists(unzippedFileItem.toPath().resolve(getSoftware().getExecutablePath()))) {
                        File renamedUnzippedFileItem = new File(getTempAppDir().getPath() + ".copy");
                        FileUtils.moveDirectory(unzippedFileItem, renamedUnzippedFileItem);
                        FileUtils.deleteDirectory(getTempAppDir());
                        renamedUnzippedFileItem.renameTo(getTempAppDir());
                        foundDeploymentPath = true;
                        break;
                    }
                }
            }
            if (!foundDeploymentPath) {
                log.error("Unable to find app path for public app " + getSoftware().getUniqueName());
                throw new SoftwareUnavailableException("Unable to find the wrapper template for " +
                        getSoftware().getUniqueName() + ". The executablePath in the app definition does not exist.");
            }
        }
    }
protected void unzipPublicSoftwareArchive ( ) throws IOException , SoftwareUnavailableException { File zippedFile = new File ( getTempAppDir ( ) , FilenameUtils . getName ( getSoftware ( ) . getDeploymentPath ( ) ) ) ; File [ ] unzippedFiles = null ; String checksum = MD5Checksum . getMD5Checksum ( zippedFile ) ; if ( StringUtils . isBlank ( getSoftware ( ) . getChecksum ( ) ) || StringUtils . equals ( checksum , getSoftware ( ) . getChecksum ( ) ) ) { try { ZipUtil . unzip ( zippedFile , getTempAppDir ( ) ) ; unzippedFiles = getTempAppDir ( ) . listFiles ( ) ; if ( unzippedFiles != null && unzippedFiles . length > 1 ) { FileUtils . deleteQuietly ( zippedFile ) ; } else { throw new SoftwareUnavailableException ( "Failed to unpack the application bundle." ) ; } } catch ( IOException e ) { throw new SoftwareUnavailableException ( "Failed to unzip the application bundle." , e ) ; } } else { notifyOfSoftwareChecksumChangeEvent ( getSoftware ( ) , checksum ) ; throw new SoftwareUnavailableException ( "Public app bundle for " + getSoftware ( ) . getUniqueName ( ) + " has changed. Please verify this app and try again." ) ; } boolean foundDeploymentPath = false ; if ( ! Files . exists ( getTempAppDir ( ) . toPath ( ) . resolve ( getSoftware ( ) . getExecutablePath ( ) ) ) ) { for ( File unzippedFileItem : unzippedFiles ) { if ( unzippedFileItem . isDirectory ( ) ) { if ( Files . exists ( unzippedFileItem . toPath ( ) . resolve ( getSoftware ( ) . getExecutablePath ( ) ) ) ) { File renamedUnzippedFileItem = new File ( getTempAppDir ( ) . getPath ( ) + ".copy" ) ; FileUtils . moveDirectory ( unzippedFileItem , renamedUnzippedFileItem ) ; FileUtils . deleteDirectory ( getTempAppDir ( ) ) ; renamedUnzippedFileItem . renameTo ( getTempAppDir ( ) ) ; foundDeploymentPath = true ; break ; } } } if ( ! foundDeploymentPath ) { log . error ( "Unable to find app path for public app " + getSoftware ( ) . getUniqueName ( ) ) ; throw new SoftwareUnavailableException ( "Unable to find the wrapper template for " + getSoftware ( ) . getUniqueName ( ) + ". The executablePath in the app definition does not exist." ) ; } } }
Unzips a public {@link Software} deployment archive and ensures the contents corresponding to the
 {@link Software#getExecutablePath()} are rooted at the tempAppDir.
Unzips a public { @link Software } deployment archive and ensures the contents corresponding to the { @link Software#getExecutablePath () } are rooted at the tempAppDir .
// validate the checksum to make sure the app itself hasn't  changed // remove zip archive after unpacking // if the archive was created by zipping the deployment folder rather than it's contents, then // the executable path will be relative to the enclosing directory into which the deployment assets // were unpacked. Here we check for the expected path and, if not found, iterate over the first-level // directories (should only be one) to find the executable. If not found at that point, we // cannot invoke the app as we have no wrapper template to launch. // if the executable path exists within the dir, then make that dir the tempAppDir // by