Search in sources :

Example 1 with LocalExtensionRepositoryException

use of org.xwiki.extension.repository.LocalExtensionRepositoryException in project xwiki-platform by xwiki.

the class RepairXarJob method getLocalXARExtension.

/**
 * @param extensionId the extension unique identifier
 * @return the stored local extension
 * @throws InstallException failed to store extension
 */
private LocalExtension getLocalXARExtension(ExtensionId extensionId) throws InstallException {
    LocalExtension localExtension = this.localRepository.getLocalExtension(extensionId);
    if (localExtension == null) {
        this.progressManager.pushLevelProgress(2, this);
        try {
            this.progressManager.startStep(this);
            Extension extension = this.repositoryManager.resolve(extensionId);
            this.progressManager.endStep(this);
            this.progressManager.startStep(this);
            if (extension.getType().equals(XarExtensionHandler.TYPE)) {
                localExtension = this.localExtensionRepository.storeExtension(extension);
            }
            this.progressManager.endStep(this);
        } catch (ResolveException e) {
            throw new InstallException("Failed to find extension", e);
        } catch (LocalExtensionRepositoryException e) {
            throw new InstallException("Failed save extension in local repository", e);
        } finally {
            this.progressManager.popLevelProgress(this);
        }
    } else if (!localExtension.getType().equals(XarExtensionHandler.TYPE)) {
        localExtension = null;
    }
    return localExtension;
}
Also used : Extension(org.xwiki.extension.Extension) InstalledExtension(org.xwiki.extension.InstalledExtension) LocalExtension(org.xwiki.extension.LocalExtension) ResolveException(org.xwiki.extension.ResolveException) LocalExtensionRepositoryException(org.xwiki.extension.repository.LocalExtensionRepositoryException) LocalExtension(org.xwiki.extension.LocalExtension) InstallException(org.xwiki.extension.InstallException)

Aggregations

Extension (org.xwiki.extension.Extension)1 InstallException (org.xwiki.extension.InstallException)1 InstalledExtension (org.xwiki.extension.InstalledExtension)1 LocalExtension (org.xwiki.extension.LocalExtension)1 ResolveException (org.xwiki.extension.ResolveException)1 LocalExtensionRepositoryException (org.xwiki.extension.repository.LocalExtensionRepositoryException)1