@Override public JspMetadata archiveEntryToMeta(ZipEntryMetadata archiveEntry) { File file = archiveEntry.getFilePointer(); LOG.debug("Processing: " + file.getAbsolutePath()); JspMetadata meta = new JspMetadata(); meta.setArchiveMeta(archiveEntry.getArchiveMeta()); meta.setFilePointer(file); return meta; } }
@Override public XmlMetadata archiveEntryToMeta(ZipEntryMetadata archiveEntry) { File file = archiveEntry.getFilePointer(); LOG.debug("Processing XML: " + file.getAbsolutePath()); FileMetadata meta = null; if (file.length() > 1048576L * 1) { LOG.warn("XML larger than 1 MB: " + file.getAbsolutePath() + "; Skipping processing."); meta = new FileMetadata(); meta.setArchiveMeta(archiveEntry.getArchiveMeta()); meta.setFilePointer(file); Summary sr = new Summary(); sr.setDescription("File is too large; skipped."); sr.setLevel(NotificationLevel.WARNING); meta.getDecorations().add(sr); } else { XmlMetadata xmlMeta = new XmlMetadata(); xmlMeta.setArchiveMeta(archiveEntry.getArchiveMeta()); xmlMeta.setFilePointer(file); meta = xmlMeta; return xmlMeta; } return null; }
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; } }
@Override public ManifestMetadata archiveEntryToMeta(ZipEntryMetadata archiveEntry) { File file = archiveEntry.getFilePointer(); LOG.debug("Processing Manifest: " + file.getAbsolutePath().toString()); if (file.length() > 1048576L * 1) { LOG.warn("Manifest larger than 1 MB: " + file.getAbsolutePath() + "; Skipping processing."); return null; } ManifestMetadata meta = new ManifestMetadata(); meta.setArchiveMeta(archiveEntry.getArchiveMeta()); meta.setFilePointer(file); Classification classification = new Classification(); StoryPointEffort he = new StoryPointEffort(); he.setHours(0); classification.setEffort(he); classification.setDescription("ArchiveMetadata Manifest"); meta.getDecorations().add(classification); return meta; }
ZipMetadata zipMeta = (ZipMetadata)archiveEntry.getArchiveMeta(); ZipFile zipFile = zipMeta.getZipFile(); ZipEntry entry = archiveEntry.getZipEntry(); javaMeta.setArchiveMeta(archiveEntry.getArchiveMeta()); javaMeta.setClassDependencies(clzImports); javaMeta.setQualifiedClassName(className);
@Override public JavaMetadata archiveEntryToMeta(ZipEntryMetadata archiveEntry) { File file = archiveEntry.getFilePointer(); JavaMetadata meta = new JavaMetadata(); meta.setArchiveMeta(archiveEntry.getArchiveMeta()); meta.setFilePointer(file); populateMeta(meta); if(LOG.isDebugEnabled()) { LOG.debug("Processing: " + file.getAbsolutePath()); LOG.debug("Processing: " + meta.getQualifiedClassName()); } if (!customerPackageResolver.isCustomerPkg(meta.getQualifiedClassName())) { LOG.trace("Not customer type: "+meta.getQualifiedClassName()); return null; } if (blacklistPackageResolver.containsGenerated(meta.getClassDependencies())) { LOG.trace("Class is generated. Skip profiling."); return null; } // third does the class contain any blacklists? if (!blacklistPackageResolver.containsBlacklist(meta.getClassDependencies())) { LOG.trace("Class does not contain blacklists."); return null; } return meta; }