Class AbstractNodeAmPlugin
- All Implemented Interfaces:
AmPlugin
- Direct Known Subclasses:
IotPlugin
A convenient base class for AmPlugins that provide authentication nodes.
Note on implementing the AmPlugin.getPluginVersion() method:
Nodes extending this class and overriding the AmPlugin.getPluginVersion() may declare themselves as being of
version "0.0.0" (PluginTools.DEVELOPMENT_VERSION) The framework will recognise this as meaning the plugin is
still in development. This can be utilised to ensure that the SMS is installed fresh after updating a node .jar in
the /WEB-INF/lib/ directory to carry over updates to the node's config. Simply shutdown AM, copy over the new .jar
and startup AM.
This process will break any instance of the node (and tree containing that node) which already exists as part of a tree. Therefore, nodes whose plugins extend this class using version "0.0.0" should be tested in development trees which should be destroyed and recreated after every restart.
Once ready for release, and for subsequent upgrades, the AmPlugin.getPluginVersion() method should be overridden
again to reflect the appropriate release version.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected PluginToolsAn instance of thePluginToolsfor use when setting up the plugin. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetNodes()Deprecated.Retrieve the Map of list of node classes that the plugin is providing.voidHandle plugin installation.voidonStartup(org.forgerock.openam.plugins.StartupType startupType) Handle plugin startup.voidsetPluginTools(PluginTools pluginTools) Guice setter forpluginTools.voidThis method will be called when the version returned byAmPlugin.getPluginVersion()is higher than the version already installed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.forgerock.openam.plugins.AmPlugin
getDependencies, getPluginVersion, getServiceSchemaXML, onAmUpgrade, onShutdown, onStartup, onUnsatisfiedDependency
-
Field Details
-
pluginTools
An instance of thePluginToolsfor use when setting up the plugin.
-
-
Constructor Details
-
AbstractNodeAmPlugin
public AbstractNodeAmPlugin()
-
-
Method Details
-
setPluginTools
Guice setter forpluginTools.- Parameters:
pluginTools- The tools.
-
onInstall
Description copied from interface:AmPluginHandle plugin installation. This method will only be called once, on first AM startup once the plugin is included in the classpath. TheAmPlugin.onStartup()method will be called after this one.- Specified by:
onInstallin interfaceAmPlugin- Throws:
PluginException
-
onStartup
Description copied from interface:AmPluginHandle plugin startup. This method will be called every time AM starts, afterAmPlugin.onInstall(),AmPlugin.onAmUpgrade(String, String)andAmPlugin.upgrade(String)have been called (if relevant).- Specified by:
onStartupin interfaceAmPlugin- Parameters:
startupType- The type of startup that is taking place.- Throws:
PluginException
-
upgrade
Description copied from interface:AmPluginThis method will be called when the version returned byAmPlugin.getPluginVersion()is higher than the version already installed. This method will be called before theAmPlugin.onStartup()method.- Specified by:
upgradein interfaceAmPlugin- Parameters:
fromVersion- The old version of the plugin that has been installed.- Throws:
PluginException
-
getNodesByVersion
Retrieve the Map of list of node classes that the plugin is providing. The mappings returned describe which nodes have been introduced in which version of this plugin. For example:return ImmutableMap.of( "1.0.0", asList(ChoiceCollectorNode.class), "2.0.0", asList(SetPersistentCookieNode.class));Tells that this node plugin's 1.0.0 version has introduced the ChoiceCollectorNode, the 2.0.0 version has introduced the SetPersistentCookieNode.- Returns:
- The list of node classes.
-
getNodes
@Deprecated protected Iterable<? extends Class<? extends Node>> getNodes() throws UnsupportedOperationExceptionDeprecated.in favour ofgetNodesByVersion()Specify the list of node classes that the plugin is providing. These will then be installed and registered at the appropriate times in plugin lifecycle.- Returns:
- The list of node classes.
- Throws:
UnsupportedOperationException- if called as this method is now deprecated.
-
getNodesByVersion()