use of org.xwiki.extension.xar.internal.handler.UnsupportedNamespaceException in project xwiki-platform by xwiki.
the class InstalledExtensionSynchronizer method onEvent.
@Override
public void onEvent(Event event, Object source, Object data) {
ExtensionEvent extensionEvent = (ExtensionEvent) event;
try {
if (extensionEvent instanceof ExtensionUninstalledEvent) {
// Update documents index
getXarRepository().pagesRemoved(extensionEvent.getExtensionId(), extensionEvent.getNamespace());
// Update extension cache
getXarRepository().updateCachedXarExtension(extensionEvent.getExtensionId());
} else {
if (data != null) {
for (InstalledExtension installedExtension : (Collection<InstalledExtension>) data) {
// Update documents index
getXarRepository().pagesRemoved(installedExtension.getId(), extensionEvent.getNamespace());
// Update extension cache
getXarRepository().updateCachedXarExtension(installedExtension.getId());
}
}
// New extension
// Update extension cache
getXarRepository().updateCachedXarExtension(extensionEvent.getExtensionId());
// Update documents index
getXarRepository().pagesAdded(extensionEvent.getExtensionId(), extensionEvent.getNamespace());
}
} catch (UnsupportedNamespaceException e) {
logger.error("Failed to extract wiki from namespace [{}]", extensionEvent.getNamespace());
}
}
use of org.xwiki.extension.xar.internal.handler.UnsupportedNamespaceException 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);
}
}
}
Aggregations