public class Cpe extends Object implements ICpe, Serializable
| Constructor and Description |
|---|
Cpe(Part part,
String vendor,
String product,
String version,
String update,
String edition,
String language,
String swEdition,
String targetSw,
String targetHw,
String other)
Constructs a new immutable CPE object that represents the Well Form Named
defined in the CPE 2.3 specification.
|
| Modifier and Type | Method and Description |
|---|---|
static Relation |
compareAttribute(Part left,
Part right) |
static Relation |
compareAttribute(String left,
String right) |
protected static boolean |
compareAttributes(Part left,
Part right)
This does not follow the spec precisely because ANY compared to NA is
classified as undefined by the spec; however, in this implementation ANY
will match NA and return true.
|
protected static boolean |
compareAttributes(String left,
String right)
This does not follow the spec precisely because ANY compared to NA is
classified as undefined by the spec; however, in this implementation ANY
will match NA and return true.
|
int |
compareTo(Object o)
CompareTo is used for sorting, this does not implement any CPE Matching
rules.
|
protected static int |
compareVersions(String left,
String right)
Compare version numbers to obtain the correct ordering.
|
boolean |
equals(Object obj) |
String |
getEdition()
Gets the edition for the CPE entry.
|
String |
getLanguage()
Gets the language for the CPE entry.
|
String |
getOther()
Gets the other component for the CPE entry.
|
Part |
getPart()
Gets the part for the CPE entry.
|
String |
getProduct()
Gets the product for the CPE entry.
|
String |
getSwEdition()
Gets the software edition for the CPE entry.
|
String |
getTargetHw()
Gets the target hardware environment for the CPE entry.
|
String |
getTargetSw()
Gets the target software environment for the CPE entry.
|
String |
getUpdate()
Gets the update for the CPE entry.
|
String |
getVendor()
Gets the vendor for the CPE entry.
|
String |
getVersion()
Gets the version for the CPE entry.
|
String |
getWellFormedEdition()
Gets the well formed formatted edition for the CPE entry.
|
String |
getWellFormedLanguage()
Gets the well formed formatted language for the CPE entry.
|
String |
getWellFormedOther()
Gets the well formed formatted other component for the CPE entry.
|
String |
getWellFormedProduct()
Gets the well formed formatted product for the CPE entry.
|
String |
getWellFormedSwEdition()
Gets the well formed formatted software edition for the CPE entry.
|
String |
getWellFormedTargetHw()
Gets the well formed formatted target hardware environment for the CPE
entry.
|
String |
getWellFormedTargetSw()
Gets the well formed formatted target software environment for the CPE
entry.
|
String |
getWellFormedUpdate()
Gets the well formed formatted update for the CPE entry.
|
String |
getWellFormedVendor()
Gets the well formed formatted vendor for the CPE entry.
|
String |
getWellFormedVersion()
Gets the well formed formatted version for the CPE entry.
|
int |
hashCode() |
boolean |
matchedBy(ICpe target)
Determines if the target CPE matches the CPE.
|
boolean |
matches(ICpe target)
Determines if the CPE matches the given target CPE.
|
String |
toCpe22Uri()
Converts the CPE into the CPE 2.2 URI format.
|
String |
toCpe23FS()
Converts the CPE into the CPE 2.3 Formatted String.
|
String |
toString() |
public Cpe(Part part, String vendor, String product, String version, String update, String edition, String language, String swEdition, String targetSw, String targetHw, String other) throws CpeValidationException
null will
be set to the default
LogicalValue.ANY. All values
passed in must be well formed (i.e. special characters quoted with a
backslash).part - the type of entry: application, operating system, or hardwarevendor - the vendor of the CPE entryproduct - the product of the CPE entryversion - the version of the CPE entryupdate - the update of the CPE entryedition - the edition of the CPE entrylanguage - the language of the CPE entryswEdition - the swEdition of the CPE entrytargetSw - the targetSw of the CPE entrytargetHw - the targetHw of the CPE entryother - the other of the CPE entryCpeValidationException - thrown if one of the CPE entries is
invalidpublic Part getPart()
Gets the part for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
public String getVendor()
Gets the vendor for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
public String getProduct()
Gets the product for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getProduct in interface ICpepublic String getVersion()
Gets the version for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getVersion in interface ICpepublic String getUpdate()
Gets the update for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
public String getEdition()
Gets the edition for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getEdition in interface ICpepublic String getLanguage()
Gets the language for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getLanguage in interface ICpepublic String getSwEdition()
Gets the software edition for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getSwEdition in interface ICpepublic String getTargetSw()
Gets the target software environment for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getTargetSw in interface ICpepublic String getTargetHw()
Gets the target hardware environment for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getTargetHw in interface ICpepublic String getOther()
Gets the other component for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
public String getWellFormedVendor()
Gets the well formed formatted vendor for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedVendor in interface ICpepublic String getWellFormedProduct()
Gets the well formed formatted product for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedProduct in interface ICpepublic String getWellFormedVersion()
Gets the well formed formatted version for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedVersion in interface ICpepublic String getWellFormedUpdate()
Gets the well formed formatted update for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedUpdate in interface ICpepublic String getWellFormedEdition()
Gets the well formed formatted edition for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedEdition in interface ICpepublic String getWellFormedLanguage()
Gets the well formed formatted language for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedLanguage in interface ICpepublic String getWellFormedSwEdition()
Gets the well formed formatted software edition for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedSwEdition in interface ICpepublic String getWellFormedTargetSw()
Gets the well formed formatted target software environment for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedTargetSw in interface ICpepublic String getWellFormedTargetHw()
Gets the well formed formatted target hardware environment for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedTargetHw in interface ICpepublic String getWellFormedOther()
Gets the well formed formatted other component for the CPE entry.
cpe:2.3:[part]:[vendor]:[product]:[version]:[update]:[edition]:[language]:[sw_edition]:[target_sw]:[target_hw]:[other]
getWellFormedOther in interface ICpepublic String toCpe22Uri() throws CpeEncodingException
toCpe22Uri in interface ICpeCpeEncodingException - thrown if the CPE is not well formedpublic String toCpe23FS()
public boolean matches(ICpe target)
public boolean matchedBy(ICpe target)
protected static boolean compareAttributes(Part left, Part right)
left - the left value to compareright - the right value to comparetrue if the left value matches the right value;
otherwise falseprotected static boolean compareAttributes(String left, String right)
left - the left value to compareright - the right value to comparetrue if the left value matches the right value;
otherwise falsepublic int compareTo(Object o)
compareTo in interface Comparableo - the CPE to compareprotected static int compareVersions(String left, String right)
left - the left hand version for comparisonright - the right hand version for comparison-1 if left is before the right; 0 if
the left and right are equal;1 if left is after the rightCopyright © 2018–2023. All rights reserved.