use of org.xwiki.extension.ExtensionException in project xwiki-platform by xwiki.
the class WikiEventListener method copyInstalledExtension.
private void copyInstalledExtension(InstalledExtension installedExtension, String sourceNamespace, String targetNamespace) {
if (!installedExtension.isInstalled(targetNamespace) && !installedExtension.isInstalled(null)) {
// Copy dependencies first
for (ExtensionDependency dependency : installedExtension.getDependencies()) {
InstalledExtension installedDependency = this.installedRepository.getInstalledExtension(dependency.getId(), sourceNamespace);
if (installedDependency != null) {
copyInstalledExtension(installedDependency, sourceNamespace, targetNamespace);
}
}
// Copy extension
try {
// Installed extension
this.extensionHandlerManager.initialize(installedExtension, targetNamespace);
// Register extension as installed
this.installedRepository.installExtension(installedExtension, targetNamespace, installedExtension.isDependency(sourceNamespace));
} catch (ExtensionException e) {
this.logger.error("Failed to copy extension [{}] from namespace [{}] to namespace [{}]", installedExtension, sourceNamespace, targetNamespace, e);
}
}
}
Aggregations