Search in sources :

Example 1 with ContextDataFactory

use of org.zaproxy.zap.model.ContextDataFactory in project zaproxy by zaproxy.

the class ExtensionLoader method removeExtension.

/**
     * Removes an extension from internal list. As a result listeners added via
     * the {@link ExtensionHook} object are unregistered.
     *
     * @param extension
     * @param hook
     */
public void removeExtension(Extension extension, ExtensionHook hook) {
    extensionList.remove(extension);
    extensionsMap.remove(extension.getClass());
    if (hook == null) {
        logger.info("ExtensionHook is null for \"" + extension.getClass().getCanonicalName() + "\" the hooked objects will not be automatically removed.");
        return;
    }
    // by removing the ExtensionHook object,
    // the following listeners are no longer informed:
    // 		* SessionListeners
    // 		* OptionsChangedListeners
    extensionHooks.values().remove(hook);
    unloadOptions(hook);
    removePersistentConnectionListener(hook);
    removeProxyListener(hook);
    removeOverrideMessageProxyListener(hook);
    removeConnectRequestProxyListener(hook);
    removeSiteMapListener(hook);
    for (ContextDataFactory contextDataFactory : hook.getContextDataFactories()) {
        try {
            model.removeContextDataFactory(contextDataFactory);
        } catch (Exception e) {
            logger.error("Error while removing a ContextDataFactory from " + extension.getClass().getCanonicalName(), e);
        }
    }
    for (ApiImplementor apiImplementor : hook.getApiImplementors()) {
        try {
            API.getInstance().removeApiImplementor(apiImplementor);
        } catch (Exception e) {
            logger.error("Error while removing an ApiImplementor from " + extension.getClass().getCanonicalName(), e);
        }
    }
    removeViewInEDT(extension, hook);
}
Also used : ContextDataFactory(org.zaproxy.zap.model.ContextDataFactory) ApiImplementor(org.zaproxy.zap.extension.api.ApiImplementor) DatabaseException(org.parosproxy.paros.db.DatabaseException) DatabaseUnsupportedException(org.parosproxy.paros.db.DatabaseUnsupportedException)

Aggregations

DatabaseException (org.parosproxy.paros.db.DatabaseException)1 DatabaseUnsupportedException (org.parosproxy.paros.db.DatabaseUnsupportedException)1 ApiImplementor (org.zaproxy.zap.extension.api.ApiImplementor)1 ContextDataFactory (org.zaproxy.zap.model.ContextDataFactory)1