/** * Gets probable persitence roots from given parentArchive using given subArchiveRootScanner * @param parentArchive the parentArchive within which probable persitence roots need to be scanned * @param subArchivePURootScanner the scanner instance used for the scan * @see com.sun.enterprise.deployment.archivist.EarPersistenceArchivist.SubArchivePURootScanner * @return Map of puroot path to probable puroot archive. */ protected static Map<String, ReadableArchive> getProbablePersistenceRoots(ReadableArchive parentArchive, SubArchivePURootScanner subArchivePURootScanner) { Map<String, ReadableArchive> probablePersitenceArchives = new HashMap<String, ReadableArchive>(); ReadableArchive archiveToScan = subArchivePURootScanner.getSubArchiveToScan(parentArchive); if(archiveToScan != null) { // The subarchive exists Enumeration<String> entries = archiveToScan.entries(); String puRootPrefix = subArchivePURootScanner.getPurRootPrefix(); while(entries.hasMoreElements()) { String entry = entries.nextElement(); if(subArchivePURootScanner.isProbablePuRootJar(entry)) { ReadableArchive puRootArchive = getSubArchive(archiveToScan, entry, false /* expect entry to be present */); if(puRootArchive != null) { String puRoot = puRootPrefix + entry; probablePersitenceArchives.put(puRoot, puRootArchive); } } } } return probablePersitenceArchives; }
/** * Gets probable persitence roots from given parentArchive using given subArchiveRootScanner * @param parentArchive the parentArchive within which probable persitence roots need to be scanned * @param subArchivePURootScanner the scanner instance used for the scan * @see com.sun.enterprise.deployment.archivist.EarPersistenceArchivist.SubArchivePURootScanner * @return Map of puroot path to probable puroot archive. */ protected static Map<String, ReadableArchive> getProbablePersistenceRoots(ReadableArchive parentArchive, SubArchivePURootScanner subArchivePURootScanner) { Map<String, ReadableArchive> probablePersitenceArchives = new HashMap<String, ReadableArchive>(); ReadableArchive archiveToScan = subArchivePURootScanner.getSubArchiveToScan(parentArchive); if(archiveToScan != null) { // The subarchive exists Enumeration<String> entries = archiveToScan.entries(); String puRootPrefix = subArchivePURootScanner.getPurRootPrefix(); while(entries.hasMoreElements()) { String entry = entries.nextElement(); if(subArchivePURootScanner.isProbablePuRootJar(entry)) { ReadableArchive puRootArchive = getSubArchive(archiveToScan, entry, false /* expect entry to be present */); if(puRootArchive != null) { String puRoot = puRootPrefix + entry; probablePersitenceArchives.put(puRoot, puRootArchive); } } } } return probablePersitenceArchives; }