/** * Returns a {@link Library} representing the analyzed Java archive. * @return * @throws FileAnalysisException */ public Library getLibrary() throws FileAnalysisException { final Library lib = new Library(this.getSHA1()); lib.setDigestAlgorithm(DigestAlgorithm.SHA1); lib.setConstructs(this.getSharedConstructs()); lib.setLibraryId(this.libraryId); final Set<Property> p = new HashSet<Property>(); if(this.jarWriter.getOriginalManifest()!=null) { for(Object key: this.jarWriter.getOriginalManifest().getMainAttributes().keySet()) { p.add(new Property(PropertySource.JAVA_MANIFEST, key.toString(), this.jarWriter.getOriginalManifest().getMainAttributes().get(key).toString())); } } lib.setProperties(p); return lib; }
/** * Returns a {@link Library} representing the analyzed Java archive. * @return * @throws FileAnalysisException */ public Library getLibrary() throws FileAnalysisException { final Library lib = new Library(); if(this.getDigest()!=null) { lib.setDigest(this.getDigest()); lib.setDigestAlgorithm(DigestAlgorithm.MD5); } lib.setConstructs(this.getSharedConstructs()); // No properties are set return lib; }
/** * Returns a {@link Library} representing the analyzed archive. * @return * @throws FileAnalysisException */ public Library getLibrary() throws FileAnalysisException { Library lib = null; if(this.fileAnalyzer!=null && this.fileAnalyzer instanceof PythonArchiveAnalyzer) { lib = ((PythonArchiveAnalyzer)this.fileAnalyzer).getLibrary(); lib.setLibraryId(new LibraryId(this.getName(), this.getName(), this.getVersion())); } else { lib = new Library(); lib.setDigest(this.getDigest()); lib.setDigestAlgorithm(DigestAlgorithm.MD5); lib.setLibraryId(new LibraryId(this.getName(), this.getName(), this.getVersion())); if(this.getConstructs()!=null) lib.setConstructs(ConstructId.getSharedType(this.getConstructs().keySet())); } final Set<Property> p = new HashSet<Property>(); for(String key: this.getProperties().keySet()) { p.add(new Property(PropertySource.PIP, key, this.getProperties().get(key))); } lib.setProperties(p); return lib; }