Search in sources :

Example 6 with WikiDeletedEvent

use of org.xwiki.bridge.event.WikiDeletedEvent in project xwiki-platform by xwiki.

the class WikiDeletedListener method onEvent.

@Override
public void onEvent(Event event, Object o, Object context) {
    String wiki = ((WikiDeletedEvent) event).getWikiId();
    ComponentManager componentManager = this.componentManagerManager.getComponentManager(new WikiNamespace(wiki).serialize(), false);
    if (componentManager instanceof Disposable) {
        try {
            ((Disposable) componentManager).dispose();
        } catch (ComponentLifecycleException e) {
            this.logger.error(String.format("Failed to dispose component manager for wiki [%s]", wiki), e);
        }
    }
}
Also used : Disposable(org.xwiki.component.phase.Disposable) WikiNamespace(org.xwiki.model.namespace.WikiNamespace) ComponentManager(org.xwiki.component.manager.ComponentManager) ComponentLifecycleException(org.xwiki.component.manager.ComponentLifecycleException) WikiDeletedEvent(org.xwiki.bridge.event.WikiDeletedEvent)

Example 7 with WikiDeletedEvent

use of org.xwiki.bridge.event.WikiDeletedEvent in project xwiki-platform by xwiki.

the class AbstractDocumentTranslationBundle method onEvent.

// EventListener
@Override
public void onEvent(Event event, Object source, Object data) {
    if (event instanceof WikiDeletedEvent) {
        this.bundleCache.clear();
        this.disposed = true;
    } else {
        XWikiDocument document = (XWikiDocument) source;
        this.bundleCache.remove(document.getLocale());
        if (document.getLocale().equals(Locale.ROOT)) {
            this.bundleCache.remove(document.getDefaultLocale());
        }
    }
}
Also used : XWikiDocument(com.xpn.xwiki.doc.XWikiDocument) WikiDeletedEvent(org.xwiki.bridge.event.WikiDeletedEvent)

Aggregations

WikiDeletedEvent (org.xwiki.bridge.event.WikiDeletedEvent)7 XWikiDocument (com.xpn.xwiki.doc.XWikiDocument)3 ComponentManager (org.xwiki.component.manager.ComponentManager)2 DocumentReference (org.xwiki.model.reference.DocumentReference)2 WikiReference (org.xwiki.model.reference.WikiReference)2 XWikiContext (com.xpn.xwiki.XWikiContext)1 XWikiException (com.xpn.xwiki.XWikiException)1 XWikiAttachment (com.xpn.xwiki.doc.XWikiAttachment)1 AbstractAttachmentEvent (com.xpn.xwiki.internal.event.AbstractAttachmentEvent)1 AttachmentAddedEvent (com.xpn.xwiki.internal.event.AttachmentAddedEvent)1 AttachmentDeletedEvent (com.xpn.xwiki.internal.event.AttachmentDeletedEvent)1 AttachmentUpdatedEvent (com.xpn.xwiki.internal.event.AttachmentUpdatedEvent)1 EntityEvent (com.xpn.xwiki.internal.event.EntityEvent)1 XObjectAddedEvent (com.xpn.xwiki.internal.event.XObjectAddedEvent)1 XObjectDeletedEvent (com.xpn.xwiki.internal.event.XObjectDeletedEvent)1 XObjectPropertyAddedEvent (com.xpn.xwiki.internal.event.XObjectPropertyAddedEvent)1 XObjectPropertyDeletedEvent (com.xpn.xwiki.internal.event.XObjectPropertyDeletedEvent)1 XObjectPropertyUpdatedEvent (com.xpn.xwiki.internal.event.XObjectPropertyUpdatedEvent)1 XObjectUpdatedEvent (com.xpn.xwiki.internal.event.XObjectUpdatedEvent)1 File (java.io.File)1