public class NvdApiDataSource extends java.lang.Object implements CachedWebDataSource
Modifier and Type | Class and Description |
---|---|
protected static class |
NvdApiDataSource.UrlData |
Constructor and Description |
---|
NvdApiDataSource() |
Modifier and Type | Method and Description |
---|---|
protected NvdApiDataSource.UrlData |
extractUrlData(java.lang.String nvdDataFeedUrl) |
protected java.util.Properties |
getRemoteCacheProperties(java.lang.String url,
java.lang.String pattern)
Downloads the metadata properties of the NVD API cache.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getUpdatesNeeded(java.lang.String url,
java.lang.String filePattern,
java.util.Properties cacheProperties,
java.time.ZonedDateTime now)
Determines if the index needs to be updated.
|
boolean |
purge(Engine engine)
Deletes any locally cached data.
|
boolean |
update(Engine engine)
Determines if an update to the current data store is needed, if it is the
new data is downloaded from the Internet and imported into the current
cached data store.
|
public boolean update(Engine engine) throws UpdateException
CachedWebDataSource
update
in interface CachedWebDataSource
engine
- a reference to the dependency-check engineUpdateException
- is thrown if there is an exception downloading
the data or updating the data store.protected NvdApiDataSource.UrlData extractUrlData(java.lang.String nvdDataFeedUrl)
public boolean purge(Engine engine)
CachedWebDataSource
purge
in interface CachedWebDataSource
engine
- a reference to the dependency-check enginetrue
if the purge was successful; otherwise
false
protected final java.util.Map<java.lang.String,java.lang.String> getUpdatesNeeded(java.lang.String url, java.lang.String filePattern, java.util.Properties cacheProperties, java.time.ZonedDateTime now) throws UpdateException
url
- the URL of the NVD API cachefilePattern
- the string format pattern for the cached files (e.g.
"nvdcve-{0}.json.gz")cacheProperties
- the properties from the remote NVD API cachenow
- the start time of the update processUpdateException
- Is thrown if there is an issue with the last
updated properties fileprotected final java.util.Properties getRemoteCacheProperties(java.lang.String url, java.lang.String pattern) throws UpdateException
url
- the URL to the NVD API cacheUpdateException
- thrown if the properties file could not be
downloadedCopyright© 2012-21 Jeremy Long. All Rights Reserved.