public class AutoUpdate extends Object
Requires a valid 51Degrees licence key and read/write access to the file system folder where the downloaded file should be written.
Class only pulls the data file once per invocation and has no concept of the environment. For a sample implementation please see the AutoUpdate class in the 'Webapp' package.
When implementing custom auto updates keep in mind the following points:
Please note that auto update will return a
status code. If the status code is
AUTO_UPDATE_SUCCESS then no further actions required, if the status
code is AUTO_UPDATE_NOT_NEEDED then no newer data is currently
available. All other codes indicate there is a problem with the update.
dataset.nextUpdate;. The next update date is set by 51Degrees
when the data file gets generated. Use this date to avoid unnecessary
automatic update requests.
If your key is blacklisted the update server will respond with 403 Forbidden. Please contact 51Degrees as soon as possible. We will not blacklist your key without contacting you first.
| Constructor and Description |
|---|
AutoUpdate() |
| Modifier and Type | Method and Description |
|---|---|
static URL |
fullUrl(String[] licenseKeys)
Constructs the URL needed to download Enhanced device data.
|
static Dataset |
getDataSetWithHeaderLoaded(File binaryFile)
Provides access to the header fields of a data set.
|
static AutoUpdateStatus |
update(String[] licenseKeys,
String binaryFilePath)
Uses the given license keys to perform a device data update, writing the
data to the file system and filling providers from this factory instance
with it.
|
static AutoUpdateStatus |
update(String licenseKey,
String dataFilePath)
Uses the given license key to perform a device data update, writing the
data to the file system and filling providers from this factory instance
with it.
|
public static AutoUpdateStatus update(String licenseKey, String dataFilePath) throws FileNotFoundException, NoSuchAlgorithmException, IllegalArgumentException, Exception
licenseKey - the licence key to submit to the serverdataFilePath - path to the device data fileFileNotFoundException - if a file could not be found.NoSuchAlgorithmException - if MD5 not available.IllegalArgumentExceptionExceptionpublic static AutoUpdateStatus update(String[] licenseKeys, String binaryFilePath) throws FileNotFoundException, NoSuchAlgorithmException, IllegalArgumentException, Exception
licenseKeys - the licence key to use for the update request.binaryFilePath - where the original data file is located.FileNotFoundException - if a file could not be found.NoSuchAlgorithmException - if MD5 is not available.IllegalArgumentExceptionExceptionpublic static Dataset getDataSetWithHeaderLoaded(File binaryFile) throws IOException
binaryFile - path to a binary data file uncompressedIOExceptionpublic static URL fullUrl(String[] licenseKeys) throws MalformedURLException
licenseKeys - Array of licence key strings.MalformedURLExceptionCopyright © 2017 51Degrees. All rights reserved.