Search in sources :

Example 1 with XarFile

use of org.xwiki.xar.XarFile in project xwiki-platform by xwiki.

the class DiffXarJob method diff.

private void diff(InstalledExtension installedExtension, String namespace, Set<LocalDocumentReference> alreadydone) {
    Collection<ExtensionId> excludedExtensions = getRequest().getExcludedExtensions();
    if (XarExtensionHandler.TYPE.equals(installedExtension.getType()) && (excludedExtensions == null || !excludedExtensions.contains(installedExtension.getId()))) {
        if (getRequest().isVerbose()) {
            this.logger.info("Computing differences for [{}] on namespace [{}]", installedExtension.getId(), namespace);
        }
        try {
            WikiReference wikiReference = new WikiReference(XarHandlerUtils.getWikiFromNamespace(namespace));
            diff(new XarFile(new File(installedExtension.getFile().getAbsolutePath())), wikiReference, installedExtension.getId(), alreadydone);
        } catch (UnsupportedNamespaceException e) {
            this.logger.error("Failed to extract the wiki id from the namespace [{}].", namespace, e);
        } catch (IOException e) {
            this.logger.error("Failed to read the XAR file of the extension [{}].", installedExtension.getId(), e);
        } catch (XarException e) {
            this.logger.error("Failed to parse the XAR file of the extension [{}].", installedExtension.getId(), e);
        }
    }
}
Also used : UnsupportedNamespaceException(org.xwiki.extension.xar.internal.handler.UnsupportedNamespaceException) XarFile(org.xwiki.xar.XarFile) XarException(org.xwiki.xar.XarException) ExtensionId(org.xwiki.extension.ExtensionId) IOException(java.io.IOException) WikiReference(org.xwiki.model.reference.WikiReference) XarFile(org.xwiki.xar.XarFile) File(java.io.File)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 ExtensionId (org.xwiki.extension.ExtensionId)1 UnsupportedNamespaceException (org.xwiki.extension.xar.internal.handler.UnsupportedNamespaceException)1 WikiReference (org.xwiki.model.reference.WikiReference)1 XarException (org.xwiki.xar.XarException)1 XarFile (org.xwiki.xar.XarFile)1