Class SpdxV2FileCollector

java.lang.Object
org.spdx.maven.utils.AbstractFileCollector
org.spdx.maven.utils.SpdxV2FileCollector

public class SpdxV2FileCollector extends AbstractFileCollector
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
  • 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 SpdxCollectionException
      Collect file information in the directory (including subdirectories).
      Parameters:
      fileSets - FileSets containing the description of the directory to be scanned
      baseDir - project base directory used to construct the relative paths for the SPDX files
      defaultFileInformation - Information on default SPDX field data for the files
      pathSpecificInformation - Map of path to file information used to override the default file information
      relationshipType - Type of relationship to the project package
      projectPackage - Package to which the files belong
      spdxDoc - SPDX document which contains the extracted license infos that may be needed for license parsing
      Throws:
      SpdxCollectionException - on incompatible types in an SPDX collection
    • getFiles

      public Collection<org.spdx.library.model.v2.SpdxFile> getFiles()
      Returns:
      SPDX Files which have been acquired through the collectFilesInDirectory method
    • getSnippets

      public List<org.spdx.library.model.v2.SpdxSnippet> getSnippets()
      Returns:
      SPDX Snippets collected through the collectFilesInDirectory method
    • getLicenseInfoFromFiles

      public Collection<org.spdx.library.model.v2.license.AnyLicenseInfo> 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 code
      spdxDoc - SPDX document which will contain the package verification code.
      Returns:
      package verification code
      Throws:
      NoSuchAlgorithmException - on error generating checksum
      org.spdx.core.InvalidSPDXAnalysisException - on SPDX parsing errors