public interface AmPlugin
@Inject
setters to get access to APIs available via
Guice dependency injection. For example, if you want to add an SMS service on install, you can add the following
setter:
@Inject
public void setPluginTools(PluginTools tools) {
this.tools = tools;
}
So that you can use the PluginTools.addSmsService(java.io.InputStream)
method to load your schema XML.
It can be assumed that when running, implementations of this class will be singleton instances.
It should not be expected that the runtime singleton instances will be the instances on which
AmPlugin.onAmUpgrade(String, String)
will be called. Guice-injected properties will also not be populated
during that method call.
Plugins should not use the ShutdownManager
/ShutdownListener
API for handling shutdown, as
the order of calling those listeners is not deterministic. The AmPlugin.onShutdown()
method for all plugins will
be called in the reverse order from the order that AmPlugin.onStartup()
was called, with dependent plugins being
notified after their dependencies for startup, and before them for shutdown.
Modifier and Type | Method and Description |
---|---|
default Map<Class<? extends AmPlugin>,String> |
getDependencies()
Get the collection of plugins that this plugin expects to be installed.
|
String |
getPluginVersion()
The plugin version.
|
default void |
onAmUpgrade(String fromVersion,
String toVersion)
Handle AM system upgrade.
|
void |
onInstall()
Handle plugin installation.
|
default void |
onShutdown()
Handle plugin shutdown.
|
default void |
onStartup()
Deprecated.
Use
AmPlugin.onStartup(StartupType) instead. |
default void |
onStartup(StartupType startupType)
Handle plugin startup.
|
default void |
onUnsatisfiedDependency(Set<String> missingDependencies)
This method will be called if the plugin has previously been installed, but the dependencies cannot currently be
satisfied.
|
default void |
upgrade(String fromVersion)
This method will be called when the version returned by
AmPlugin.getPluginVersion() is higher than the version
already installed. |
String getPluginVersion()
default Map<Class<? extends AmPlugin>,String> getDependencies()
AmPlugin.onInstall()
,
AmPlugin.upgrade(String)
and AmPlugin.onStartup()
methods will only be called if all these dependencies are
satisfied. If any plugin cannot be satisfied from the classpath, if the plugin is not yet installed, it will not
be installed and system installation will result in an error, otherwise the AmPlugin.onUnsatisfiedDependency(Set)
method will be called.[1.3,1.8.3)
for greater than or equal to 1.3 and less than 1.8.3.default void onUnsatisfiedDependency(Set<String> missingDependencies) throws PluginException
missingDependencies
- The plugin class names for all the plugin dependencies that cannot be satisfied.PluginException
void onInstall() throws PluginException
AmPlugin.onStartup()
method will be called after this one.PluginException
default void onAmUpgrade(String fromVersion, String toVersion) throws PluginException
AmPlugin.upgrade(String)
may be called,
and AmPlugin.onStartup()
will be called.fromVersion
- The old AM version.toVersion
- The new AM version.PluginException
default void upgrade(String fromVersion) throws PluginException
AmPlugin.getPluginVersion()
is higher than the version
already installed. This method will be called before the AmPlugin.onStartup()
method.fromVersion
- The old version of the plugin that has been installed.PluginException
default void onStartup(StartupType startupType) throws PluginException
AmPlugin.onInstall()
,
AmPlugin.onAmUpgrade(String, String)
and AmPlugin.upgrade(String)
have been called (if relevant).startupType
- The type of startup that is taking place.PluginException
@Deprecated default void onStartup() throws PluginException
AmPlugin.onStartup(StartupType)
instead.AmPlugin.onInstall()
,
AmPlugin.onAmUpgrade(String, String)
and AmPlugin.upgrade(String)
have been called (if relevant).PluginException
default void onShutdown()
AmPlugin.onStartup()
was called to
indicate that the plugin can startup.Copyright © 2010-2018, ForgeRock All Rights Reserved.