@Override public void unregisterComponent(Type role, String hint) { getComponentManager().unregisterComponent(role, hint); }
@Override public void unregisterComponent(ComponentDescriptor<?> classComponentDescriptor) { getComponentManager().unregisterComponent(classComponentDescriptor); }
@Override public void onEvent(Event event, Object source, Object data) { super.onEvent(event, source, data); if (event instanceof WikiDeletedEvent) { // Unregister the component here because DocumentTranslationBundleFactory won't (it does not receive // document deleted event when a wiki is deleted) this.componentManager.unregisterComponent(this.descriptor); } } }
/** * @param extension the installed extension * @param namespace the namespace where the extension has been installed */ private void extensionDeleted(InstalledExtension extension, String namespace) { try { ComponentDescriptor<TranslationBundle> descriptor = createComponentDescriptor(extension); ComponentManager componentManager = this.componentManagerManager.getComponentManager(namespace, false); componentManager.unregisterComponent(descriptor); } catch (Exception e) { this.logger.error("Failed to create TranslationBundle descriptor for extension [{}]", extension, e); } }
manager.unregisterComponent(componentDescriptor); classComponentDescriptor.setRoleType(roleClass); manager.unregisterComponent(classComponentDescriptor);
/** * @param document the translation document */ private void unregisterTranslationBundle(XWikiDocument document) { Scope scope = getScope(document); // Unregister component if (scope != null && scope != Scope.ON_DEMAND) { ComponentDescriptor<TranslationBundle> descriptor = createComponentDescriptor(document.getDocumentReference()); getComponentManager(document, scope, true).unregisterComponent(descriptor); } // Remove from cache this.onDemandBundleCache.remove(this.uidSerializer.serialize(document.getDocumentReference())); }
private void unregisterWikiComponent(Iterator<WikiComponent> iterator) throws WikiComponentException { WikiComponent wikiComponent = iterator.next(); // Save current context information DocumentReference currentUserReference = this.wikiComponentManagerContext.getCurrentUserReference(); EntityReference currentEntityReference = this.wikiComponentManagerContext.getCurrentEntityReference(); try { // Set the proper information so the component manager use the proper keys to find components to // unregister this.wikiComponentManagerContext.setCurrentUserReference(wikiComponent.getAuthorReference()); this.wikiComponentManagerContext.setCurrentEntityReference(wikiComponent.getEntityReference()); // Remove from the Component Manager getComponentManager(wikiComponent.getScope()).unregisterComponent(wikiComponent.getRoleType(), wikiComponent.getRoleHint()); // Remove from the wiki component cache iterator.remove(); } catch (ComponentLookupException e) { throw new WikiComponentException(String.format("Failed to find a component manager for scope [%s]", wikiComponent.getScope()), e); } finally { this.wikiComponentManagerContext.setCurrentUserReference(currentUserReference); this.wikiComponentManagerContext.setCurrentEntityReference(currentEntityReference); } }