use of org.xwiki.extension.event.ExtensionInstallFailedEvent in project xwiki-platform by xwiki.
the class RepairXarJob method repairExtension.
/**
* @param localExtension the local extension to install
* @param namespace the namespace where to install extension
* @param dependency indicate of the extension is installed as a dependency of another
* @param managedDependencies the managed dependencies
* @throws InstallException failed to repair extension
*/
private void repairExtension(LocalExtension localExtension, String namespace, boolean dependency, Map<String, ExtensionDependency> managedDependencies) throws InstallException {
this.progressManager.pushLevelProgress(2, this);
this.observationManager.notify(new ExtensionInstallingEvent(localExtension.getId(), namespace), localExtension);
InstalledExtension installedExtension = null;
try {
this.progressManager.startStep(this);
Collection<? extends ExtensionDependency> dependencies = localExtension.getDependencies();
if (!dependencies.isEmpty()) {
this.progressManager.pushLevelProgress(dependencies.size(), dependencies);
try {
for (ExtensionDependency extensionDependency : dependencies) {
this.progressManager.startStep(dependencies);
// Replace with managed dependency if any
ExtensionDependency resolvedDependency = ExtensionUtils.getDependency(extensionDependency, managedDependencies, localExtension);
repairDependency(resolvedDependency, namespace, ExtensionUtils.append(managedDependencies, localExtension));
this.progressManager.endStep(dependencies);
}
} finally {
this.progressManager.popLevelProgress(dependencies);
}
}
this.progressManager.endStep(this);
this.progressManager.startStep(this);
installedExtension = this.installedRepository.installExtension(localExtension, namespace, dependency);
} finally {
if (installedExtension != null) {
this.observationManager.notify(new ExtensionInstalledEvent(installedExtension.getId(), namespace), installedExtension);
} else {
this.observationManager.notify(new ExtensionInstallFailedEvent(localExtension.getId(), namespace), localExtension);
}
this.progressManager.popLevelProgress(this);
}
}
Aggregations