public class UpdateManager extends Object
To manipulate the jar version registry you need to create a new instance of this class.
If you want to modify the registry then you may want to synchronize the entire update process. This is how is done in the Task run method.
Only reading the registry is thread safe.
TODO backup md5 are not really used since we rely on versions - we can remove md5
Modifier and Type | Field and Description |
---|---|
static String |
STUDIO_SNAPSHOT_VERSION |
Constructor and Description |
---|
UpdateManager(File serverRoot,
File regFile) |
Modifier and Type | Method and Description |
---|---|
Entry |
createEntry(String key)
Create a new entry in the registry given the entry key.
|
void |
doUpdate(File oldFile,
UpdateOptions opt)
Update oldFile with file pointed by opt
|
org.nuxeo.connect.update.task.update.JarUtils.Match<File> |
findBackupJar(String key) |
org.nuxeo.connect.update.task.update.JarUtils.Match<File> |
findInstalledJar(String key) |
File |
getBackupRoot() |
String |
getKey(UpdateOptions opt) |
Map<String,Entry> |
getRegistry() |
File |
getRollbackTarget(RollbackOptions opt)
Ugly method to know what file is going to be deleted before it is, so that it can be undeployed for hotreload.
|
String |
getServerRelativePath(File someFile) |
File |
getServerRoot() |
org.nuxeo.connect.update.task.Task |
getTask() |
String |
getVersionPath(UpdateOptions opt) |
void |
load() |
void |
rollback(RollbackOptions opt)
Perform a rollback.
|
void |
store() |
RollbackOptions |
update(UpdateOptions opt) |
public static final String STUDIO_SNAPSHOT_VERSION
public File getServerRoot()
public File getBackupRoot()
public org.nuxeo.connect.update.task.Task getTask()
public void load() throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
public void store() throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
public String getVersionPath(UpdateOptions opt)
public String getKey(UpdateOptions opt)
public RollbackOptions update(UpdateOptions opt) throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
public File getRollbackTarget(RollbackOptions opt)
FIXME: will only handle simple cases for now (ignores version, etc...), e.g only tested with the main Studio jars. Should use version from RollbackOptions
public void rollback(RollbackOptions opt) throws org.nuxeo.connect.update.PackageException
TODO the deleteOnExit is inherited from the current rollback command ... may be it should be read from the version that is rollbacked. (deleteOnExit should be an attribute of the entry not of the version)
opt
- org.nuxeo.connect.update.PackageException
public Entry createEntry(String key) throws org.nuxeo.connect.update.PackageException
key
- Exception
org.nuxeo.connect.update.PackageException
public org.nuxeo.connect.update.task.update.JarUtils.Match<File> findInstalledJar(String key)
public org.nuxeo.connect.update.task.update.JarUtils.Match<File> findBackupJar(String key)
public void doUpdate(File oldFile, UpdateOptions opt) throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
Copyright © 2015 Nuxeo SA. All rights reserved.