Package org.spdx.rdfparser.model
Class Checksum
java.lang.Object
org.spdx.rdfparser.model.RdfModelObject
org.spdx.rdfparser.model.Checksum
- All Implemented Interfaces:
Cloneable,Comparable<Checksum>,IRdfModel
public class Checksum extends RdfModelObject implements Comparable<Checksum>
A Checksum is value that allows the contents of a file to be authenticated.
Even small changes to the content of the file will change its checksum.
This class allows the results of a variety of checksum and cryptographic
message digest algorithms to be represented.
- Author:
- Gary O'Neall
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChecksum.ChecksumAlgorithm -
Field Summary
Fields Modifier and Type Field Description static com.google.common.collect.ImmutableMap<Checksum.ChecksumAlgorithm,String>CHECKSUM_ALGORITHM_TO_TAGstatic com.google.common.collect.ImmutableMap<String,Checksum.ChecksumAlgorithm>CHECKSUM_TAG_TO_ALGORITHMFields inherited from class org.spdx.rdfparser.model.RdfModelObject
model, modelContainer, node, refreshOnGet, resource -
Constructor Summary
Constructors Constructor Description Checksum(IModelContainer modelContainer, org.apache.jena.graph.Node node)Checksum(Checksum.ChecksumAlgorithm algorithm, String checksumValue) -
Method Summary
Modifier and Type Method Description Checksumclone()intcompareTo(Checksum compare)booleanequivalent(IRdfModel compare)Returns true if the compare object contains properties which would be equal if they were contained in the same RDF Modelorg.apache.jena.rdf.model.ResourcefindDuplicateResource(IModelContainer modelContainer, String uri)Search the model to see if there is a duplicate resource either based on the URI or based on other information.protected static org.apache.jena.rdf.model.ResourcefindSpdxChecksum(org.apache.jena.rdf.model.Model model, Checksum checksum)Checksum.ChecksumAlgorithmgetAlgorithm()voidgetPropertiesFromModel()Fetch all of the properties from the model and populate the local Java propertiesorg.apache.jena.rdf.model.ResourcegetType(org.apache.jena.rdf.model.Model model)StringgetUri(IModelContainer modelContainer)Get the URI for this RDF object.StringgetValue()voidpopulateModel()Populate the RDF model from the Java propertiesvoidsetAlgorithm(Checksum.ChecksumAlgorithm algorithm)voidsetValue(String checksumValue)StringtoString()List<String>verify()Methods inherited from class org.spdx.rdfparser.model.RdfModelObject
addPropertyUriValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, addPropertyValue, arraysEquivalent, createResource, createResource, equals, equivalentConsideringNull, findAnnotationPropertyValues, findAnyLicenseInfoPropertyValue, findAnyLicenseInfoPropertyValues, findChecksumPropertyValue, findCreationInfoPropertyValue, findElementPropertyValue, findExternalDocRefPropertyValues, findExternalDocRefPropertyValues, findExternalRefPropertyValues, findIntPropertyValue, findMultipleChecksumPropertyValues, findMultipleDoapPropertyValues, findMultipleElementPropertyValues, findMultiplePropertyValues, findReferenceTypePropertyValue, findRelationshipPropertyValues, findReviewPropertyValues, findSinglePointerPropertyValue, findSinglePropertyValue, findStartEndPointerPropertyValues, findUriPropertyValue, findUriPropertyValues, findVerificationCodePropertyValue, getNode, hashCode, isRefreshOnGet, removePropertyValue, resourcesEqual, setMultipleObjectsForSameNode, setPropertyUriValue, setPropertyUriValues, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues, setSingleObjectForSameNode
-
Field Details
-
CHECKSUM_ALGORITHM_TO_TAG
public static final com.google.common.collect.ImmutableMap<Checksum.ChecksumAlgorithm,String> CHECKSUM_ALGORITHM_TO_TAG -
CHECKSUM_TAG_TO_ALGORITHM
public static final com.google.common.collect.ImmutableMap<String,Checksum.ChecksumAlgorithm> CHECKSUM_TAG_TO_ALGORITHM
-
-
Constructor Details
-
Checksum
-
Checksum
public Checksum(IModelContainer modelContainer, org.apache.jena.graph.Node node) throws InvalidSPDXAnalysisException- Parameters:
modelContainer-node-- Throws:
InvalidSPDXAnalysisException
-
-
Method Details
-
findSpdxChecksum
protected static org.apache.jena.rdf.model.Resource findSpdxChecksum(org.apache.jena.rdf.model.Model model, Checksum checksum) throws InvalidSPDXAnalysisException- Throws:
InvalidSPDXAnalysisException
-
getPropertiesFromModel
Description copied from class:RdfModelObjectFetch all of the properties from the model and populate the local Java properties- Specified by:
getPropertiesFromModelin classRdfModelObject- Throws:
InvalidSPDXAnalysisException
-
getAlgorithm
- Returns:
- the algorithm
-
setAlgorithm
- Parameters:
algorithm- the algorithm to set- Throws:
InvalidSPDXAnalysisException
-
getValue
- Returns:
- the checksumValue
-
setValue
- Parameters:
checksumValue- the checksumValue to set
-
verify
-
getUri
Description copied from class:RdfModelObjectGet the URI for this RDF object. Null if this is for an anonomous node.- Specified by:
getUriin classRdfModelObject- Returns:
-
getType
public org.apache.jena.rdf.model.Resource getType(org.apache.jena.rdf.model.Model model)- Specified by:
getTypein classRdfModelObject- Returns:
- the RDF class name for the object
-
findDuplicateResource
public org.apache.jena.rdf.model.Resource findDuplicateResource(IModelContainer modelContainer, String uri) throws InvalidSPDXAnalysisExceptionDescription copied from class:RdfModelObjectSearch the model to see if there is a duplicate resource either based on the URI or based on other information. Subclasses may choose to override this method to prevent duplicate resource from being created with the same properties.- Overrides:
findDuplicateResourcein classRdfModelObject- Returns:
- Any duplicate resource found. Null if no duplicate resource was found.
- Throws:
InvalidSPDXAnalysisException
-
populateModel
Description copied from class:RdfModelObjectPopulate the RDF model from the Java properties- Specified by:
populateModelin classRdfModelObject- Throws:
InvalidSPDXAnalysisException
-
clone
-
equivalent
Description copied from interface:IRdfModelReturns true if the compare object contains properties which would be equal if they were contained in the same RDF Model- Specified by:
equivalentin interfaceIRdfModel- Returns:
-
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<Checksum>
-