Package org.spdx.maven.utils
Class SpdxV2FileCollector
java.lang.Object
org.spdx.maven.utils.AbstractFileCollector
org.spdx.maven.utils.SpdxV2FileCollector
Collects SPDX file information from directories in SPDX Spec version 2 format
The method collectFilesInDirectory(FileSet[] filesets) will scan and create SPDX File information for
all files in the filesets.
- Author:
- Gary O'Neall
-
Field Summary
Fields inherited from class org.spdx.maven.utils.AbstractFileCollector
CHECKSUM_ALGORITHMS, EXT_TO_FILE_TYPE, LOG -
Constructor Summary
ConstructorsConstructorDescriptionSpdxFileCollector collects SPDX file information for files -
Method Summary
Modifier and TypeMethodDescriptionvoidcollectFiles(List<org.apache.maven.shared.model.fileset.FileSet> fileSets, String baseDir, SpdxDefaultFileInformation defaultFileInformation, Map<String, SpdxDefaultFileInformation> pathSpecificInformation, org.spdx.library.model.v2.SpdxPackage projectPackage, org.spdx.library.model.v2.enumerations.RelationshipType relationshipType, org.spdx.library.model.v2.SpdxDocument spdxDoc, Set<String> algorithms) Collect file information in the directory (including subdirectories).Collection<org.spdx.library.model.v2.SpdxFile>getFiles()Collection<org.spdx.library.model.v2.license.AnyLicenseInfo>List<org.spdx.library.model.v2.SpdxSnippet>org.spdx.library.model.v2.SpdxPackageVerificationCodegetVerificationCode(String spdxFilePath, org.spdx.library.model.v2.SpdxDocument spdxDoc) Create a verification code from all SPDX files collectedMethods inherited from class org.spdx.maven.utils.AbstractFileCollector
convertChecksumToString, convertFilePathToSpdxFileName, extensionToFileType, generateChecksum, generateSha1, getExtension, isSourceFile, toRelativeFilePath
-
Constructor Details
-
SpdxV2FileCollector
public SpdxV2FileCollector()SpdxFileCollector collects SPDX file information for files
-
-
Method Details
-
collectFiles
public void collectFiles(List<org.apache.maven.shared.model.fileset.FileSet> fileSets, String baseDir, SpdxDefaultFileInformation defaultFileInformation, Map<String, SpdxDefaultFileInformation> pathSpecificInformation, org.spdx.library.model.v2.SpdxPackage projectPackage, org.spdx.library.model.v2.enumerations.RelationshipType relationshipType, org.spdx.library.model.v2.SpdxDocument spdxDoc, Set<String> algorithms) throws SpdxCollectionExceptionCollect file information in the directory (including subdirectories).- Parameters:
fileSets- FileSets containing the description of the directory to be scannedbaseDir- project base directory used to construct the relative paths for the SPDX filesdefaultFileInformation- Information on default SPDX field data for the filespathSpecificInformation- Map of path to file information used to override the default file informationrelationshipType- Type of relationship to the project packageprojectPackage- Package to which the files belongspdxDoc- SPDX document which contains the extracted license infos that may be needed for license parsingalgorithms- algorithms to use to generate checksums- Throws:
SpdxCollectionException- on incompatible types in an SPDX collection
-
getFiles
- Returns:
- SPDX Files which have been acquired through the collectFilesInDirectory method
-
getSnippets
- Returns:
- SPDX Snippets collected through the collectFilesInDirectory method
-
getLicenseInfoFromFiles
- Returns:
- all license information used in the SPDX files
-
getVerificationCode
public org.spdx.library.model.v2.SpdxPackageVerificationCode getVerificationCode(String spdxFilePath, org.spdx.library.model.v2.SpdxDocument spdxDoc) throws NoSuchAlgorithmException, org.spdx.core.InvalidSPDXAnalysisException Create a verification code from all SPDX files collected- Parameters:
spdxFilePath- Complete file path for the SPDX file - this will be excluded from the verification codespdxDoc- SPDX document which will contain the package verification code.- Returns:
- package verification code
- Throws:
NoSuchAlgorithmException- on error generating checksumorg.spdx.core.InvalidSPDXAnalysisException- on SPDX parsing errors
-