Search in sources :

Example 1 with DocumentNamespace

use of org.xwiki.model.namespace.DocumentNamespace in project xwiki-platform by xwiki.

the class DocumentDeletedListener method onEvent.

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

Aggregations

ComponentLifecycleException (org.xwiki.component.manager.ComponentLifecycleException)1 ComponentManager (org.xwiki.component.manager.ComponentManager)1 Disposable (org.xwiki.component.phase.Disposable)1 DocumentNamespace (org.xwiki.model.namespace.DocumentNamespace)1