public class CloudStoreUpdaterCore extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_KEY_DOWNGRADE
Configuration property key controlling whether we do a downgrade.
|
static String |
CONFIG_KEY_ENABLED
Configuration property key controlling whether the updater is enabled.
|
static String |
CONFIG_KEY_FORCE
Configuration property key controlling whether to force the update.
|
static String |
CONFIG_KEY_REMOTE_VERSION_CACHE_VALIDITY_PERIOD
Configuration property key controlling how long a queried remote version is cached (and thus how
often the server is asked for it).
|
static long |
DEFAULT_REMOTE_VERSION_CACHE_VALIDITY_PERIOD |
protected FileFilter |
fileFilterIgnoringBackupAndUpdaterDir |
protected FileFilter |
fileFilterIgnoringBackupDir |
static String |
INSTALLATION_PROPERTIES_ARTIFACT_ID |
static String |
INSTALLATION_PROPERTIES_FILE_NAME |
static String |
INSTALLATION_PROPERTIES_VERSION |
static String |
PROTOCOL_FILE |
static String |
PROTOCOL_JAR |
static String |
remoteUpdatePropertiesURL |
static String |
remoteVersionURL |
Constructor and Description |
---|
CloudStoreUpdaterCore() |
Modifier and Type | Method and Description |
---|---|
void |
createUpdaterDirIfUpdateNeeded()
Creates the
updaterDir , if an update is necessary. |
protected File |
getBackupDir() |
protected File |
getInstallationDir()
Gets the installation directory.
|
protected Properties |
getInstallationProperties() |
protected Version |
getLocalVersion() |
protected Version |
getRemoteVersion() |
protected File |
getUpdaterDir() |
protected String |
resolve(String template)
Resolves the given
template by replacing all its variables with their actual values. |
public static final String PROTOCOL_FILE
public static final String PROTOCOL_JAR
public static final String INSTALLATION_PROPERTIES_FILE_NAME
public static final String INSTALLATION_PROPERTIES_ARTIFACT_ID
public static final String INSTALLATION_PROPERTIES_VERSION
public static final String remoteVersionURL
public static final String remoteUpdatePropertiesURL
public static final String CONFIG_KEY_DOWNGRADE
true
and the local version is newer than the version on the server
a downgrade is done, too.
The configuration can be overridden by a system property - see Config.SYSTEM_PROPERTY_PREFIX
.
public static final String CONFIG_KEY_ENABLED
If it is enabled, it periodically checks whether an update is
available, and if so, performs the update. Note, that CONFIG_KEY_FORCE
(or its
corresponding system property "cloudstore.updater.force") have no effect, if the updater is disabled!
The configuration can be overridden by a system property - see Config.SYSTEM_PROPERTY_PREFIX
.
public static final String CONFIG_KEY_FORCE
This is only designed as configuration key for consistency reasons - usually, you likely don't want to write
this into a configuration file! Instead, you probably want to pass this as a system property - see
Config.SYSTEM_PROPERTY_PREFIX
(and the example below).
Note, that forcing an update has no effect, if the updater is disabled! Thus, if you want to force an update under all circumstances (whether the updater is enabled or not), you should pass both. As system properties, this looks as follows:
-Dcloudstore.updater.force=true -Dcloudstore.updater.enabled=true
public static final long DEFAULT_REMOTE_VERSION_CACHE_VALIDITY_PERIOD
public static final String CONFIG_KEY_REMOTE_VERSION_CACHE_VALIDITY_PERIOD
The configuration can be overridden by a system property - see Config.SYSTEM_PROPERTY_PREFIX
.
protected final FileFilter fileFilterIgnoringBackupDir
protected final FileFilter fileFilterIgnoringBackupAndUpdaterDir
public CloudStoreUpdaterCore()
protected Version getRemoteVersion()
protected Version getLocalVersion()
protected Properties getInstallationProperties()
protected String resolve(String template)
template
by replacing all its variables with their actual values.
Variables are written as "${variable}" similarly to Ant and Maven. See
IOUtil.replaceTemplateVariables(String, Map)
for further details.
The variable values are obtained from the installationProperties
.
template
- the template to be resolved. Must not be null
.protected File getInstallationDir() throws IllegalStateException
The implementation in CloudStoreUpdaterCore
assumes that this class is located in a library
(i.e. a JAR file) inside the installation directory.
null
.IllegalStateException
- if the installation directory cannot be determined.public void createUpdaterDirIfUpdateNeeded()
updaterDir
, if an update is necessary.
If an update is not necessary, this method returns silently without doing anything.
The check, whether an update is needed, is not done every time. The result is cached for a certain time period to reduce HTTP queries.
This method does not throw any exception. In case of an exception, it is only logged and this method returns normally.
protected File getUpdaterDir()
protected File getBackupDir()
Copyright © 2013-2014. All Rights Reserved.