NAME
PXP::PluginRegistry - Registry of plugins for PXP
SYNOPSIS
use PXP::PluginRegistry;
PXP::init(dir => './plugins', default => 'all', load => [], noload => []);
...
my $plugin = PXP::PluginRegistry::getExtension(ref($self))->plugin();
my $extpt = PXP::PluginRegistry::getExtensionPoint('PXP::StaticResourcesHandler');
ABSTRACT
The PluginRegistry groups together a set of plugins, extension points and extensions for the running system.
DESCRIPTION
The PluginRegistry manages plugins, extension points and extensions.
The PluginRegistry takes care of loading the plugins from file, loading classes and Perl modules and, optionnaly, running 'startup' sub-routines as each plugin is loaded in the system.
- init
-
Initialize the plugin registry. Note: only one instance of PluginRegistry is supported (singleton pattern).
- getPlugin(id)
-
Return a plugin referenced by its id, or undef if no such plugin exists.
Warning : a plugin id can be different from its actual object class, as declared in plugin.xml
- loadPluginsFromDirectory(directory)
-
Load all plugins present in the directory.
This is usually called once by by PXP::init. Plugin developpers can call this function to load plugins installed outside of the system default directory ('plugins' at the root of the PXP home directory).
See below for details about the loading process.
- getExtensionNode()
-
Return the internal XML node describing the extension in the plugin.xml file.
This is mostly used by plugin developpers to get access to the XML config.
- getExtension(id)
-
Search the registry for an
Extension
and return it, based on its id.This returns the internal extension descriptor object, ie an PXP::Extension object, not the real extension See the code for details of the private API.
Loading process
First, the PluginRegistry calls loadPluginFromDirectory to load all the plugins installed in the system directory (usually called 'plugins' inside the PXP hierarchy). The loader calculates the dependencies so that plugin can resolve symbols.
For each plugin, extension points are instantiated and registered into the global registry.
Then, extension _definitions_ are handed to the extension points to be registered. Extension points choose wether to instantiate a particular objet for each of their extensions.
Last, the PluginRegistry calls the 'startup' routine of each plugin that declared a specific class (class="" attribute inside the plugin.xml header).
An error during plugin load stops the process for a whole plugin dependency branch, but plugin startup is still called for plugins that have already been loaded.
SEE ALSO
See PXP::ExtensionPoint
, PXP::Extension
for details about the concepts
1;
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 69:
'=item' outside of any '=over'