Klasse Component
- Alle implementierten Schnittstellen:
Cloneable
The CycloneDX specification supports more information for a component than this type currently exposes.
This class is a type exposed by this Ant Library. When using the
inherited refid attribute it can reference an instance
defined previously - in which case no child elements or other
attributes are allowed.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifikator und TypKlasseBeschreibungstatic classRepresents a dependency of a component.static classRepresents a tag. -
Feldübersicht
Von Klasse geerbte Felder org.apache.tools.ant.types.DataType
checked, refVon Klasse geerbte Felder org.apache.tools.ant.ProjectComponent
location, project -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifikator und TypMethodeBeschreibungvoidadd(org.apache.tools.ant.types.Resource resource) Sets the resource the component is about.voidaddAuthor(org.cyclonedx.model.OrganizationalContact author) Adds an author to the component.voidAdds a nested component.voidAdds an external reference to the component.voidAdds a set of external references to the component.voidAdds a license to this component.voidAdds a tag to the component.voidAdds a dependency to this component.protected voidaddHashes(org.cyclonedx.model.Component component, org.cyclonedx.Version bomVersion) If this component has a nested resource child, all hashes supported by the CycloneDX Core library for the spec version are created and added to the given component.voidaddManufacturer(Organization manufacturer) Sets the manufacturer of the component.voidaddProperty(org.cyclonedx.model.Property property) Adds a property to the component.voidaddSupplier(Organization supplier) Sets the supplier of the component.booleanWhether dependencies are unknoown.static ComponentcreateFileComponent(org.apache.tools.ant.Project project, org.apache.tools.ant.types.Resource r) Creates a new "file" type component for a resource.org.apache.tools.ant.types.resources.UnionContainer for SBOM link resource.protected voiddieOnCircularReference(Stack<Object> stk, org.apache.tools.ant.Project p) Gets the bom-ref of the component.Gets the dependencies of the component.getGroup()Gets the group of the component.getName()Gets the name of the component.Recursively returns the nested components of this component.getPurl()Gets the Package-URL (purl) of the component.protected ComponentgetRef()Perform the check for circular references and return the referenced Component.resolve()Read the linked SBOM (if any) and merge its content with the one already defined for this component.voidSets the bom-ref of the component.voidsetCopyright(String copyright) Sets the copyright of the component.voidsetDescription(String description) Sets the decription of the component.voidSets the group of the component.voidsetIsExternal(boolean isExternal) Sets whether the component is external.voidsetMimeType(String mimeType) Sets the mime-type of the component.voidSets the name of the component.voidsetPublisher(String publisher) Sets the publisher of the component.voidSets the Package-URL (purl) of the component.voidsetScope(ComponentScope scope) Sets the scope of this component.voidsetSupplierIsManufacturer(boolean supplierIsManufacturer) If set totruethe supplier will also be used to provide the manufacturer information.voidsetType(ComponentType type) Sets the type of the component.voidsetUnknownDependencies(boolean unknownDependencies) Sets whether the dependencies of this component are unknown.voidsetVersion(String version) Sets the version of the component.org.cyclonedx.model.ComponenttoAdditionalCycloneDxComponent(org.cyclonedx.Version bomVersion) Translates this component to a CycloneDX component suitable for the components.component.protected org.cyclonedx.model.ComponenttoCycloneDxComponent(org.cyclonedx.Version bomVersion) Maps all common data except forscopeandisExternal.org.cyclonedx.model.ComponenttoMainCycloneDxComponent(org.cyclonedx.Version bomVersion) Translates this component to a CycloneDX component suitable for the metadata.component.Von Klasse geerbte Methoden org.apache.tools.ant.types.DataType
checkAttributesAllowed, checkChildrenAllowed, circularReference, clone, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, setRefid, tooManyAttributes, toStringVon Klasse geerbte Methoden org.apache.tools.ant.ProjectComponent
getDescription, getLocation, getProject, log, log, setLocation, setProject
-
Konstruktordetails
-
Component
public Component()
-
-
Methodendetails
-
add
public void add(org.apache.tools.ant.types.Resource resource) Sets the resource the component is about.At most one resource can be set. Without a nested resource the component will not have any "hashes" when written to the SBOM.
- Parameter:
resource- the resource holding the component's content
-
setType
Sets the type of the component.Defaults to "library".
- Parameter:
type- component type
-
setName
-
setGroup
Sets the group of the component.- Parameter:
group- component group
-
setVersion
Sets the version of the component.- Parameter:
version- component version
-
setPurl
Sets the Package-URL (purl) of the component.- Parameter:
purl- component Package URL
-
setBomRef
Sets the bom-ref of the component.- Parameter:
bomRef- component bom-ref
-
setDescription
Sets the decription of the component.- Setzt außer Kraft:
setDescriptionin Klasseorg.apache.tools.ant.ProjectComponent- Parameter:
description- component description
-
setPublisher
Sets the publisher of the component.- Parameter:
publisher- component publisher
-
setCopyright
Sets the copyright of the component.- Parameter:
copyright- component copyright
-
setMimeType
Sets the mime-type of the component.- Parameter:
mimeType- component mime-type
-
addManufacturer
Sets the manufacturer of the component.At most one manufacturer can be set.
- Parameter:
manufacturer- component manufacturer
-
addSupplier
Sets the supplier of the component.At most one supplier can be set.
- Parameter:
supplier- compoment supplier
-
addAuthor
public void addAuthor(org.cyclonedx.model.OrganizationalContact author) Adds an author to the component.- Parameter:
author- component author
-
addConfiguredTag
Adds a tag to the component.- Parameter:
tag- component tag
-
addProperty
public void addProperty(org.cyclonedx.model.Property property) Adds a property to the component.- Parameter:
property- component property
-
setSupplierIsManufacturer
public void setSupplierIsManufacturer(boolean supplierIsManufacturer) If set totruethe supplier will also be used to provide the manufacturer information.- Parameter:
supplierIsManufacturer- whether to use supplier as manufacturer as well
-
addConfiguredLicense
Adds a license to this component.- Parameter:
l- compoment license
-
addConfiguredExternalReference
Adds an external reference to the component.- Parameter:
ref- external reference of component
-
addConfiguredExternalReferenceSet
Adds a set of external references to the component.- Parameter:
set- set of external references of component
-
setScope
Sets the scope of this component.Must not be set for the main component of the SBOM.
- Parameter:
scope- component scope
-
setIsExternal
public void setIsExternal(boolean isExternal) Sets whether the component is external.The CycloneDX Specification says: An external component is one that is not part of an assembly, but is expected to be provided by the environment, regardless of the component's scope.
Must not be set to
truefor the main component of the SBOM.Right now this attribute has no effect until the CycloneDX core library supports the specification version 1.7.
- Parameter:
isExternal- whether the component is external
-
addDependency
Adds a dependency to this component.- Parameter:
d- component dependency
-
setUnknownDependencies
public void setUnknownDependencies(boolean unknownDependencies) Sets whether the dependencies of this component are unknown.This flag is needed to be able to tell dependencies with unknown dependencies from components without any dependencies.
- Parameter:
unknownDependencies- whether dependencies are unknown
-
addComponent
-
createSbomLink
public org.apache.tools.ant.types.resources.Union createSbomLink()Container for SBOM link resource.- Gibt zurück:
- container for SBOM link resource
-
getName
-
getGroup
-
getPurl
Gets the Package-URL (purl) of the component.- Gibt zurück:
- the value set with or a Maven purl
derived from name, group and version if all three or set - or
null otherwise.
-
getBomRef
Gets the bom-ref of the component.- Gibt zurück:
- the value set with or the result of .
-
getDependencies
Gets the dependencies of the component.- Gibt zurück:
- component's dependencies
-
areDependenciesUnknown
public boolean areDependenciesUnknown()Whether dependencies are unknoown.- Gibt zurück:
- the value set with
setUnknownDependencies(boolean)orfalse.
-
getNestedComponents
-
resolve
Read the linked SBOM (if any) and merge its content with the one already defined for this component.- Gibt zurück:
- the "addtional" components defined in the linked SBOM that are dependencies of this component.
- Löst aus:
IOException- if reading the SBOM links fails
-
createFileComponent
public static Component createFileComponent(org.apache.tools.ant.Project project, org.apache.tools.ant.types.Resource r) Creates a new "file" type component for a resource.- Parameter:
project- project to use when resolving pathsr- the resource holding the file- Gibt zurück:
- the component
-
toMainCycloneDxComponent
public org.cyclonedx.model.Component toMainCycloneDxComponent(org.cyclonedx.Version bomVersion) throws IOException Translates this component to a CycloneDX component suitable for the metadata.component.- Parameter:
bomVersion- specification version- Gibt zurück:
- mapped component
- Löst aus:
IOException- if calculating component hashes fails
-
toAdditionalCycloneDxComponent
public org.cyclonedx.model.Component toAdditionalCycloneDxComponent(org.cyclonedx.Version bomVersion) throws IOException Translates this component to a CycloneDX component suitable for the components.component.- Parameter:
bomVersion- specification version- Gibt zurück:
- mapped component
- Löst aus:
IOException- if calculating component hashes fails
-
toCycloneDxComponent
protected org.cyclonedx.model.Component toCycloneDxComponent(org.cyclonedx.Version bomVersion) throws IOException Maps all common data except forscopeandisExternal.- Parameter:
bomVersion- specification version- Gibt zurück:
- mapped component
- Löst aus:
IOException- if calculating component hashes fails
-
addHashes
protected void addHashes(org.cyclonedx.model.Component component, org.cyclonedx.Version bomVersion) throws IOException If this component has a nested resource child, all hashes supported by the CycloneDX Core library for the spec version are created and added to the given component.- Parameter:
component- component to add hashes tobomVersion- specification version- Löst aus:
IOException- if calculating component hashes fails
-
getRef
Perform the check for circular references and return the referenced Component.- Gibt zurück:
Component.
-
dieOnCircularReference
-