Package org.spdx.maven.utils
Class AbstractDocumentBuilder
java.lang.Object
org.spdx.maven.utils.AbstractDocumentBuilder
- Direct Known Subclasses:
SpdxV2DocumentBuilder
,SpdxV3DocumentBuilder
Abstract class to create SPDX documents.
Subclasses of this class implement specific SPDX specification versions of the document
- Author:
- Gary O'Neall
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ModelCopyManager
protected DateFormat
protected boolean
protected org.spdx.storage.ISerializableModelStore
static final String
protected OutputFormat
protected org.apache.maven.project.MavenProject
protected File
protected static final String
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractDocumentBuilder
(org.apache.maven.project.MavenProject project, boolean generatePurls, File spdxFile, OutputFormat outputFormatEnum) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
addNonStandardLicenses
(NonStandardLicense[] nonStandardLicenses) abstract void
collectSpdxFileInformation
(List<org.apache.maven.shared.model.fileset.FileSet> sources, String baseDir, SpdxDefaultFileInformation defaultFileInformation, HashMap<String, SpdxDefaultFileInformation> pathSpecificInformation, Set<String> checksumAlgorithms) Collect information at the file level, fill in the SPDX documentabstract void
fillSpdxDocumentInformation
(SpdxProjectInformation projectInformation) abstract org.spdx.core.CoreModelObject
abstract String
mavenLicenseListToSpdxLicenseExpression
(List<org.apache.maven.model.License> mavenLicenses) abstract void
Saves the SPDX document to the fileverify()
Verifies the top level document
-
Field Details
-
UNSPECIFIED
- See Also:
-
NULL_SHA1
- See Also:
-
project
protected org.apache.maven.project.MavenProject project -
generatePurls
protected boolean generatePurls -
spdxFile
-
outputFormatEnum
-
modelStore
protected org.spdx.storage.ISerializableModelStore modelStore -
copyManager
-
format
-
-
Constructor Details
-
AbstractDocumentBuilder
public AbstractDocumentBuilder(org.apache.maven.project.MavenProject project, boolean generatePurls, File spdxFile, OutputFormat outputFormatEnum) throws SpdxBuilderException - Parameters:
project
- Maven ProjectgeneratePurls
- If true, generated Package URLs for all package referencesspdxFile
- File to store the SPDX document resultsoutputFormatEnum
- File format for the SPDX file- Throws:
SpdxBuilderException
- On errors building the document
-
-
Method Details
-
fillSpdxDocumentInformation
public abstract void fillSpdxDocumentInformation(SpdxProjectInformation projectInformation) throws SpdxBuilderException - Parameters:
projectInformation
- Information about project extracted from Maven metadata and parameters- Throws:
SpdxBuilderException
- on errors adding document level information
-
collectSpdxFileInformation
public abstract void collectSpdxFileInformation(List<org.apache.maven.shared.model.fileset.FileSet> sources, String baseDir, SpdxDefaultFileInformation defaultFileInformation, HashMap<String, SpdxDefaultFileInformation> pathSpecificInformation, Set<String> checksumAlgorithms) throws SpdxBuilderExceptionCollect information at the file level, fill in the SPDX document- Parameters:
sources
- Source directories to be included in the documentbaseDir
- project base directory used to construct the relative paths for the SPDX filespathSpecificInformation
- Map of path to file information used to override the default file informationchecksumAlgorithms
- algorithms to use to generate checksums- Throws:
SpdxBuilderException
- on errors collecting files
-
saveSpdxDocumentToFile
Saves the SPDX document to the file- Throws:
SpdxBuilderException
- On any error saving the file
-
addNonStandardLicenses
public abstract void addNonStandardLicenses(NonStandardLicense[] nonStandardLicenses) throws SpdxBuilderException - Parameters:
nonStandardLicenses
- non standard licenses to add- Throws:
SpdxBuilderException
-
getProjectPackage
public abstract org.spdx.core.CoreModelObject getProjectPackage()- Returns:
- package representing the Mave project
-
mavenLicenseListToSpdxLicenseExpression
public abstract String mavenLicenseListToSpdxLicenseExpression(List<org.apache.maven.model.License> mavenLicenses) throws LicenseManagerException - Parameters:
mavenLicenses
- list of licenses- Returns:
- license expression representing the list of mavenLicenses
- Throws:
LicenseManagerException
- On error converting license
-
verify
Verifies the top level document- Returns:
- list of any errors or warnings
-