use of org.xwiki.extension.event.ExtensionEvent 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.event.ExtensionEvent in project xwiki-platform by xwiki.
the class JARTranslationBundleFactoryListener method onEvent.
@Override
public void onEvent(Event event, Object source, Object data) {
ExtensionEvent extensionEvent = (ExtensionEvent) event;
InstalledExtension extension = (InstalledExtension) source;
if (extension.getType().equals(EXTENSION_TYPE)) {
if (event instanceof ExtensionInstalledEvent) {
extensionAdded(extension, extensionEvent.getNamespace());
} else if (event instanceof ExtensionUninstalledEvent) {
extensionDeleted(extension, extensionEvent.getNamespace());
} else {
extensionUpgraded(extension, (Collection<InstalledExtension>) data, extensionEvent.getNamespace());
}
}
}
Aggregations