Package org.spdx.rdfparser
Class VerificationCodeGenerator
java.lang.Object
org.spdx.rdfparser.VerificationCodeGenerator
public class VerificationCodeGenerator extends Object
Generates a package verification code from a directory of source code or an array of
SPDXFiles.
A class implementing the IFileChecksumGenerator is supplied as a parameter to the constructor.
The method getFileChecksum is called for each file in the directory. This can
be used as a hook to capture all files in the directory and capture the checksum values at
a file level.- Author:
- Gary O'Neall
-
Constructor Summary
Constructors Constructor Description VerificationCodeGenerator(IFileChecksumGenerator fileChecksumGenerator) -
Method Summary
Modifier and Type Method Description SpdxPackageVerificationCodegeneratePackageVerificationCode(File sourceDirectory)SpdxPackageVerificationCodegeneratePackageVerificationCode(File sourceDirectory, File[] skippedFiles)Generate the SPDX Package Verification Code from a directory of files included in the archiveprotected SpdxPackageVerificationCodegeneratePackageVerificationCode(List<String> fileChecksums, String[] skippedFilePaths)SpdxPackageVerificationCodegeneratePackageVerificationCode(SpdxFile[] spdxFiles, String[] skippedFilePaths)Generate the SPDX Package Verification Code from an array of SPDXFilesstatic StringnormalizeFilePath(String nonNormalizedFilePath)Normalizes a file path per the SPDX spec
-
Constructor Details
-
Method Details
-
generatePackageVerificationCode
public SpdxPackageVerificationCode generatePackageVerificationCode(SpdxFile[] spdxFiles, String[] skippedFilePaths) throws NoSuchAlgorithmExceptionGenerate the SPDX Package Verification Code from an array of SPDXFiles- Parameters:
spdxFiles- Files to generate the VerificationCode fromskippedFilePaths- File path names to not include in the VerificationCode- Returns:
- VerificationCode based on all files in spdxFiles minus the skippedFilePaths
- Throws:
NoSuchAlgorithmException
-
generatePackageVerificationCode
public SpdxPackageVerificationCode generatePackageVerificationCode(File sourceDirectory, File[] skippedFiles) throws NoSuchAlgorithmException, IOExceptionGenerate the SPDX Package Verification Code from a directory of files included in the archive- Parameters:
sourceDirectory-- Returns:
- Throws:
NoSuchAlgorithmExceptionIOException
-
generatePackageVerificationCode
protected SpdxPackageVerificationCode generatePackageVerificationCode(List<String> fileChecksums, String[] skippedFilePaths) throws NoSuchAlgorithmException- Throws:
NoSuchAlgorithmException
-
normalizeFilePath
Normalizes a file path per the SPDX spec- Parameters:
nonNormalizedFilePath-- Returns:
-
generatePackageVerificationCode
public SpdxPackageVerificationCode generatePackageVerificationCode(File sourceDirectory) throws NoSuchAlgorithmException, IOException- Parameters:
sourceDirectory-skippedFiles-- Returns:
- Throws:
NoSuchAlgorithmExceptionIOException
-