Interface AmPlugin
- All Known Implementing Classes:
AbstractNodeAmPlugin
,IotPlugin
@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
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 onShutdown()
method for all plugins will
be called in the reverse order from the order that onStartup()
was called, with dependent plugins being
notified after their dependencies for startup, and before them for shutdown.
-
Method Summary
Modifier and TypeMethodDescriptionGet the collection of plugins that this plugin expects to be installed.The plugin version.Defines the SMS Service name and an SMS Service Schema XML for each service that thisAmPlugin
implementation registers as part of startup.default void
onAmUpgrade
(String fromVersion, String toVersion) Handle AM system upgrade.void
Handle plugin installation.default void
Handle plugin shutdown.default void
Deprecated.default void
onStartup
(org.forgerock.openam.plugins.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
This method will be called when the version returned bygetPluginVersion()
is higher than the version already installed.
-
Method Details
-
getPluginVersion
String getPluginVersion()The plugin version. This must be in semver (semantic version) format.- Returns:
- The version of the plugin.
- See Also:
-
getDependencies
Get the collection of plugins that this plugin expects to be installed. TheonInstall()
,upgrade(String)
andonStartup()
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 theonUnsatisfiedDependency(Set)
method will be called.- Returns:
- A non-null map of plugin class to plugin version for the dependencies of this plugin. The version can use
OSGi version range syntax, e.g.
[1.3,1.8.3)
for greater than or equal to 1.3 and less than 1.8.3. - See Also:
-
onUnsatisfiedDependency
This method will be called if the plugin has previously been installed, but the dependencies cannot currently be satisfied.- Parameters:
missingDependencies
- The plugin class names for all the plugin dependencies that cannot be satisfied.- Throws:
PluginException
-
onInstall
Handle plugin installation. This method will only be called once, on first AM startup once the plugin is included in the classpath. TheonStartup()
method will be called after this one.- Throws:
PluginException
-
onAmUpgrade
Handle AM system upgrade. This method will be called once for each system upgrade that takes place after the plugin has already been installed. After this method is called,upgrade(String)
may be called, andonStartup()
will be called.- Parameters:
fromVersion
- The old AM version.toVersion
- The new AM version.- Throws:
PluginException
-
upgrade
This method will be called when the version returned bygetPluginVersion()
is higher than the version already installed. This method will be called before theonStartup()
method.- Parameters:
fromVersion
- The old version of the plugin that has been installed.- Throws:
PluginException
-
onStartup
Handle plugin startup. This method will be called every time AM starts, afteronInstall()
,onAmUpgrade(String, String)
andupgrade(String)
have been called (if relevant).- Parameters:
startupType
- The type of startup that is taking place.- Throws:
PluginException
-
onStartup
Deprecated.UseonStartup(StartupType)
instead.Handle plugin startup. This method will be called every time AM starts, afteronInstall()
,onAmUpgrade(String, String)
andupgrade(String)
have been called (if relevant).- Throws:
PluginException
-
onShutdown
default void onShutdown()Handle plugin shutdown. This method will be called when AM is shutting down, and should be used to close any resources that the plugin is using. This method will only be called ifonStartup()
was called to indicate that the plugin can startup. -
getServiceSchemaXML
Defines the SMS Service name and an SMS Service Schema XML for each service that thisAmPlugin
implementation registers as part of startup.On Startup: this method will be called to automatically request the XML schema and then load it into the SMS both during configuration and after a restart.
- Returns:
- If this
AmPlugin
implementation does not define any SMS services then this method can returnnull
or an emptyMap
. Otherwise it should return a mapping of the SMS Service name and its corresponding SMS Service Schema. - Throws:
PluginException
- if there is a problem getting the serviceSchemaXML
-
onStartup(StartupType)
instead.