public interface Extension
Modifier and Type | Method and Description |
---|---|
boolean |
canUnload() |
void |
databaseOpen(Database db)
Implement this method to register database tables to be used by the add-on
|
void |
destroy()
Performs final cleanups, free resources.
|
List<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 String |
getAuthor()
Gets the author of the extension.
|
List<Class<? extends Extension>> |
getDependencies()
Gets the list of
Extension s that this extension depends on. |
String |
getDescription()
Returns the description of the extension, to be shown in UI components.
|
String |
getI18nPrefix() |
ResourceBundle |
getMessages()
Gets the resource bundle of the extension.
|
Model |
getModel() |
String |
getName()
Returns the name of the extension, for configurations and access from other components (e.g.
|
int |
getOrder() |
String |
getUIName()
Returns a short descriptive name of the extension, to be shown in UI components.
|
List<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 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(String prefix) |
void |
setMessages(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(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 the
ExtensionHook ). |
String getName()
null
getUIName()
String getUIName()
null
getName()
,
getDescription()
String getDescription()
null
@Deprecated default Version getVersion()
null
if not versionednull
if not versionedvoid init()
void initModel(Model model)
model
- the modelvoid initView(ViewDelegate view)
Model getModel()
ViewDelegate getView()
void start()
void stop()
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.
destroy()
void destroy()
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.
void initXML(Session session, OptionsParam options)
session
- the current sessionoptions
- the optionsvoid hook(ExtensionHook hook)
hook
- the hook to add the components.boolean isDepreciated()
int getOrder()
void setOrder(int order)
boolean isEnabled()
Extensions might be disabled by the user (for example, through GUI), or, automatically during loading if all its dependencies are not fulfilled.
true
if the extension is enabled, false
otherwise.void setEnabled(boolean enabled)
Note: This method should be called only by bootstrap classes.
enabled
- true
if the extension should be enabled, false
otherwise.List<Class<? extends Extension>> getDependencies()
Extension
s that this extension depends on.null
) if none.boolean isCore()
default String getAuthor()
Since 2.9.0 defaults to the author of the add-on, if set, otherwise an empty string.
null
.default URL getURL()
Since 2.10.0 defaults to null
.
null
.ResourceBundle getMessages()
Set during start up based on the available resource bundles:
resources
directory under the
extension's package;
null
.void setMessages(ResourceBundle messages)
Note: This method should be called only by bootstrap classes.
messages
- the resource bundle of the extension.String getI18nPrefix()
void setI18nPrefix(String prefix)
void optionsLoaded()
postInit()
boolean canUnload()
void unload()
ExtensionHook
).
Should be called only by core functionality (e.g. during uninstallation of the extension).
hook(ExtensionHook)
List<String> getUnsavedResources()
List
containing the unsaved resources or null
if nonegetActiveActions()
List<String> getActiveActions()
An active action is something that's started by the user, for example, a scan.
List
containing the active actions or null
if nonegetUnsavedResources()
void postInstall()
postInit()
void postInit()
postInstall()
void databaseOpen(Database db) throws DatabaseException, DatabaseUnsupportedException
db
- the database openedDatabaseException
- if an error occurred while reading the database contentsDatabaseUnsupportedException
- if the database is not supported by the extensionAddOn getAddOn()
null
if core extension.null
if core extension.void setAddOn(AddOn addOn)
Note: This method should be called only by bootstrap classes.
addOn
- the add-on where this extension is bundledboolean supportsDb(String type)
type
- the db typeDatabase.getType()
boolean supportsLowMemory()
true
if the extension support the 'low memory' option, false
otherwise