Removes the passed plugin from all applications and afterwards deletes the plugin itself. This overrides the
generic method to delete {@link AbstractCrudService#delete(de.terrestris.shoguncore.model.PersistentObject)}.

@param plugin
348276
@Override
    @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#plugin, 'DELETE')")
    public void delete(E plugin) {
        if (applicationService == null) {
            LOG.error("Plugin cannot be deleted, failed to autowire application service");
            return;
        }

        List<Application> apps = applicationService.findAllWithCollectionContaining("plugins", plugin);
        Integer pluginId = plugin.getId();
        for (Application app : apps) {
            List<Plugin> plugins = app.getPlugins();
            if (plugins != null && plugins.contains(plugin)) {
                String msg = String.format(
                    "Remove plugin (id=%s) from application (id=%s)",
                    pluginId, app.getId()
                );
                LOG.debug(msg);
                plugins.remove(plugin);
                // TODO will this use the the PreAuthorize annotations of AbstractCrudService wrt WRITE on the app?
                applicationService.saveOrUpdate(app);
            }
        }
        LOG.debug(String.format("Delete plugin (id=%s)", pluginId));
        // call overridden parent to actually delete the entity itself
        super.delete(plugin);
    }
204004
public void removeBeanContextServicesListener(BeanContextServicesListener listener)
	{
		if (listener == null)
		{
			throw new NullPointerException();
		}
		synchronized (bcsListeners)
		{
			bcsListeners.remove(listener);
		}
	}
901557
public synchronized void removeComponent(ComponentEvent event)
    {
        if(log.isDebugEnabled())log.debug("Component removed "+event);
        
        try
        {
            Object o=event.getComponent();
            Holder holder=(Holder)_mbeanMap.remove(o);
            if (holder!=null)
                getMBeanServer().unregisterMBean(holder.oName);
            else if (o==_httpServer)
                getMBeanServer().unregisterMBean(this.getObjectName());
        }
        catch(Exception e)
        {
            log.warn(LogSupport.EXCEPTION,e);
        }
    }
958013
public void removePluginConfig(PluginConfig pluginConfig, boolean recursive) throws Exception {
        long startTime = System.currentTimeMillis();
        Exception exception = null;
        if (!cfg.exists()) {
            init();
        }
        userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
        System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
        try {
            ConfigurationManager manager = new ConfigurationManager(cfg, false);

            ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
            cfgProvider.removePluginConfig(pluginConfig, recursive);
        } catch (Exception e) {
            exception = e;
        } finally {
            System.setProperty("user.dir", userDir);
            updateMsg(startTime, exception);
        }
    }
416518
@Override
    public final boolean delete(Context cx, Object id) {
        if (cx == null) cx = Context.getCurrentContext();
        XMLName xmlName = lib.toXMLNameOrIndex(cx, id);
        if (xmlName == null) {
            long index = ScriptRuntime.lastUint32Result(cx);
            // XXX Fix this
            delete((int)index);
            return true;
        }
        deleteXMLProperty(xmlName);
        return true;
    }
169369
protected function uninstallCMSNavItems(Plugin $plugin)
    {
        $dto = new DTO(array('PluginID' => $plugin->PluginID));
        $navitems = $this->CMSNavItemService->findAll($dto)->getResults();

        rsort($navitems);

        foreach ($navitems as $navitem) {
            $this->CMSNavItemService->delete($navitem->Slug);
        }
    }
965340
public function deletePlugin($provider, $pluginId)
    {
        foreach ($this->providersByCompatibility[$provider] as $titleProviders) {
            foreach ($titleProviders as $modeProviders) {
                foreach ($modeProviders as $providerId) {
                    $providerService = $this->container->get($providerId);
                    $providerService->deletePlugin($pluginId);
                }
            }
        }
    }
88256
public void destroy() {
        if (mApplicationDepot != null) {
            mLog.info("Destroying ApplicationDepot");
            mApplicationDepot.destroy();
        }
        for (Iterator i = getPlugins().values().iterator(); i.hasNext(); )
            ((Plugin) i.next()).destroy();
    }
1278764
public void deleteTSMeta(final String tsuid) {
    if (search != null) {
      search.deleteTSMeta(tsuid).addErrback(new PluginError());
    }
  }
881198
function setPlugin (plugin) {
          if (plugin) {
            api._ = plugin;
            api.parentElement = plugin.parentElement;
            api.$ = $(plugin);
          }
          else {
            api._ = null;
            api.parentElement = null;
            api.$ = $();
          }
        }
112112
def close(self):
        '''
        
        '''
        for plugin_key in self.plugins_dict:
            obj = self.plugins_dict[plugin_key]
            instance = obj['instance']
            instance.close()
554374
function removePlugin(config, pluginName) {
    var deps = config.getPluginDependencies();

    // For default plugin, we have to disable it instead of removing from the list
    if (isDefaultPlugin(pluginName)) {
        return togglePlugin(config, pluginName, false);
    }

    // Remove the dependency from the list
    deps = deps.filterNot(function(dep) {
        return dep.getName() === pluginName;
    });
    return config.setPluginDependencies(deps);
}
160352
public function validatePlugin($plugin)
    {
        if ($plugin instanceof RouteInterface) {
            // we're okay
            return;
        }

        throw new RuntimeException(sprintf(
            'Plugin of type %s is invalid; must implement %s\RouteInterface',
            (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
            __NAMESPACE__
        ));
    }
138237
public void removeService(ServiceReference reference, Object service) {
        if (serviceRegistration != null) {
            serviceRegistration.unregister();
            serviceRegistration = null;
        }

        String alias = this.getAlias();
        ((HttpService) service).unregister(alias);
        if (servlet instanceof WebappServlet)
            ((WebappServlet)servlet).free();
        servlet = null;
    }
795995
public void addPlugin(final Plugin plugin) {
        // put plugin into the repository's reciever map
        synchronized (pluginMap) {
            String name = plugin.getName();

            // make sure the plugin has reference to repository
            plugin.setLoggerRepository(getLoggerRepository());

            Plugin existingPlugin = (Plugin) pluginMap.get(name);
            if (existingPlugin != null) {
                existingPlugin.shutdown();
            }

            // put the new plugin into the map
            pluginMap.put(name, plugin);
            firePluginStarted(plugin);
        }
    }
922
@Override
  public boolean delete(Object bean) throws OptimisticLockException {
    methodCalls.add(MethodCall.of("bean").with("bean", bean));
    capturedBeans.addDeleted(bean);
    if (persistDeletes) {
      return delete.delete(bean, null);
    }
    return true;
  }
756460
public void unregisterListener(IPluginEventListener listener) {
        if (pluginEventListeners2 != null && pluginEventListeners2.contains(listener)) {
            pluginEventListeners2.remove(listener);
            listener.onPluginEvent(new PluginEvent(this, PluginAction.UNSUBSCRIBE));
        }
    }