Package org.zaproxy.zap.control
Class AddOnLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- org.zaproxy.zap.control.AddOnLoader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class AddOnLoader extends java.net.URLClassLoader
This class is heavily based on the original Paros class org.parosproxy.paros.common.DynamicLoader However its been restructured and enhanced to support multiple directories or versioned ZAP addons. The constructor takes an array of directories. All of the generic jars in the directories are loaded. Only the latest ZAP addons are loaded, so if the following addons are found: zap-ext-test-alpha-1.zap zap-ext-test-beta-2.zap zap-ext-test-alpha-3.zap then only the latest one (zap-ext-test-alpha-3.zap) will be loaded - this is entirely based on the version number. The status (alpha/beta/release) is for informational purposes only.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ADDONS_BLOCK_LIST
-
Constructor Summary
Constructors Constructor Description AddOnLoader(java.io.File[] dirs)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAddon(AddOn ao)
java.util.List<AbstractPlugin>
getActiveScanRules()
Gets the active scan rules of all the loaded add-ons.AddOnCollection
getAddOnCollection()
protected java.lang.Object
getClassLoadingLock(java.lang.String className)
java.util.List<Extension>
getExtensions()
Returns all theExtension
s of all the installed add-ons.java.util.List<Extension>
getExtensions(AddOn addOn)
Returns allExtension
s of the givenaddOn
.java.util.List<java.lang.String>
getIdsAddOnsWithRunningIssuesSinceLastRun()
Returns a list with the IDs of add-ons that have running issues since last run, either Java version was changed, or add-on dependencies are no longer met for the add-on or one of its extensions.<T> java.util.List<T>
getImplementors(java.lang.String packageName, java.lang.Class<T> classType)
Deprecated.(2.8.0) The use of this method is discouraged (specially during ZAP startup, as it's delayed), it's preferable to provide means to register/declare the required classes instead of searching "everywhere".<T> java.util.List<T>
getImplementors(AddOn ao, java.lang.String packageName, java.lang.Class<T> classType)
Deprecated.(2.8.0) The use of this method is discouraged (specially during ZAP startup, as it's delayed), it's preferable to provide means to register/declare the required classes instead of searching "everywhere".java.util.List<PluginPassiveScanner>
getPassiveScanRules()
Gets the passive scan rules of all the loaded add-ons.java.net.URL
getResource(java.lang.String name)
java.lang.Class<?>
loadClass(java.lang.String name)
boolean
removeAddOn(AddOn ao, boolean upgrading, AddOnUninstallationProgressCallback progressCallback)
-
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
ADDONS_BLOCK_LIST
public static final java.lang.String ADDONS_BLOCK_LIST
- See Also:
- Constant Field Values
-
-
Method Detail
-
getIdsAddOnsWithRunningIssuesSinceLastRun
public java.util.List<java.lang.String> getIdsAddOnsWithRunningIssuesSinceLastRun()
Returns a list with the IDs of add-ons that have running issues since last run, either Java version was changed, or add-on dependencies are no longer met for the add-on or one of its extensions.- Returns:
- a list with the add-ons that are not longer runnable
- Since:
- 2.4.0
-
loadClass
public java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
- Overrides:
loadClass
in classjava.lang.ClassLoader
- Throws:
java.lang.ClassNotFoundException
-
getClassLoadingLock
protected java.lang.Object getClassLoadingLock(java.lang.String className)
- Overrides:
getClassLoadingLock
in classjava.lang.ClassLoader
-
getResource
public java.net.URL getResource(java.lang.String name)
- Overrides:
getResource
in classjava.lang.ClassLoader
-
getAddOnCollection
public AddOnCollection getAddOnCollection()
-
addAddon
public void addAddon(AddOn ao)
-
removeAddOn
public boolean removeAddOn(AddOn ao, boolean upgrading, AddOnUninstallationProgressCallback progressCallback)
-
getExtensions
public java.util.List<Extension> getExtensions()
Returns all theExtension
s of all the installed add-ons.The discovery of
Extension
s is done by resorting to themanifest file
bundled in the add-ons.Extensions with unfulfilled dependencies are not be returned.
- Returns:
- a list containing all
Extension
s of all installed add-ons - Since:
- 2.4.0
- See Also:
Extension
,getExtensions(AddOn)
-
getExtensions
public java.util.List<Extension> getExtensions(AddOn addOn)
Returns allExtension
s of the givenaddOn
.The discovery of
Extension
s is done by resorting tomanifest file
bundled in the add-on.Extensions with unfulfilled dependencies are not be returned.
Note: If the add-on is not installed the method returns an empty list.
- Parameters:
addOn
- the add-on whose extensions will be returned- Returns:
- a list containing the
Extension
s of the givenaddOn
- Since:
- 2.4.0
- See Also:
Extension
,getExtensions()
-
getActiveScanRules
public java.util.List<AbstractPlugin> getActiveScanRules()
Gets the active scan rules of all the loaded add-ons.The discovery of active scan rules is done by resorting to
manifest file
bundled in the add-ons.- Returns:
- an unmodifiable
List
with all the active scan rules, nevernull
- Since:
- 2.4.0
- See Also:
AbstractPlugin
-
getPassiveScanRules
public java.util.List<PluginPassiveScanner> getPassiveScanRules()
Gets the passive scan rules of all the loaded add-ons.The discovery of passive scan rules is done by resorting to
manifest file
bundled in the add-ons.- Returns:
- an unmodifiable
List
with all the passive scan rules, nevernull
- Since:
- 2.4.0
- See Also:
PluginPassiveScanner
-
getImplementors
@Deprecated public <T> java.util.List<T> getImplementors(java.lang.String packageName, java.lang.Class<T> classType)
Deprecated.(2.8.0) The use of this method is discouraged (specially during ZAP startup, as it's delayed), it's preferable to provide means to register/declare the required classes instead of searching "everywhere".Gets a list of classes that implement the given type in the given package.It searches in the dependencies, add-ons, and the ZAP JAR.
- Parameters:
packageName
- the name of the package that the classes must be in.classType
- the type of the classes.- Returns:
- a list with the classes that implement the given type, never
null
.
-
getImplementors
@Deprecated public <T> java.util.List<T> getImplementors(AddOn ao, java.lang.String packageName, java.lang.Class<T> classType)
Deprecated.(2.8.0) The use of this method is discouraged (specially during ZAP startup, as it's delayed), it's preferable to provide means to register/declare the required classes instead of searching "everywhere".Gets a list of classes that implement the given type in the given package.It searches in the given add-on, if not
null
, otherwise it searches in the dependencies, add-ons, and the ZAP JAR.- Parameters:
ao
- the add-on to search in, might benull
.packageName
- the name of the package that the classes must be in.classType
- the type of the classes.- Returns:
- a list with the classes that implement the given type, never
null
.
-
-