Interface Extension
-
- All Known Implementing Classes:
ExtensionActiveScan
,ExtensionAdaptor
,ExtensionAlert
,ExtensionAntiCSRF
,ExtensionAPI
,ExtensionAuthentication
,ExtensionAuthorization
,ExtensionAutoUpdate
,ExtensionBreak
,ExtensionCallback
,ExtensionCompare
,ExtensionCustomPages
,ExtensionDynSSL
,ExtensionEdit
,ExtensionExtension
,ExtensionForcedUser
,ExtensionGlobalExcludeURL
,ExtensionHelp
,ExtensionHistory
,ExtensionHttpPanelComponentAll
,ExtensionHttpPanelHexView
,ExtensionHttpPanelImageView
,ExtensionHttpPanelLargeRequestView
,ExtensionHttpPanelLargeResponseView
,ExtensionHttpPanelRequestFormTableView
,ExtensionHttpPanelRequestQueryCookieTableView
,ExtensionHttpPanelSyntaxHighlightTextView
,ExtensionHttpSessions
,ExtensionKeyboard
,ExtensionLog4j
,ExtensionManualRequestEditor
,ExtensionOption
,ExtensionParams
,ExtensionPassiveScan
,ExtensionProxies
,ExtensionRequestPostTableView
,ExtensionRuleConfig
,ExtensionScript
,ExtensionSearch
,ExtensionSessionManagement
,ExtensionSitesRefresh
,ExtensionSpider
,ExtensionState
,ExtensionStats
,ExtensionStdMenus
,ExtensionUiUtils
,ExtensionUserManagement
public interface Extension
Life cycle for an extension . init . initModel - the extension obtain the data model . initXML . getExtensionHook - workbench obtain the view of the plugin . start() . stop() . May go back to 5 depending on options or menu chosen. . destroy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description boolean
canUnload()
void
databaseOpen(Database db)
Implement this method to register database tables to be used by the add-onvoid
destroy()
Performs final cleanups, free resources.java.util.List<java.lang.String>
getActiveActions()
Returns the (internationalised) names of all active actions of the extension - if there are any the user will be given the option not to exit ZAP or, if the extension is bundled in an add-on that's being updated or uninstalled, not to continue with the changes.AddOn
getAddOn()
Returns the add-on where this extension is bundled.default java.lang.String
getAuthor()
Gets the author of the extension.java.util.List<java.lang.Class<? extends Extension>>
getDependencies()
Gets the list ofExtension
s that this extension depends on.java.lang.String
getDescription()
Returns the description of the extension, to be shown in UI components.java.lang.String
getI18nPrefix()
java.util.ResourceBundle
getMessages()
Gets the resource bundle of the extension.Model
getModel()
java.lang.String
getName()
Returns the name of the extension, for configurations and access from other components (e.g.int
getOrder()
java.lang.String
getUIName()
Returns a short descriptive name of the extension, to be shown in UI components.java.util.List<java.lang.String>
getUnsavedResources()
Extensions should return the user friendly names of any unsaved resources - if there are any the user will be given the option not to exit ZAP or, if the extension is bundled in an add-on that's being updated or uninstalled, not to continue with the changes.default java.net.URL
getURL()
Gets the URL to info about the extension.default Version
getVersion()
Deprecated.(2.8.0) Don't override, not used.ViewDelegate
getView()
void
hook(ExtensionHook hook)
Called during extension's initialisation to allow to add new functionality to core components.void
init()
Initialize plugin during startup.void
initModel(Model model)
Initialization of plugin after obtaining data model from core.void
initView(ViewDelegate view)
void
initXML(Session session, OptionsParam options)
Initialize session and options parameter if required XML node not in either files.boolean
isCore()
boolean
isDepreciated()
boolean
isEnabled()
Tells whether or not this extension is enabled.void
optionsLoaded()
Called after the options for this extension have been loaded, so that the extension can make use of them.void
postInit()
Implement this method to perform tasks after all extensions/add-ons have been initialised.void
postInstall()
Implement this method to perform tasks after the add-on is installed.void
setAddOn(AddOn addOn)
Sets the add-on where this extension is bundled.void
setEnabled(boolean enabled)
Sets whether or not this extension is enabled.void
setI18nPrefix(java.lang.String prefix)
void
setMessages(java.util.ResourceBundle messages)
Sets the resource bundle of the extension.void
setOrder(int order)
void
start()
Start the plugin e.g.void
stop()
Stops the extension, e.g.boolean
supportsDb(java.lang.String type)
Return true if the specified db type is supported by the extension (or if it doesn't use any db) If this method returns false (meaning the db in use is not supported) then the extension will not be loaded.boolean
supportsLowMemory()
Return true it the extension can run with the 'low memory' option.void
unload()
Unloads any component manually added to ZAP or other extensions (that is, a component that was not added through theExtensionHook
).
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the name of the extension, for configurations and access from other components (e.g. extensions).- Returns:
- the name of the extension, never
null
- See Also:
getUIName()
-
getUIName
java.lang.String getUIName()
Returns a short descriptive name of the extension, to be shown in UI components. The name must be internationalised.- Returns:
- the UI name of the extension, never
null
- Since:
- 2.4.0
- See Also:
getName()
,getDescription()
-
getDescription
java.lang.String getDescription()
Returns the description of the extension, to be shown in UI components. The description must be internationalised.- Returns:
- the description of the extension, never
null
-
getVersion
@Deprecated default Version getVersion()
Deprecated.(2.8.0) Don't override, not used.Returns the (semantic) version of this extension,null
if not versioned- Returns:
- the version of the extension, or
null
if not versioned - Since:
- 2.4.0
-
init
void init()
Initialize plugin during startup. This phase is carried out before all others.
-
initModel
void initModel(Model model)
Initialization of plugin after obtaining data model from core. Method should not depend on view.- Parameters:
model
- the model
-
initView
void initView(ViewDelegate view)
-
getModel
Model getModel()
-
getView
ViewDelegate getView()
-
start
void start()
Start the plugin e.g. if there is a running server.
-
stop
void stop()
Stops the extension, e.g. running scans, processes, servers.Called when the extension is removed (i.e. corresponding add-on is uninstalled) and when ZAP shuts down.
Should be called only by core functionality.
- See Also:
destroy()
-
destroy
void destroy()
Performs final cleanups, free resources.Called when the extension is removed (i.e. corresponding add-on is uninstalled) and when ZAP shuts down.
Called after
stopping
the extension.Should be called only by core functionality.
-
initXML
void initXML(Session session, OptionsParam options)
Initialize session and options parameter if required XML node not in either files.- Parameters:
session
- the current sessionoptions
- the options
-
hook
void hook(ExtensionHook hook)
Called during extension's initialisation to allow to add new functionality to core components.- Parameters:
hook
- the hook to add the components.
-
isDepreciated
boolean isDepreciated()
-
getOrder
int getOrder()
-
setOrder
void setOrder(int order)
-
isEnabled
boolean isEnabled()
Tells whether or not this extension is enabled.Extensions might be disabled by the user (for example, through GUI), or, automatically during loading if all its dependencies are not fulfilled.
- Returns:
true
if the extension is enabled,false
otherwise.
-
setEnabled
void setEnabled(boolean enabled)
Sets whether or not this extension is enabled.Note: This method should be called only by bootstrap classes.
- Parameters:
enabled
-true
if the extension should be enabled,false
otherwise.
-
getDependencies
java.util.List<java.lang.Class<? extends Extension>> getDependencies()
Gets the list ofExtension
s that this extension depends on.- Returns:
- the list of dependencies, empty (or
null
) if none.
-
isCore
boolean isCore()
-
getAuthor
default java.lang.String getAuthor()
Gets the author of the extension.Since 2.9.0 defaults to the author of the add-on, if set, otherwise an empty string.
- Returns:
- the author of the extension, might be
null
. - Since:
- 1.4.0
-
getURL
default java.net.URL getURL()
Gets the URL to info about the extension.Since 2.10.0 defaults to
null
.- Returns:
- the URL to info about the extension, might be
null
. - Since:
- 1.4.0
-
getMessages
java.util.ResourceBundle getMessages()
Gets the resource bundle of the extension.Set during start up based on the available resource bundles:
- extension's resource bundle, located in the
resources
directory under the extension's package; - add-on's resource bundle;
- core resource bundle;
- Returns:
- the resource bundle, never
null
. - Since:
- 2.0.0
- extension's resource bundle, located in the
-
setMessages
void setMessages(java.util.ResourceBundle messages)
Sets the resource bundle of the extension.Note: This method should be called only by bootstrap classes.
- Parameters:
messages
- the resource bundle of the extension.- Since:
- 2.0.0
-
getI18nPrefix
java.lang.String getI18nPrefix()
-
setI18nPrefix
void setI18nPrefix(java.lang.String prefix)
-
optionsLoaded
void optionsLoaded()
Called after the options for this extension have been loaded, so that the extension can make use of them. Note that other add-ons may not have been loaded at this point - if you need them to be then implement postInit()- See Also:
postInit()
-
canUnload
boolean canUnload()
-
unload
void unload()
Unloads any component manually added to ZAP or other extensions (that is, a component that was not added through theExtensionHook
).Should be called only by core functionality (e.g. during uninstallation of the extension).
- See Also:
hook(ExtensionHook)
-
getUnsavedResources
java.util.List<java.lang.String> getUnsavedResources()
Extensions should return the user friendly names of any unsaved resources - if there are any the user will be given the option not to exit ZAP or, if the extension is bundled in an add-on that's being updated or uninstalled, not to continue with the changes.- Returns:
- a
List
containing the unsaved resources ornull
if none - Since:
- 2.2.0
- See Also:
getActiveActions()
-
getActiveActions
java.util.List<java.lang.String> getActiveActions()
Returns the (internationalised) names of all active actions of the extension - if there are any the user will be given the option not to exit ZAP or, if the extension is bundled in an add-on that's being updated or uninstalled, not to continue with the changes.An active action is something that's started by the user, for example, a scan.
- Returns:
- a
List
containing the active actions ornull
if none - Since:
- 2.4.0
- See Also:
getUnsavedResources()
-
postInstall
void postInstall()
Implement this method to perform tasks after the add-on is installed. Note that this will only be called if the user adds the add-on via ZAP, e.g. file the File menu or the Marketplace. If the add-on is installed by copying the file to the plugins directory then it will not be called.- Since:
- 2.3.0
- See Also:
postInit()
-
postInit
void postInit()
Implement this method to perform tasks after all extensions/add-ons have been initialised.- Since:
- 2.4.0
- See Also:
postInstall()
-
databaseOpen
void databaseOpen(Database db) throws DatabaseException, DatabaseUnsupportedException
Implement this method to register database tables to be used by the add-on- Parameters:
db
- the database opened- Throws:
DatabaseException
- if an error occurred while reading the database contentsDatabaseUnsupportedException
- if the database is not supported by the extension
-
getAddOn
AddOn getAddOn()
Returns the add-on where this extension is bundled. Might benull
if core extension.- Returns:
- the add-on where this extension is bundled, or
null
if core extension. - Since:
- 2.4.0
-
setAddOn
void setAddOn(AddOn addOn)
Sets the add-on where this extension is bundled.Note: This method should be called only by bootstrap classes.
- Parameters:
addOn
- the add-on where this extension is bundled- Since:
- 2.4.0
-
supportsDb
boolean supportsDb(java.lang.String type)
Return true if the specified db type is supported by the extension (or if it doesn't use any db) If this method returns false (meaning the db in use is not supported) then the extension will not be loaded.- Parameters:
type
- the db type- Returns:
- true if the specified db type is supported by the extension (or if it doesn't use any db)
- See Also:
Database.getType()
-
supportsLowMemory
boolean supportsLowMemory()
Return true it the extension can run with the 'low memory' option. If the low memory option is set (and the extension supports it) then code should minimize the data stored in memory, using the db for all significant data. Extensions that do not support the low memory option will not be run if the option is set.- Returns:
true
if the extension support the 'low memory' option,false
otherwise
-
-