throw new IllegalStateException("Archive model doesn't have an archiveName: " + archiveModel.getFilePath());
private void setArchiveHashes(ArchiveModel payload) { if (payload.getMD5Hash() == null) { try (InputStream is = payload.asInputStream()) { String md5 = DigestUtils.md5Hex(is); payload.setMD5Hash(md5); } catch (IOException e) { throw new WindupException("Failed to read archive file at: " + payload.getFilePath() + " due to: " + e.getMessage(), e); } } if (payload.getSHA1Hash() == null) { try (InputStream is = payload.asInputStream()) { String sha1 = DigestUtils.sha1Hex(is); payload.setSHA1Hash(sha1); } catch (IOException e) { throw new WindupException("Failed to read archive file at: " + payload.getFilePath() + " due to: " + e.getMessage(), e); } } }
throw new IllegalStateException("Archive model doesn't have an archiveName: " + archiveModel.getFilePath());
private void setArchiveHashes(ArchiveModel payload) { if (payload.getMD5Hash() == null) { try (InputStream is = payload.asInputStream()) { String md5 = DigestUtils.md5Hex(is); payload.setMD5Hash(md5); } catch (IOException e) { throw new WindupException("Failed to read archive file at: " + payload.getFilePath() + " due to: " + e.getMessage(), e); } } if (payload.getSHA1Hash() == null) { try (InputStream is = payload.asInputStream()) { String sha1 = DigestUtils.sha1Hex(is); payload.setSHA1Hash(sha1); } catch (IOException e) { throw new WindupException("Failed to read archive file at: " + payload.getFilePath() + " due to: " + e.getMessage(), e); } } }
private void setArchiveHashes(ArchiveModel payload) { if (payload.getMD5Hash() == null) { try (InputStream is = payload.asInputStream()) { String md5 = DigestUtils.md5Hex(is); payload.setMD5Hash(md5); } catch (IOException e) { throw new WindupException("Failed to read archive file at: " + payload.getFilePath() + " due to: " + e.getMessage(), e); } } if (payload.getSHA1Hash() == null) { try (InputStream is = payload.asInputStream()) { String sha1 = DigestUtils.sha1Hex(is); payload.setSHA1Hash(sha1); } catch (IOException e) { throw new WindupException("Failed to read archive file at: " + payload.getFilePath() + " due to: " + e.getMessage(), e); } } }
throw new IllegalStateException("Archive model doesn't have an archiveName: " + archiveModel.getFilePath());
private void setParentProject(ArchiveModel archiveModel, MavenProjectModel projectModel) { if (archiveModel == null) return; if (archiveModel.getProjectModel() != null) { String mavenGAV = projectModel.getGroupId() + ":" + projectModel.getArtifactId() + ":" + projectModel.getVersion(); String archivePath = archiveModel.getFilePath(); LOG.info("Setting parent project for: " + mavenGAV + " to: " + archivePath); projectModel.setParentProject(archiveModel.getProjectModel()); } else { setParentProject(archiveModel.getParentArchive(), projectModel); } }
private void setParentProject(ArchiveModel archiveModel, MavenProjectModel projectModel) { if (archiveModel == null) return; if (archiveModel.getProjectModel() != null) { String mavenGAV = projectModel.getGroupId() + ":" + projectModel.getArtifactId() + ":" + projectModel.getVersion(); String archivePath = archiveModel.getFilePath(); LOG.info("Setting parent project for: " + mavenGAV + " to: " + archivePath); projectModel.setParentProject(archiveModel.getProjectModel()); } else { setParentProject(archiveModel.getParentArchive(), projectModel); } }
private void setParentProject(ArchiveModel archiveModel, MavenProjectModel projectModel) { if (archiveModel == null) { return; } else if (archiveModel.getProjectModel() != null) { String mavenGAV = projectModel.getGroupId() + ":" + projectModel.getArtifactId() + ":" + projectModel.getVersion(); String archivePath = archiveModel.getFilePath(); LOG.info("Setting parent project for: " + mavenGAV + " to: " + archivePath); projectModel.setParentProject(archiveModel.getProjectModel()); } else { setParentProject(archiveModel.getParentArchive(), projectModel); } }
boolean exclusivelyKnown = PackageNameMapping.isExclusivelyKnownArchive(event, archive.getFilePath());
boolean exclusivelyKnown = PackageNameMapping.isExclusivelyKnownArchive(event, archive.getFilePath());
LOG.info("Library from 3rd party vendor ("+org.getName()+"), skipping recursive mavenization: " + arch.getFilePath()); return null;
LOG.info("Library from 3rd party vendor ("+org.getName()+"), skipping recursive mavenization: " + arch.getFilePath()); return null;
@Override public void vertexPropertyChanged(Vertex vertex, String key, Object oldValue, Object setValue) { if (ArchiveModel.ARCHIVE_NAME.equals(key)) { ArchiveService archiveService = new ArchiveService(event.getGraphContext()); ArchiveModel archive = archiveService.frame(vertex); setArchiveHashes(archive); Coordinate coordinate = IdentifiedArchives.getCoordinateFromSHA1(archive.getSHA1Hash()); if (coordinate != null) { log.info("Identified archive: [" + archive.getFilePath() + "] as [" + coordinate + "] will not be unzipped or analyzed."); IdentifiedArchiveModel identifiedArchive = GraphService .addTypeToModel(event.getGraphContext(), archive, IdentifiedArchiveModel.class); ArchiveCoordinateModel coordinateModel = new GraphService<>(event.getGraphContext(), ArchiveCoordinateModel.class).create(); coordinateModel.setArtifactId(coordinate.getArtifactId()); coordinateModel.setGroupId(coordinate.getGroupId()); coordinateModel.setVersion(coordinate.getVersion()); coordinateModel.setClassifier(coordinate.getClassifier()); identifiedArchive.setCoordinate(coordinateModel); IgnoredArchiveModel ignoredArchive = GraphService.addTypeToModel(event.getGraphContext(), archive, IgnoredArchiveModel.class); ignoredArchive.setIgnoredRegex("Known open-source library"); } else { log.info("Failed to identify archive: " + archive.getFilePath()); } } }
identifiedArchive.setCoordinate(coordinateModel); LOG.info("Identified archive: [" + archive.getFilePath() + "] as [" + coordinate + "] will not be unzipped or analyzed."); IgnoredArchiveModel ignoredArchive = GraphService.addTypeToModel(context, archive, IgnoredArchiveModel.class); ignoredArchive.setIgnoredRegex("Known open-source library"); LOG.info("Archive not identified: " + archive.getFilePath() + " SHA1: " + archive.getSHA1Hash());
identifiedArchive.setCoordinate(coordinateModel); LOG.info("Identified archive: [" + archive.getFilePath() + "] as [" + coordinate + "] will not be unzipped or analyzed."); IgnoredArchiveModel ignoredArchive = GraphService.addTypeToModel(context, archive, IgnoredArchiveModel.class); ignoredArchive.setIgnoredRegex("Known open-source library"); LOG.info("Archive not identified: " + archive.getFilePath() + " SHA1: " + archive.getSHA1Hash());
duplicateArchive.setCanonicalArchive(canonicalArchive); duplicateArchive.setSHA1Hash(canonicalArchive.getSHA1Hash()); duplicateArchive.setFilePath(canonicalArchive.getFilePath()); duplicateArchive.setArchiveName(canonicalArchive.getArchiveName()); duplicateArchive.setFileName(canonicalArchive.getFileName());
duplicateArchive.setCanonicalArchive(canonicalArchive); duplicateArchive.setSHA1Hash(canonicalArchive.getSHA1Hash()); duplicateArchive.setFilePath(canonicalArchive.getFilePath()); duplicateArchive.setArchiveName(canonicalArchive.getArchiveName()); duplicateArchive.setFileName(canonicalArchive.getFileName());