Search in sources :

Example 1 with MemberEntry

use of com.sun.enterprise.admin.servermgmt.xml.stringsubs.MemberEntry in project Payara by payara.

the class ArchiveEntryWrapperImpl method extract.

/**
 * Extract all the substitutable entries for an archive.
 * It also takes care of extracting substitutable entries
 * from nested archives.
 *
 * @throws IOException If any IO error occurs during extraction.
 */
private void extract() throws IOException {
    for (Object object : _archive.getArchiveOrMemberEntry()) {
        String extratFilePath = _extractDir.getAbsolutePath() + File.separator;
        if (object instanceof Archive) {
            Archive archive = (Archive) object;
            File file = new File(extratFilePath + archive.getName());
            try {
                extractEntry(archive.getName(), file);
            } catch (IllegalArgumentException e) {
                continue;
            }
            _extractedEntries.put(archive.getName(), file);
            new ArchiveEntryWrapperImpl(archive, extratFilePath, this);
            _noOfExtractedEntries.incrementAndGet();
        } else if (object instanceof MemberEntry) {
            MemberEntry entry = (MemberEntry) object;
            File file = new File(extratFilePath + entry.getName());
            try {
                extractEntry(entry.getName(), file);
            } catch (IllegalArgumentException e) {
                continue;
            }
            _extractedEntries.put(entry.getName(), file);
            getAllArchiveMemberList().add(new ArchiveMemberHandler(file, this));
            _noOfExtractedEntries.incrementAndGet();
        } else {
            _logger.log(Level.WARNING, SLogger.INVALID_ARCHIVE_ENTRY, new Object[] { object, _archive.getName() });
        }
    }
}
Also used : Archive(com.sun.enterprise.admin.servermgmt.xml.stringsubs.Archive) JarFile(java.util.jar.JarFile) File(java.io.File) MemberEntry(com.sun.enterprise.admin.servermgmt.xml.stringsubs.MemberEntry)

Aggregations

Archive (com.sun.enterprise.admin.servermgmt.xml.stringsubs.Archive)1 MemberEntry (com.sun.enterprise.admin.servermgmt.xml.stringsubs.MemberEntry)1 File (java.io.File)1 JarFile (java.util.jar.JarFile)1