@ThreadSafe public class EngineVersionCheck extends java.lang.Object implements CachedWebDataSource
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CURRENT_ENGINE_RELEASE
The property key indicating when the last version check occurred.
|
static java.lang.String |
ENGINE_VERSION_CHECKED_ON
The property key indicating when the last version check occurred.
|
| Modifier | Constructor and Description |
|---|---|
|
EngineVersionCheck()
Constructs a new engine version check utility.
|
protected |
EngineVersionCheck(Settings settings)
Constructs a new engine version check utility for testing.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
getCurrentReleaseVersion()
Retrieves the current released version number from the github
documentation site.
|
protected java.lang.String |
getUpdateToVersion()
Getter for updateToVersion - only used for testing.
|
boolean |
purge(Engine engine)
Deletes any locally cached data.
|
protected void |
setUpdateToVersion(java.lang.String version)
Setter for updateToVersion - only used for testing.
|
protected boolean |
shouldUpdate(long lastChecked,
long now,
DatabaseProperties properties,
java.lang.String currentVersion)
Determines if a new version of the dependency-check engine has been
released.
|
boolean |
update(Engine engine)
Downloads the current released version number and compares it to the
running engine's version number.
|
public static final java.lang.String ENGINE_VERSION_CHECKED_ON
public static final java.lang.String CURRENT_ENGINE_RELEASE
protected EngineVersionCheck(Settings settings)
settings - the configured settingspublic EngineVersionCheck()
protected java.lang.String getUpdateToVersion()
protected void setUpdateToVersion(java.lang.String version)
version - the version to testpublic boolean update(Engine engine) throws UpdateException
update in interface CachedWebDataSourceengine - a reference to the dependency-check engineUpdateException - thrown if the local database properties could not
be updatedprotected boolean shouldUpdate(long lastChecked,
long now,
DatabaseProperties properties,
java.lang.String currentVersion)
throws UpdateException
lastChecked - the epoch time of the last version checknow - the current epoch timeproperties - the database properties objectcurrentVersion - the current version of dependency-checktrue if a newer version of the database has been
released; otherwise falseUpdateException - thrown if there is an error connecting to the
github documentation site or accessing the local database.protected java.lang.String getCurrentReleaseVersion()
public boolean purge(Engine engine)
CachedWebDataSourcepurge in interface CachedWebDataSourceengine - a reference to the dependency-check enginetrue if the purge was successful; otherwise
falseCopyright© 2012-21 Jeremy Long. All Rights Reserved.