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.
|
RollbackOptions |
createRollbackOptions(String pkgId,
String key,
String version) |
RollbackOptions |
createRollbackOptions(UpdateOptions opt,
String key) |
UpdateOptions |
createUpdateOptions(String pkgId,
File file,
File targetDir) |
void |
doUpdate(String key,
Version version,
UpdateOptions 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 hotreloaded.
|
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 UpdateOptions createUpdateOptions(String pkgId, File file, File targetDir)
public RollbackOptions createRollbackOptions(String pkgId, String key, String version)
public RollbackOptions createRollbackOptions(UpdateOptions opt, String key)
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
opt
- Exception,
- VersionAlreadyExistExceptionorg.nuxeo.connect.update.PackageException
public File getRollbackTarget(RollbackOptions opt)
FIXME: Only handle simple cases for now (ignores version, etc...), e.g only tested with the main Studio jars.
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(String key, Version version, UpdateOptions opt) throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
Copyright © 2012 Nuxeo SA. All Rights Reserved.