protected void recursivelyCollectRequiredProvided(ZipMetadata meta, Map<String, GraphableClz> provided) { try { ZipEntry entry; Enumeration<?> e = meta.getZipFile().entries(); // locate a random class entry... while (e.hasMoreElements()) { entry = (ZipEntry) e.nextElement(); if (StringUtils.endsWith(entry.getName(), ".class")) { String className = extractClassName(entry.getName()); Set<String> required = extractImports(meta.getZipFile(), entry); ApplicationClz cg = new ApplicationClz(meta, className, required); provided.put(className, cg); } } } catch (Exception e) { LOG.error("Exception getting JDK version.", e); } for(ArchiveMetadata child : meta.getNestedArchives()) { ZipMetadata cast = (ZipMetadata) child; this.recursivelyCollectRequiredProvided(cast, provided); } }
try { ZipEntry entry; Enumeration<?> e = meta.getZipFile().entries(); DataInputStream in = null; try { in = new DataInputStream(meta.getZipFile().getInputStream(entry));
Enumeration<?> e = archive.getZipFile().entries();
protected Set<String> extractImports(ZipEntryMetadata archiveEntry) { try { // otherwise, load the class and get its imports. //TODO: make this work for directorymeta too. ZipMetadata zipMeta = (ZipMetadata)archiveEntry.getArchiveMeta(); ZipFile zipFile = zipMeta.getZipFile(); ZipEntry entry = archiveEntry.getZipEntry(); CtClass ctClz = new ClassPool().makeClass(zipFile.getInputStream(entry)); if (LOG.isDebugEnabled()) { for (String clz : ctClz.getClassFile2().getInterfaces()) { LOG.debug("Interfaces: " + clz); } LOG.debug("Super Class: " + ctClz.getClassFile2().getSuperclass()); } Set<String> clzImports = new HashSet<String>(castList(String.class, ctClz.getRefClasses())); return clzImports; } catch (Exception e) { LOG.error(e); return null; } }
Enumeration<?> e = archive.getZipFile().entries(); while (e.hasMoreElements()) { entry = (ZipEntry) e.nextElement();
ZipFile zipFile = zipMeta.getZipFile(); ZipEntry entry = archiveEntry.getZipEntry();