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);
}
Aggregations